예제 #1
0
파일: Printer.cs 프로젝트: Amit-B/elearning
        private void button15_Click(object sender, EventArgs e)
        {
            MaskedTextBox[] texts  = { maskedTextBox1, maskedTextBox2, maskedTextBox3, maskedTextBox4, maskedTextBox5 };
            CheckBox[]      checks = { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5 };
            ComboBox[]      cb     = { comboBox4, comboBox5, comboBox6, comboBox7, comboBox8 };
            int             total  = 0;

            for (int i = 0; i < texts.Length; i++)
            {
                texts[i].Text = Classes.App.IntBase(Convert.ToInt32(texts[i].Text), 3);
                total        += Convert.ToInt32(texts[i].Text);
            }
            bool flag = false;

            for (int i = 0; i < 5 && !flag; i++)
            {
                if (cb[i].SelectedIndex == -1 && checks[i].Checked)
                {
                    flag = true;
                }
            }
            if (flag)
            {
                Classes.App.Error("לא בחרת אפשרות לכל שורות האחוזים המאופשרות.");
            }
            else
            {
                if (total == 100)
                {
                    Classes.INI cal = new Classes.INI(AppFile.GetFile(AppFile.CALCULATION));
                    for (int i = 0; i < 5; i++)
                    {
                        cal.SetKey("Slot" + (i + 1), checks[i].Checked ? (texts[i].Text + ";" + calcode[cb[i].SelectedIndex]) : "None");
                    }
                    MessageBox.Show("החישוב לציונים יורכב מהאחוזים שציינת.\r\nבנוסף החישוב נשמר בהצלחה.", "הנפקת תעודות", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    Classes.App.Error("עליך להרכיב 100 אחוזים.");
                }
            }
        }
예제 #2
0
 private void TeacherPanel_Load(object sender, EventArgs e)
 {
     timer1.Start();
     Classes.INI cfg = new Classes.INI(AppFile.GetFile(AppFile.CONFIG));
     Button[]    bs  = { button1, button2, button3, button4, button5, button6, button7, button9 };
     if (!CurrentUser.Administrator)
     {
         for (int i = 0; i < bs.Length; i++)
         {
             bs[i].Enabled = cfg.GetKey("Permission" + (i + 1)) == "0";
         }
         if (!button9.Enabled)
         {
             button9.Visible = false;
         }
     }
     else
     {
         button9.Visible = true;
     }
     label1.Text   = Classes.Teacher.GetName(CurrentUser.ID) + " (ת.ז: " + CurrentUser.ID + ")" + (CurrentUser.Administrator ? " + כולל הרשאת ניהול" : "");
     textBox1.Text = File.ReadAllText(AppFile.GetFile(AppFile.MARQUEE), Encoding.UTF8);
 }
예제 #3
0
파일: Printer.cs 프로젝트: Amit-B/elearning
        private void Printer_Load(object sender, EventArgs e)
        {
            LoadReports();
            UpdateTemplates();
            DataTable gradetypes = Classes.Grades.ListGradeTypes();

            for (int i = 0; i < gradetypes.Rows.Count; i++)
            {
                gradeTypes.Add(gradetypes.Rows[i]["gtid"].ToString());
            }
            DataTable notetypes = Classes.Note.ListNoteTypes();

            for (int i = 0; i < notetypes.Rows.Count; i++)
            {
                noteTypes.Add(notetypes.Rows[i]["ntid"].ToString());
            }
            MaskedTextBox[] texts  = { maskedTextBox1, maskedTextBox2, maskedTextBox3, maskedTextBox4, maskedTextBox5 };
            CheckBox[]      checks = { checkBox1, checkBox2, checkBox3, checkBox4, checkBox5 };
            ComboBox[]      cb     = { comboBox4, comboBox5, comboBox6, comboBox7, comboBox8 };
            for (int i = 0; i < cb.Length; i++)
            {
                for (int j = 0; j < notetypes.Rows.Count; j++)
                {
                    cb[i].Items.Add("אחוז " + (Convert.ToBoolean(notetypes.Rows[j]["absence"]) ? "העדרויות" : "הערות") + " מסוג " + notetypes.Rows[j]["ntitle"]);
                    if (i == 0)
                    {
                        calcode.Add((Convert.ToBoolean(notetypes.Rows[j]["absence"]) ? "absence" : "note") + ";" + notetypes.Rows[j]["ntid"]);
                    }
                }
                for (int j = 0; j < gradetypes.Rows.Count; j++)
                {
                    cb[i].Items.Add("ממוצע ציונים מסוג " + gradetypes.Rows[j]["gtname"]);
                    if (i == 0)
                    {
                        calcode.Add("grade;" + gradetypes.Rows[j]["gtid"]);
                    }
                }
            }
            try
            {
                Classes.INI cal = new Classes.INI(AppFile.GetFile(AppFile.CALCULATION));
                string      key = string.Empty;
                for (int i = 0; i < 5; i++)
                {
                    key = cal.GetKey("Slot" + (i + 1));
                    if (key == "None")
                    {
                        checks[i].Checked = false;
                    }
                    else
                    {
                        checks[i].Checked = true;
                        texts[i].Text     = key.Split(';')[0];
                        string lookFor = string.Empty;
                        switch (key.Split(';')[1])
                        {
                        case "grade":
                        {
                            int row = -1;
                            for (int j = 0; j < gradetypes.Rows.Count && row == -1; j++)
                            {
                                if (gradetypes.Rows[j]["gtid"].ToString() == key.Split(';')[2])
                                {
                                    row = j;
                                }
                            }
                            lookFor = "ממוצע ציונים מסוג " + gradetypes.Rows[row]["gtname"];
                            break;
                        }

                        case "note":
                        {
                            int row = -1;
                            for (int j = 0; j < notetypes.Rows.Count && row == -1; j++)
                            {
                                if (notetypes.Rows[j]["ntid"].ToString() == key.Split(';')[2])
                                {
                                    row = j;
                                }
                            }
                            lookFor = "אחוז הערות מסוג " + notetypes.Rows[row]["ntitle"];
                            break;
                        }

                        case "absence":
                        {
                            int row = -1;
                            for (int j = 0; j < notetypes.Rows.Count && row == -1; j++)
                            {
                                if (notetypes.Rows[j]["ntid"].ToString() == key.Split(';')[2])
                                {
                                    row = j;
                                }
                            }
                            lookFor = "אחוז העדרויות מסוג " + notetypes.Rows[row]["ntitle"];
                            break;
                        }
                        }
                        cb[i].SelectedIndex = -1;
                        for (int j = 0; j < cb[i].Items.Count && cb[i].SelectedIndex == -1; j++)
                        {
                            if (cb[i].Items[j].ToString() == lookFor)
                            {
                                cb[i].SelectedIndex = j;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Classes.App.Error("לא היה ניתן לטעון את הגדרות התעודה (" + ex.Message + ").");
            }
            DataTable st = Classes.Student.List();

            for (int i = 0; i < st.Rows.Count; i++)
            {
                comboBox3.Items.Add(st.Rows[i]["id"] + " - " + st.Rows[i]["firstname"] + " " + st.Rows[i]["lastname"]);
                students.Add(st.Rows[i]["id"].ToString());
            }
        }
예제 #4
0
 private void button1_Click(object sender, EventArgs e)
 {
     Classes.INI cfg = new Classes.INI(AppFile.GetFile(AppFile.CONFIG));
     cfg.SetKey("Off", checkBox1.Checked ? textBox1.Text : "?");
 }