private void submitadmisionBtn_Click(object sender, RoutedEventArgs e)
        {
            SmsData.AdmissionInfo newAdmission = new SmsData.AdmissionInfo();

            newAdmission.id = GenerateId();
            newAdmission.name = nameTxtbox.Text;
            newAdmission.grdain = GuardianNameTxtbox.Text;
            newAdmission.address = studentAddressTxtbox.Text;
            newAdmission.phone = PhoneNumberTxtbox.Text;
            newAdmission.applyfor = applyForTxtbox.Text;
            newAdmission.qualification = QualificationTxtbox.Text;
            newAdmission.marksprcntg = prcntMarksTxtbox.Text;
            newAdmission.formNo = formNoTxtbox.Text;

            SmsDb.DbInteraction.RegisterNewAdmission(newAdmission);
        }
        private void submitadmisionBtn_Click(object sender, RoutedEventArgs e)
        {
            SmsData.AdmissionInfo newAdmission = new SmsData.AdmissionInfo();

            newAdmission.id            = GenerateId();
            newAdmission.name          = nameTxtbox.Text;
            newAdmission.grdain        = GuardianNameTxtbox.Text;
            newAdmission.address       = studentAddressTxtbox.Text;
            newAdmission.phone         = PhoneNumberTxtbox.Text;
            newAdmission.applyfor      = applyForTxtbox.Text;
            newAdmission.qualification = QualificationTxtbox.Text;
            newAdmission.marksprcntg   = prcntMarksTxtbox.Text;
            newAdmission.formNo        = formNoTxtbox.Text;



            SmsDb.DbInteraction.RegisterNewAdmission(newAdmission);
        }
        private static List<AdmissionInfo> QueryAllAdmissionListinDb()
        {
            List<AdmissionInfo> AdmissionList = new List<AdmissionInfo>();

            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {   //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "Select * From admission ;";
                MySql.Data.MySqlClient.MySqlDataReader msqlReader = msqlCommand.ExecuteReader();

                while (msqlReader.Read())
                {
                    AdmissionInfo Admission = new AdmissionInfo();

                    Admission.id = msqlReader.GetString("id");
                    Admission.name = msqlReader.GetString("name");
                    Admission.grdain = msqlReader.GetString("gurdian");
                    Admission.address = msqlReader.GetString("address");
                    Admission.phone = msqlReader.GetString("phone");
                    Admission.applyfor = msqlReader.GetString("applyfor");
                    Admission.qualification = msqlReader.GetString("qualification");
                    Admission.marksprcntg = msqlReader.GetString("marksprcntg");
                    Admission.formNo = msqlReader.GetString("formNo");

                    AdmissionList.Add(Admission);
                }

            }
            catch (Exception er)
            {
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }

            return AdmissionList;
        }
        public static int RegisterNewAdmissionForm(AdmissionInfo NewAdmissionForm)
        {
            int returnVal = 0;
            MySql.Data.MySqlClient.MySqlConnection msqlConnection = OpenDbConnection();

            try
            {
                //define the command reference
                MySql.Data.MySqlClient.MySqlCommand msqlCommand = new MySql.Data.MySqlClient.MySqlCommand();

                //define the connection used by the command object
                msqlCommand.Connection = msqlConnection;

                msqlCommand.CommandText = "INSERT INTO admission(id,name,gurdian,address,phone,applyfor,qualification,marksprcntg,formNo) " +
                                                         "VALUES(@id,@name,@gurdian,@address,@phone,@applyfor,@qualification,@marksprcntg,@formNo)";

                msqlCommand.Parameters.AddWithValue("@id", NewAdmissionForm.id);
                msqlCommand.Parameters.AddWithValue("@name", NewAdmissionForm.name);
                msqlCommand.Parameters.AddWithValue("@gurdian", NewAdmissionForm.grdain);
                msqlCommand.Parameters.AddWithValue("@address", NewAdmissionForm.address);
                msqlCommand.Parameters.AddWithValue("@phone", NewAdmissionForm.phone);
                msqlCommand.Parameters.AddWithValue("@applyfor", NewAdmissionForm.applyfor);
                msqlCommand.Parameters.AddWithValue("@qualification", NewAdmissionForm.qualification);
                msqlCommand.Parameters.AddWithValue("@marksprcntg", NewAdmissionForm.marksprcntg);
                msqlCommand.Parameters.AddWithValue("@formNo", NewAdmissionForm.formNo);

                msqlCommand.ExecuteNonQuery();

                returnVal = 1;
            }
            catch (Exception er)
            {
                returnVal = 0;
            }
            finally
            {
                //always close the connection
                msqlConnection.Close();
            }
            return returnVal;
        }
 public static int RegisterNewAdmission(AdmissionInfo NewAdmissionForm)
 {
     return RegisterNewAdmissionForm(NewAdmissionForm);
 }