Exemplo n.º 1
0
        public void SetFilling(int n, byte course)
        {
            switch (course)
            {
            case 1:
                if (n == 0 || n == 1)
                {
                    Condition = EConditions.CanBeFilled;
                }
                else
                {
                    Condition = EConditions.CanTBeFilled;
                }
                break;

            case 2:
                if (n == 0 || n == 1)
                {
                    Condition = EConditions.MustBeFilled;
                }
                else
                if (n == 2 || n == 3)
                {
                    Condition = EConditions.CanBeFilled;
                }
                else
                {
                    Condition = EConditions.CanTBeFilled;
                }
                break;

            case 3:
                if (n >= 0 && n <= 3)
                {
                    Condition = EConditions.MustBeFilled;
                }
                else
                if (n == 4 || n == 5)
                {
                    Condition = EConditions.CanBeFilled;
                }
                else
                {
                    Condition = EConditions.CanTBeFilled;
                }
                break;

            case 4:
                if (n >= 0 && n <= 5)
                {
                    Condition = EConditions.MustBeFilled;
                }
                else
                {
                    Condition = EConditions.CanBeFilled;
                }
                break;
            }
        }
Exemplo n.º 2
0
            public MyGroupBox(COneRecord record, int index)
            {
                Main      = new GroupBox();
                Main.Text = "Semestr " + (index + 1).ToString();

                condition = record.GetExams().Semesters[index].Condition;
                //MessageBox.Show("Comd" + (int)condition);
                System.Drawing.Point location;
                if (index < 4)
                {
                    location = new System.Drawing.Point(5, 90 * (index + 1));
                }
                else
                {
                    location = new System.Drawing.Point(5 + 280, 90 * (index - 4 + 1));
                }
                Main.Width    = 270;
                Main.Height   = 90;
                Main.Location = location;
                switch (condition)
                {
                case EConditions.MustBeFilled:
                    Main.BackColor = System.Drawing.Color.FromArgb(127, 255, 255, 0);
                    break;

                case EConditions.CanBeFilled:
                    Main.BackColor = System.Drawing.Color.FromArgb(127, 0, 0, 255);
                    break;

                case EConditions.CanTBeFilled:
                    Main.BackColor = System.Drawing.Color.FromArgb(127, 128, 128, 128);
                    break;
                }
                System.Drawing.Point loc  = new System.Drawing.Point(5, 25);
                System.Drawing.Point locm = new System.Drawing.Point(5, 50);
                Sub     = new Label[StringEquivalents.NExams];
                Results = new ComboBox[StringEquivalents.NExams];
                for (int i = 0; i < StringEquivalents.NExams; i++)
                {
                    Sub[i]     = new Label();
                    Results[i] = new ComboBox();
                    switch (condition)
                    {
                    case EConditions.MustBeFilled:
                    case EConditions.CanBeFilled:
                        Results[i].Enabled = true;
                        break;

                    case EConditions.CanTBeFilled:
                        Results[i].Enabled = false;
                        break;
                    }
                    Sub[i].Width    = Results[i].Width = 40;
                    Sub[i].Text     = StringEquivalents.SubjectNames[(int)(record.GetExams()[index, i].Subject)];
                    Results[i].Text = StringEquivalents.Marks[(int)record.GetExams()[index, i].Mark];
                    Sub[i].Font     = Results[i].Font = new System.Drawing.Font("Times New Roman", 10);
                    Results[i].Items.AddRange(StringEquivalents.Marks);
                    Sub[i].Location         = loc;
                    Results[i].Location     = locm;
                    Results[i].TextChanged += ShowEditMarks_TextChanged;
                    Main.Controls.Add(Sub[i]);
                    Main.Controls.Add(Results[i]);
                    loc.X  += 40;
                    locm.X += 40;
                }
            }