Esempio n. 1
0
        private void Send_Click(object sender, EventArgs e)
        {
            if (txt.Text == "")
            {
                MessageBox.Show("Enter Your Problem !"); return;
            }

            officer_obj.Add_Complaints(current_officer_mail, txt.Text.ToString());
            officer_obj.Save();
            MessageBox.Show("Done");
        }
        private void Replay_doc_btn_Click(object sender, EventArgs e)
        {
            if (!replay_validation())
            {
                return;
            }

            if (officer_obj.Set_Replay(officer_mail, Complaints_txt.Text, textBox1.Text))
            {
                MessageBox.Show("Done Replay ");
                officer_obj.Save();
                Clear_components();
                set_Table();
            }
            else
            {
                MessageBox.Show("Replay Not sent ");
            }
        }
        private void simpleButton8_Click(object sender, EventArgs e)
        {
            if (mail_txt.Text == "" || password_txt.Text == "")
            {
                MessageBox.Show("Enter Your name and Password ");
                return;
            }
            string mail_tmp = mail_txt.Text.ToString();
            string pass_tmp = password_txt.Text.ToString();

            // four cases . each case represent one type of user ..
            // in each case .. have tow cases (Login or Register ) ..
            if (dean)
            {
                if (login)
                {
                    if (mail_txt.Text == "Wael" && password_txt.Text == "2514")
                    {
                        Dean_form dean_form_obj = new Dean_form();
                        dean_form_obj.Show();
                    }
                    else
                    {
                        MessageBox.Show("Invalid Dean Account ");
                    }
                }
            }
            else if (Student_Affairs_Officer)
            {
                if (mail_tmp == "Wael" && pass_tmp == "2514")
                {
                    Student_Affairs_Officer_formcs SAO_form_obj = new Student_Affairs_Officer_formcs();
                    SAO_form_obj.Show();
                }
                else
                {
                    MessageBox.Show("Invalid Student Affairs Officer Account ");
                }
            }
            else if (doctor)
            {
                if (login)
                {
                    if (doctor_obj.Check_Login(mail_tmp, pass_tmp))
                    {
                        Doctor_form doc_form = new Doctor_form(mail_tmp);
                        doc_form.Show();
                    }
                    else
                    {
                        MessageBox.Show("Wrong Mail Or Password ");
                    }
                }

                else if (register)
                {
                    if (!(doctor_obj.Exist(mail_tmp)))
                    {
                        doctor_obj.set_values(mail_tmp, pass_tmp);

                        doctor_obj.Doctors.Add(doctor_obj);
                        doctor_obj.Save();
                        MessageBox.Show("Done Register Successfuly ");
                    }
                    else
                    {
                        MessageBox.Show("Mail Already Exist");
                    }
                    mail_txt.Text     = "";
                    password_txt.Text = "";
                }
            }

            else if (officer)
            {
                if (login)
                {
                    if (Officer_obj.Check_Login(mail_tmp, pass_tmp))
                    {
                        Officer_form obj_form = new Officer_form(mail_tmp);
                        obj_form.Show();
                    }
                    else
                    {
                        MessageBox.Show("Wrong Mail Or Password ");
                    }
                }
                else if (register)
                {
                    if (!(Officer_obj.Exist(mail_tmp)))
                    {
                        Officer_obj.set_values(mail_tmp, pass_tmp);
                        Officer_obj.Officers.Add(Officer_obj);
                        Officer_obj.Save();
                        MessageBox.Show("Done Register Successfuly ");
                    }
                    else
                    {
                        MessageBox.Show("Mail Already Exist");
                    }
                    mail_txt.Text     = "";
                    password_txt.Text = "";
                }
            }

            else if (student)
            {
                if (login)
                {
                    if (student_obj.Check_Login(mail_tmp, pass_tmp))
                    {
                        Student_form st_form = new Student_form(mail_tmp);
                        st_form.Show();
                    }

                    else
                    {
                        MessageBox.Show("Wrong Mail Or Password ");
                    }
                }
                else if (register)
                {
                    if (!(student_obj.Exist(mail_tmp)))
                    {
                        student_obj.set_values(mail_tmp, pass_tmp);

                        student_obj.students.Add(student_obj);
                        student_obj.Save();
                        MessageBox.Show("Done Register Successfuly ");
                    }
                    else
                    {
                        MessageBox.Show("Mail Already Exist");
                    }
                    mail_txt.Text     = "";
                    password_txt.Text = "";
                }
            }
        }