public PatientUpdateForm(PatientsModel data)
 {
     this.InitializeComponent();
     patCtrl.patientID   = data.patientID;
     patCtrl.fname       = data.fname;
     patCtrl.lname       = data.lname;
     patCtrl.mname       = data.mname;
     patCtrl.gender      = data.gender;
     patCtrl.userAddress = data.userAddress;
     patCtrl.bday        = data.bday;
     patCtrl.contactNum  = data.contactNum;
     patCtrl.emailAdd    = data.emailAdd;
 }
 public DataTable patientSearch(PatientsModel data)
 {
     try
     {
         cmd = new SqlCommand("usp_SearchPatients");
         cmd.Parameters.AddWithValue("@keyWord", data.keyword);
         return(ExecuteReader(cmd));
     }catch (Exception err)
     {
         message(err.ToString());
         return(null);
     }
 }
 public Boolean patientUpdate(PatientsModel data)
 {
     try
     {
         cmd = new SqlCommand("usp_UpdatePatient");
         cmd.Parameters.AddWithValue("@patientID", data.patientID);
         cmd.Parameters.AddWithValue("@fname ", data.fname);
         cmd.Parameters.AddWithValue("@lname", data.lname);
         cmd.Parameters.AddWithValue("@mname", data.mname);
         cmd.Parameters.AddWithValue("@gender", data.gender);
         cmd.Parameters.AddWithValue("@userAddress ", data.userAddress);
         cmd.Parameters.AddWithValue("@bday", data.bday);
         cmd.Parameters.AddWithValue("@email", data.emailAdd);
         cmd.Parameters.AddWithValue("@contactNum", data.contactNum);
         return(ExecNonQuery(cmd));
     }catch (Exception err)
     {
         message(err.ToString());
         return(false);
     }
 }
 public int registerNewPatient(PatientsModel data)
 {
     try
     {
         cmd = new SqlCommand("usp_SaveNewPatient");
         cmd.Parameters.AddWithValue("@lname", data.lname);
         cmd.Parameters.AddWithValue("@fname", data.fname);
         cmd.Parameters.AddWithValue("@mname", data.mname);
         cmd.Parameters.AddWithValue("@gender", data.gender);
         cmd.Parameters.AddWithValue("@userAddress", data.userAddress);
         cmd.Parameters.AddWithValue("@bday", data.bday);
         cmd.Parameters.AddWithValue("@contactNum", data.contactNum);
         cmd.Parameters.AddWithValue("@email", data.emailAdd);
         return(ExecuteScalar(cmd));
     }
     catch (Exception err)
     {
         message(err.ToString());
         return(0);
     }
 }