OCTTDocument.cs :  » Business-Application » Timetabler » OpenCTT » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Business Application » Timetabler 
Timetabler » OpenCTT » OCTTDocument.cs
#region Open Course Timetabler - An application for school and university course timetabling
//
// Author:
//   Ivan urak (mailto:Ivan.Curak@fesb.hr)
//
// Copyright (c) 2007 Ivan urak, Split, Croatia
//
// http://www.openctt.org
//
//This file is part of Open Course Timetabler.
//
//Open Course Timetabler is free software;
//you can redistribute it and/or modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2 of the License,
//or (at your option) any later version.
//
//Open Course Timetabler is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
//or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//You should have received a copy of the GNU General Public License along with
//Open Course Timetabler; if not, write to the Free Software Foundation, Inc., 51 Franklin St,
//Fifth Floor, Boston, MA  02110-1301  USA

#endregion

using System;
using System.Collections;
using System.Windows.Forms;
using System.Globalization;
using System.Resources;



namespace OpenCTT{
  /// <summary>
  /// Summary description for OCTTDocument.
  /// </summary>
  public class OCTTDocument
  {
    private static ResourceManager RES_MANAGER;  

    private int _documentType; //1-school, 2-university
    private string _documentVersion;
    private string _eduInstitutionName;
    private string _schoolYear;

    private string _fileName;
    private string _fullPath;

    private ArrayList _courseTypesList;
    private ArrayList _teacherTitlesList;
    private ArrayList _teacherEduRanksList;
    
    private int _totalNumberOfUnallocatedLessons;

    private bool [] _includedDays;
    private ArrayList _includedTerms;

    private TreeNode _coursesRootNode;
    private TreeNode _teachersRootNode;
    private TreeNode _roomsRootNode;

    private EduProgram _shownEduProgram;  

    private TreeNode _ctvSelectedNode;
    private TreeNode _ttvSelectedNode;
    private TreeNode _rtvSelectedNode;


    public OCTTDocument()
    {
      if(RES_MANAGER==null)
      {
        RES_MANAGER = new System.Resources.ResourceManager("OpenCTT.MyStrings.OCTTDocument",this.GetType().Assembly);
      }

      _courseTypesList= new ArrayList();
      _teacherTitlesList= new ArrayList();
      _teacherEduRanksList= new ArrayList();

      _totalNumberOfUnallocatedLessons=0;

      _includedDays=new bool[7];
      _includedTerms=new ArrayList();

      _coursesRootNode= new TreeNode();
      _teachersRootNode= new TreeNode();
      _roomsRootNode= new TreeNode();

      _shownEduProgram=null;

      _ctvSelectedNode=null;
      _ttvSelectedNode=null;
      _rtvSelectedNode=null;
    }

    public int DocumentType
    {
      get
      {
        return _documentType;
      }
      set
      {
        _documentType=value;
      }
    }

    public string DocumentVersion
    {
      get
      {
        return _documentVersion;
      }
      set
      {
        _documentVersion=value;
      }
    }

    public string EduInstitutionName
    {
      get
      {
        return _eduInstitutionName;
      }
      set
      {
        _eduInstitutionName=value;
      }
    }

    public string SchoolYear
    {
      get
      {
        return _schoolYear;
      }
      set
      {
        _schoolYear=value;
      }
    }

    public string RootNodeText
    {
      get
      {
        string text=_eduInstitutionName;

        if(_schoolYear!="")
        {
          text+=", "+_schoolYear;
        }
        return text;
      }
    }

    public string FileName
    {
      get
      {
        return _fileName;
      }
      set
      {
        _fileName=value;
      }
    }


    public string FullPath
    {
      get
      {
        return _fullPath;
      }
      set
      {
        _fullPath=value;
      }
    }

    public ArrayList CourseTypesList
    {
      get
      {
        return _courseTypesList;
      }
      set
      {
        _courseTypesList=value;
      }
    }

    public ArrayList TeacherTitlesList
    {
      get
      {
        return _teacherTitlesList;
      }
      set
      {
        _teacherTitlesList=value;
      }
    }

    public ArrayList TeacherEduRanksList
    {
      get
      {
        return _teacherEduRanksList;
      }
      set
      {
        _teacherEduRanksList=value;
      }
    }

    public int TotalNumberOfUnallocatedLessons
    {
      get
      {
        return _totalNumberOfUnallocatedLessons;
      }
      set
      {
        _totalNumberOfUnallocatedLessons=value;
      }
    }

    public bool [] IncludedDays
    {
      get
      {
        return _includedDays;
      }
      set
      {
        _includedDays=value;
      }
    }

    public ArrayList IncludedTerms
    {
      get
      {
        return _includedTerms;
      }
      set
      {
        _includedTerms=value;
      }
    }

    public TreeNode CoursesRootNode
    {
      get
      {
        return _coursesRootNode;
      } 
    }

    public TreeNode TeachersRootNode
    {
      get
      {
        return _teachersRootNode;
      }
    }

    public TreeNode RoomsRootNode
    {
      get
      {
        return _roomsRootNode;
      }
    }

    public EduProgram ShownEduProgram
    {
      get
      {
        return _shownEduProgram;
      }
      set
      {
        _shownEduProgram=value;
      }
    }

    public TreeNode CTVSelectedNode
    {
      get
      {
        return _ctvSelectedNode;
      }
      set
      {
        _ctvSelectedNode=value;
      }
    }

    public TreeNode TTVSelectedNode
    {
      get
      {
        return _ttvSelectedNode;
      }
      set
      {
        _ttvSelectedNode=value;
      }
    }

    public TreeNode RTVSelectedNode
    {
      get
      {
        return _rtvSelectedNode;
      }
      set
      {
        _rtvSelectedNode=value;
      }
    }

    



    public string getNumOfUnallocatedLessonsStatusText()
    {  
      return RES_MANAGER.GetString("getNumOfUnallocatedLessonsStatusText.text")+" "+_totalNumberOfUnallocatedLessons;
    }

    public void decrUnallocatedLessonsCounter(int step)
    {      
      _totalNumberOfUnallocatedLessons=_totalNumberOfUnallocatedLessons-step;
    }

    public void incrUnallocatedLessonsCounter(int step)
    {
      _totalNumberOfUnallocatedLessons=_totalNumberOfUnallocatedLessons+step;
    }

    public int getNumberOfDays()
    {
      int number=0;
      foreach(bool b in _includedDays)
      {
        if(b==true)
        {
          number++;
        }
      }

      return number;
    }

    public bool getIsDayIncluded(int index)
    {
      return _includedDays[index];
    }

    public void setIsDayIncluded(int index, bool isIncl)
    {
      _includedDays[index]=isIncl;
    }

    public int getDayIndexInModel(int index)
    {
      int indexInModel=-1;
      for(int n=0;n<=index;n++)
      {
        if(_includedDays[n]==true)
        {
          indexInModel++;
        }
      }
      return indexInModel;
    }

        public int getRealWeekDayIndex(int indexInModel)
        {
            int realWeekIndex = 0;
            int n = 0;
            int k = 0;
            while(n<indexInModel)
            {
                
                if (_includedDays[k] == true)
                {
                    n++;
                    realWeekIndex = k+1;
                }

                k++;
            }
            return realWeekIndex;
        }  

    public void refreshTreeRootText()
    {
      _coursesRootNode.Text = this.RootNodeText;
      _teachersRootNode.Text = this.RootNodeText;
      _roomsRootNode.Text = this.RootNodeText;
    }

    

  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.