private void btnAppUpdate_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No)
     {
         return;
     }
     else
     {
         var re = new ManageAppointmentRepo();
         var en = new ManageAppointmentEntity();
         if (ValidateToSave() == true)
         {
             en.Id        = txtAppId.Text;
             en.Name      = txtAppName.Text;
             en.Age       = int.Parse(txtAppAge.Text);
             en.Sex       = txtAppSex.Text;
             en.Reference = txtAppReference.Text;
             en.Doctor    = txtAppDoctor.Text;
             en.Date      = dtpAppDate.Value.Date.ToString("yyyy-MM-dd");
             en.Time      = dtpAppTime.Value.ToString("hh:mm tt");
             re.Update(en);
         }
         else
         {
             MessageBox.Show("Invalid Input");
         }
     }
 }
Exemple #2
0
        public void Update(ManageAppointmentEntity en)
        {
            var sql = "update appointment set name = '" + en.Name + "',age= '" + en.Age + "',sex = '" + en.Sex + "',reference = '" + en.Reference + "',date = '" + en.Date + "',doctor ='" + en.Doctor + "',time = '" + en.Time + "' where id = '" + en.Id + "'; ";
            var ex  = DataAccess.ExecuteQuery(sql);

            if (ex == 1)
            {
                MessageBox.Show("Updated");
            }
        }
        private void btnSearch_Click(object sender, EventArgs e)
        {
            var en = new ManageAppointmentEntity();
            var re = new ManageAppointmentRepo();

            en.Id     = txtId.Text;
            en.Name   = txtName.Text;
            en.Doctor = txtDoctorName.Text;
            en.Date   = dtpDate.Value.Date.ToString("yyyy-MM-dd");

            re.Search(mgvAppointment, en);
        }
Exemple #4
0
        public void Search(MetroGrid mgv, ManageAppointmentEntity en)
        {
            var sql = "select * from appointment where id = '" + en.Id + "' or name = '" + en.Name + "' or date = '" + en.Date + "' or doctor = '" + en.Doctor + "'; ";

            DataAccess.PopulateGridView(mgv, sql);
        }