예제 #1
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);
            }
        }
예제 #2
0
        private void PaymentBtn_Click(object sender, EventArgs e)
        {
            //open the payment form
            FormOperations.OpenPayment();

            //close the current form
            this.Close();
        }