Ejemplo n.º 1
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            if (Emailtxt.Text != "")
            {
                try
                {
                    var eMailValidator = new System.Net.Mail.MailAddress(Emailtxt.Text);
                    var result         = FormOperations.ValidateFields(Nametxt.Text, Surnametext.Text, GenderCmb.SelectedItem.ToString(), Celltxt.Text);

                    if (result)
                    {
                        DTO.Teacher teacher = new DTO.Teacher();

                        teacher.Name    = Nametxt.Text;
                        teacher.Surname = Surnametext.Text;
                        teacher.Gender  = GenderCmb.SelectedItem.ToString();
                        teacher.Cell    = Celltxt.Text;
                        teacher.Email   = Emailtxt.Text;
                        teacher.PIN     = PINTxt.Text;


                        DataAccess.InsertTeacher(teacher);

                        DialogResult dl = MessageBox.Show("Teacer Saved Successfully. Do You want to Proceesd with another Registration?", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (dl == DialogResult.Yes)
                        {
                            TeacherRegtxt.Clear();
                            Nametxt.Clear();
                            Surnametext.Clear();
                            GenderCmb.ResetText();
                            Celltxt.Clear();
                            PINTxt.Clear();
                            Emailtxt.Clear();
                        }
                        else
                        {
                            FormOperations.OpenMenu();
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (FormatException ex)
                {
                    MessageBox.Show("The Email entered is not a valid email address", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message);
                }
            }
            else
            {
                MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
 private void CloseBtn_Click(object sender, EventArgs e)
 {
     //FormOperations.student = null;
     FormOperations._ID = 0;
     FormOperations.OpenMenu();
     this.Close();
 }
Ejemplo n.º 3
0
        private void Savebtn_Click(object sender, EventArgs e)
        {
            if (CourseCtxt.Text != "" | CourseNtxt.Text != "" | CourseDtxt.Text != "")
            {
                Course c = new Course {
                    CourseCode = CourseCtxt.Text,
                    CourseName = CourseNtxt.Text,
                    Duration   = int.Parse(CourseDtxt.Text)
                };
                DataAccess.InsertCourse(c);


                DialogResult dl = MessageBox.Show("Course Saved Successfully. Do You want to Proceesd with another Registration?", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                if (dl == DialogResult.Yes)
                {
                    Refresh();
                }
                else
                {
                    FormOperations.OpenMenu();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Please fill in all fields.", "Empty Field Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 4
0
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            int studentid = int.Parse(Studenttxt.Text);

            if (Emailtxt.Text != "")
            {
                try
                {
                    var eMailValidator = new System.Net.Mail.MailAddress(Emailtxt.Text);
                    var result         = FormOperations.ValidateFields(Nametxt.Text, Surnametxt.Text, GenderCmb.SelectedItem.ToString(), CellTxt.Text, studentid);

                    if (result)
                    {
                        Gaurdian gaurdian = new Gaurdian();

                        gaurdian.Name      = Nametxt.Text;
                        gaurdian.Surname   = Surnametxt.Text;
                        gaurdian.Gender    = GenderCmb.SelectedItem.ToString();
                        gaurdian.Cell      = CellTxt.Text;
                        gaurdian.Email     = Emailtxt.Text;
                        gaurdian.StudentId = studentid;

                        DataAccess.InsertGaurdian(gaurdian);

                        DialogResult dl = MessageBox.Show("Gaudian Saved Successfully. Do You want to Proceesd to Payment Information?", "Success", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                        if (dl == DialogResult.Yes)
                        {
                            FormOperations._ID = FormOperations.student.ID;
                            FormOperations.OpenPayment();
                            this.Close();
                        }
                        else
                        {
                            //FormOperations.student = null;
                            FormOperations._ID = 0;
                            FormOperations.OpenMenu();
                            this.Close();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (FormatException ex)
                {
                    MessageBox.Show("The Email entered is not a valid email address", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message);
                }
            }
            else
            {
                MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Ejemplo n.º 5
0
        private void PaymentBtn_Click(object sender, EventArgs e)
        {
            //open the payment form
            FormOperations.OpenPayment();

            //close the current form
            this.Close();
        }
Ejemplo n.º 6
0
        private void StudentBtn_Click(object sender, EventArgs e)
        {
            //open the the student regstration
            FormOperations.OpenStudReg();

            //close the current form
            this.Close();
        }
        private void UpdateBtn_Click(object sender, EventArgs e)
        {
            int value    = 0;
            int semester = 0;

            if (CourseCmb.Text.ToString() != null & SemesterCmb.SelectedItem != null)
            {
                value    = DataAccess.GetCourseID(CourseCmb.Text.ToString());
                semester = int.Parse(SemesterCmb.SelectedItem.ToString());
            }
            if (EmailTxt.Text != "")
            {
                try
                {
                    var eMailValidator = new System.Net.Mail.MailAddress(EmailTxt.Text);
                    var result         = FormOperations.ValidateFields(NameTxt.Text, SurnameTxt.Text, GenderCmb.SelectedItem, CellNTxt.Text, value, semester);
                    if (result)
                    {
                        Student stud = new Student
                        {
                            ID            = int.Parse(StudentRegTxt.Text),
                            Name          = NameTxt.Text,
                            Surname       = SurnameTxt.Text,
                            Gender        = GenderCmb.SelectedItem.ToString(),
                            Cell          = CellNTxt.Text,
                            Email         = EmailTxt.Text,
                            PostalAddress = Postaltxt.Text,
                            Semester      = semester,
                            CourseId      = value,
                            StatusId      = DataAccess.GetSatusID(Statuscmb.Text.ToString())
                        };

                        //FormOperations.student.StatusId = int.Parse(StatusCmb.SelectedValue.ToString());

                        DataAccess.EditStudent(stud);

                        MessageBox.Show("Student Update Successfully.", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        //FormOperations.OpenGaurdian();
                        //this.Close();
                        Refresh();
                    }
                    else
                    {
                        MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (FormatException ex)
                {
                    MessageBox.Show("The Email entered is not a valid email address", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        private void SaveBtn_Click(object sender, EventArgs e)
        {
            int value    = 0;
            int semester = 0;

            if (CourseCmb.SelectedValue.ToString() != null & SemesterCmb.SelectedItem != null)
            {
                value    = int.Parse(CourseCmb.SelectedValue.ToString());
                semester = int.Parse(SemesterCmb.SelectedItem.ToString());
            }
            if (EmailTxt.Text != "")
            {
                try
                {
                    var eMailValidator = new System.Net.Mail.MailAddress(EmailTxt.Text);
                    var result         = FormOperations.ValidateFields(NameTxt.Text, SurnameTxt.Text, GenderCmb.SelectedItem, CellNTxt.Text, value, semester);
                    if (result)
                    {
                        FormOperations.student.Name          = NameTxt.Text;
                        FormOperations.student.Surname       = SurnameTxt.Text;
                        FormOperations.student.Gender        = GenderCmb.SelectedItem.ToString();
                        FormOperations.student.Cell          = CellNTxt.Text;
                        FormOperations.student.Email         = EmailTxt.Text;
                        FormOperations.student.PostalAddress = Postaltxt.Text;
                        FormOperations.student.Semester      = semester;
                        FormOperations.student.CourseId      = value;
                        //FormOperations.student.StatusId = int.Parse(StatusCmb.SelectedValue.ToString());

                        FormOperations.student.ID = DataAccess.InsertStudent(FormOperations.student);

                        MessageBox.Show("Student Saved Successfully. Please Proceesd to Gaurdian Information", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        FormOperations.OpenGaurdian();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Please Fill In All Fields", "Empty field Found", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (FormatException ex)
                {
                    MessageBox.Show("The Email entered is not a valid email address", "Invalid Email", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            else
            {
                MessageBox.Show("Please fill in all fields", "Empty Fields Detected", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void SaveBtn_Click(object sender, EventArgs e)
 {
     if (Amounttxt.Text == "")
     {
         MessageBox.Show("Please insert payment amount");
     }
     else
     {
         if (Studenttxt.Text != "")
         {
             Payments p = new Payments
             {
                 StudentId   = int.Parse(Studenttxt.Text),
                 Amount      = double.Parse(Amounttxt.Text),
                 PaymentDate = DateTime.Now,
                 UserId      = FormOperations.user.UserId
             };
             DataAccess.InsertPayments(p);
             DialogResult msg = MessageBox.Show("Payment Saved Successfully. Do you want to make other payments?", "Payment Notifcation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (DialogResult.No == msg)
             {
                 //FormOperations.student = null;
                 FormOperations._ID = 0;
                 FormOperations.OpenMenu();
                 this.Close();
             }
             else
             {
                 Searchtxt.Clear();
                 Paytxt.Clear();
                 Studenttxt.Clear();
                 Amounttxt.Clear();
                 dataGridView1.DataSource = null;
                 Amounttxtx.Text          = 0.ToString();
                 //FormOperations.student = null;
                 FormOperations._ID = 0;
             }
         }
         else
         {
             MessageBox.Show("Please search for student first then enter payment and save");
         }
     }
 }
Ejemplo n.º 10
0
 private void Loginbtn_Click(object sender, EventArgs e)
 {
     if (UsernameTxt.Text == "" || PasswordTxt.Text == "")
     {
         MessageBox.Show("Please Fill in All Fields", "Empty Fields Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         FormOperations.user = DataAccess.GetUsers(UsernameTxt.Text, PasswordTxt.Text);
         if (FormOperations.user != null)
         {
             FormOperations.OpenMenu();
             this.Close();
         }
         else
         {
             MessageBox.Show("Incorrect Username or Password. Please Try Again");
             UsernameTxt.Clear();
             PasswordTxt.Clear();
         }
     }
 }
Ejemplo n.º 11
0
 private void Closebtn_Click(object sender, EventArgs e)
 {
     FormOperations.OpenMenu();
     this.Close();
 }
Ejemplo n.º 12
0
 private void CourseBtn_Click(object sender, EventArgs e)
 {
     FormOperations.OpenCourseReg();
     this.Close();
 }
Ejemplo n.º 13
0
 private void ViewteacherBtn_Click(object sender, EventArgs e)
 {
     FormOperations.OpenTeacherEdit();
     this.Close();
 }
Ejemplo n.º 14
0
 private void ViewStudentBtn_Click(object sender, EventArgs e)
 {
     FormOperations.OpenStudentEdit();
     this.Close();
 }