private void btnSave_Click(object sender, EventArgs e)
 {
     try {
         int rowsaffected = MitchellDAL.EditTutor(Convert.ToInt32(tb_ID.Text), tb_Name.Text, tb_Surname.Text, tb_Address1.Text, tb_Address2.Text, tb_Postcode.Text, tb_Tel.Text, tb_Instrument.Text);
         if (rowsaffected == 1)
         {
             add.showBalloonTip("Success", "Successfully Updated Tutor Details");
         }
         else
         {
             add.showBalloonTip("UnSuccessful", "Could not update Tutor Details");
         }
         // this.Dispose();
         this.Hide();
         Tutor_Details mynextscreen = new Tutor_Details();
         mynextscreen.ShowDialog();
         Close();
     }
     catch (Exception ex)
     {
         if (count1 < 1)
         {
             add.showBalloonTip("Error", "Something Went Wrong");
         }
         System.IO.StreamWriter writer = new System.IO.StreamWriter("../../ErrorLog.txt", true);
         writer.WriteLine("- " + DateTime.Now + " " + ex.Message, true);
         writer.Flush();
         writer.Close();
         count1++;
     }
 }
        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Hide();
            Tutor_Details mynextscreen = new Tutor_Details();

            mynextscreen.ShowDialog();
            this.Dispose();
        }
Example #3
0
 private void tb_Tutor_Delete_TextChanged(object sender, EventArgs e)
 {
     if (tb_Tutor_Delete.Text == "x")
     {
         //this.Dispose();
         this.Hide();
         Tutor_Details nextForm = new Tutor_Details();
         nextForm.ShowDialog();
         Close();
     }
     else
     {
     }
 }
 private void btnSave_Click(object sender, EventArgs e)
 {
     try {
         if (Controls.OfType <TextBox>().Any(t => t.Text == ""))
         {
             student.showBalloonTip("Field entries", "All Fields must be used");
         }
         else if (Controls.OfType <ComboBox>().Any(t => t.Text == ""))
         {
             student.showBalloonTip("Field entries", "All Fields must be used");
         }
         else
         {
             int rowsAffected = MitchellDAL.AddNewTutor(Convert.ToInt32(tb_ID.Text), tb_Name.Text, tb_Surname.Text, tb_Address1.Text, tb_Address2.Text, tb_Postcode.Text, tb_Tel.Text, tb_Instrument.Text, tb_DOB.Text);
             if (rowsAffected == 1)
             {
                 student.showBalloonTip("Success", "Successfully Added Tutor");
             }
             else
             {
                 student.showBalloonTip("Unsuccessful", "Could not add Tutor");
             }
             //this.Dispose();
             this.Hide();
             Tutor_Details mynextscreen = new Tutor_Details();
             mynextscreen.ShowDialog();
             Dispose();
         }
     }
     catch (Exception ex)
     {
         if (count < 1)
         {
             add.showBalloonTip("Error", "Something Went Wrong");
         }
         System.IO.StreamWriter writer = new System.IO.StreamWriter("../../ErrorLog.txt", true);
         writer.WriteLine("- " + DateTime.Now + " " + ex.Message, true);
         writer.Flush();
         writer.Close();
         count++;
     }
 }
Example #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try {
                frmAddStudent student = new frmAddStudent();

                int rowsAffected = MitchellDAL.DeleteTutor(Convert.ToInt32(tb_Tutor_Delete.Text));
                if (rowsAffected == 0)
                {
                    student.showBalloonTip("Delete Successful", "Successfully deleted Tutor");
                }
                else
                {
                    student.showBalloonTip("Delete UnSuccessful", "Could Not Delete Tutor");
                }
                // this.Dispose();
                this.Hide();
                Tutor_Details mynextscreen = new Tutor_Details();
                mynextscreen.ShowDialog();
                Close();
            }
            catch (Exception ex) {
                this.Hide();
                Tutor_Details nextScreen = new Tutor_Details();
                nextScreen.ShowDialog();
                //this.Dispose();
                Close();
                if (count < 1)
                {
                    add.showBalloonTip("Error", "Something Went Wrong");
                }
                System.IO.StreamWriter writer = new System.IO.StreamWriter("../../ErrorLog.txt", true);
                writer.WriteLine("- " + DateTime.Now + " " + ex.Message, true);
                writer.Flush();
                writer.Close();
                count++;
            }
        }