SoftConsCourseSettingsForm.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 » SoftConsCourseSettingsForm.cs
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace OpenCTT{    

    public partial class SoftConsCourseSettingsForm : Form
    {
        private Course _myCourse;

        int x1Start, x2Start, x3Start;
        bool xCheckStart;

        public SoftConsCourseSettingsForm(Course course)
        {
            _myCourse = course;

            InitializeComponent();
        }

        private void SoftConsCourseSettingsForm_Load(object sender, EventArgs e)
        {
            string lessCountString;
            int lessCount = _myCourse.getNumberOfLessonsPerWeek();
            if (lessCount < 10)
            {
                lessCountString = _myCourse.getNumberOfLessonsPerWeek().ToString();
            }
            else
            {
                lessCountString = "default";
            }            

            int[] lb = _myCourse.SCLessonBlocksParameters;

            if (lb != null)
            {
                _d1TextBox.Text = lb[0].ToString();
                _d2TextBox.Text = lb[1].ToString();
                _d3TextBox.Text = lb[2].ToString();

                _obsCheckBox.Checked = true;
                xCheckStart = true;
            }
            else
            {
                int[] cc2 = (int[])SCBaseSettings.COURSE_LESSON_BLOCKS[lessCountString];
                _d1TextBox.Text = cc2[0].ToString();
                _d2TextBox.Text = cc2[1].ToString();
                _d3TextBox.Text = cc2[2].ToString();

                _obsCheckBox.Checked = false;
                xCheckStart = false;

                _d1TextBox.ReadOnly = true;
                _d2TextBox.ReadOnly = true;
                _d3TextBox.ReadOnly = true;
            }

            _okButton.Enabled = false;

            this.Text = AppForm.getAppForm()._scCourseMenuItem.Text;

            x1Start = Int32.Parse(_d1TextBox.Text);
            x2Start = Int32.Parse(_d2TextBox.Text);
            x3Start = Int32.Parse(_d3TextBox.Text);
        }


        //////////
        private void _obsCheckBox_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox cb = (CheckBox)sender;
            if (cb.Checked)
            {
                _d1TextBox.ReadOnly = false;
                _d2TextBox.ReadOnly = false;
                _d3TextBox.ReadOnly = false;

            }
            else
            {
                _d1TextBox.ReadOnly = true;
                _d2TextBox.ReadOnly = true;
                _d3TextBox.ReadOnly = true;

                string lessCountString;
                int lessCount = _myCourse.getNumberOfLessonsPerWeek();
                if (lessCount < 10)
                {
                    lessCountString = _myCourse.getNumberOfLessonsPerWeek().ToString();
                }
                else
                {
                    lessCountString = "default";
                }      
                
                int[] cc2 = (int[])SCBaseSettings.COURSE_LESSON_BLOCKS[lessCountString];
                _d1TextBox.Text = cc2[0].ToString();
                _d2TextBox.Text = cc2[1].ToString();
                _d3TextBox.Text = cc2[2].ToString();
            }

            checkValAndChanges();

        }

        private void allTextBoxs_TextChanged(object sender, EventArgs e)
        {
            checkValAndChanges();
        }

        private void checkValAndChanges()
        {
            if (isFormValuesOKAndChanged())
            {
                _okButton.Enabled = true;

            }
            else
            {

                _okButton.Enabled = false;
            }
        }

        private bool isFormValuesOKAndChanged()
        {
            try
            {
                bool xCheck = _obsCheckBox.Checked;

                int x1 = Int32.Parse(_d1TextBox.Text);
                int x2 = Int32.Parse(_d2TextBox.Text);
                int x3 = Int32.Parse(_d3TextBox.Text);

                if (x1 > 0 && x2 > 0 && x3 > 0)
                {
                    if (xCheck != xCheckStart || x1 != x1Start || x2 != x2Start || x3 != x3Start)
                    {
                        return true;
                    }
                    else return false;

                }
                else
                {
                    return false;
                }
            }
            catch
            {

                return false;
            }

            return true;

        }


        public int[] SCCourseLessonBlocksNewVal
        {
            get
            {
                if (_obsCheckBox.Checked)
                {
                    int x1 = Int32.Parse(_d1TextBox.Text);
                    int x2 = Int32.Parse(_d2TextBox.Text);
                    int x3 = Int32.Parse(_d3TextBox.Text);
                    int[] newValCLB = new int[3] {x1,x2,x3 };

                    return newValCLB;
                }
                else
                {
                    return null;
                }

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