private void CloseBtn_Click(object sender, EventArgs e) { //FormOperations.student = null; FormOperations._ID = 0; FormOperations.OpenMenu(); this.Close(); }
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); } }
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 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); } }
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"); } } }
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(); } } }
private void Closebtn_Click(object sender, EventArgs e) { FormOperations.OpenMenu(); this.Close(); }