Esempio n. 1
0
        private void PrivatePanel_Load(object sender, EventArgs e)
        {
            textBox1.Text = File.ReadAllText(AppFile.GetFile(AppFile.MARQUEE), Encoding.UTF8);
            string[] list = Directory.GetFiles(AppDirectory.GetDirectory(AppDirectory.INFO));
            FileInfo tmp;

            for (int i = 0; i < list.Length; i++)
            {
                tmp = new FileInfo(list[i]);
                listBox1.Items.Add(tmp.Name);
                files.Add(list[i]);
            }
            label13.Text = CurrentUser.ID;
            DataRow row = Classes.SQL.Select("Teachers", "tid", CurrentUser.ID).Rows[0];

            label5.Text       = row["firstname"].ToString();
            label7.Text       = row["lastname"].ToString();
            label9.Text       = Classes.App.GenderName(Convert.ToInt32(row["gender"]));
            label11.Text      = Classes.Duty.GetName(row["dutyid"].ToString());
            textBox4.Text     = row["phone"].ToString();
            textBox3.Text     = row["password"].ToString();
            pictureBox1.Image = File.Exists(pic) ? Image.FromFile(pic) : Images.NoImage;
            DataTable ts = Classes.Teacher.List();

            for (int i = 0; i < ts.Rows.Count; i++)
            {
                teachers.Add(ts.Rows[i]["tid"].ToString());
                dataGridView1.Rows.Add(new object[]
                {
                    ts.Rows[i]["firstname"].ToString() + " " + ts.Rows[i]["lastname"].ToString(),
                    Classes.Duty.GetName(ts.Rows[i]["dutyid"].ToString()),
                    ts.Rows[i]["phone"].ToString()
                });
            }
        }
Esempio n. 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         Progress_Init(AppDirectory.LIST.Length + AppFile.LIST.Length);
         for (int i = 0; i < AppDirectory.LIST.Length; i++)
         {
             textBox2.Text += "יוצר תיקיה: " + AppDirectory.GetDirectory(AppDirectory.LIST[i]);
             Directory.CreateDirectory(AppDirectory.GetDirectory(AppDirectory.LIST[i]));
             Progress_Add();
             textBox2.Text += "נוצרה בהצלחה.";
             textBox2.ScrollToCaret();
         }
         for (int i = 0; i < AppFile.LIST.Length; i++)
         {
             textBox2.Text += "יוצר קובץ: " + AppFile.GetFile(AppFile.LIST[i]);
             File.WriteAllText(AppFile.GetFile(AppFile.LIST[i]), AppFile.GetFileDefaultText(AppFile.LIST[i]));
             Progress_Add();
             textBox2.Text += "נוצר בהצלחה.";
         }
     }
     catch (Exception ex)
     {
         Classes.App.Error("בעיה בהפעלת חלק " + progressBar1.Value + " של ההתקנה:\r\n" + ex.Message, true);
     }
     finally
     {
         button1.Enabled = true;
         button2.Enabled = false;
         button3.Enabled = false;
         System.Media.SystemSounds.Exclamation.Play();
     }
 }
Esempio n. 3
0
        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 אחוזים.");
                }
            }
        }
Esempio n. 4
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);
 }
Esempio n. 5
0
        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());
            }
        }
Esempio n. 6
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 : "?");
 }
Esempio n. 7
0
 private void button8_Click(object sender, EventArgs e)
 {
     File.WriteAllText(AppFile.GetFile(AppFile.MARQUEE), textBox1.Text);
     MessageBox.Show("ההודעה עודכנה.", "הודעה מהירה", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
Esempio n. 8
0
 private void EditMOTD_Load(object sender, EventArgs e)
 {
     textBox1.Text = File.ReadAllText(AppFile.GetFile(AppFile.MARQUEE));
 }