//method for deleting data from the database private void BirthdayDeletetoolstrip_Click(object sender, EventArgs e) { if (babybirthidtxt.Text == "") { MessageBox.Show("Please Insert Birth ID"); } else { int delteid = Convert.ToInt32(babybirthidtxt.Text); var birthbiz = new BirthDayregistrationBiz(); if (MessageBox.Show("Are you Sure you want to delete", "Confirm Deltion", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { var result = birthbiz.Delete(delteid); if (result.Status) { XtraMessageBox.Show("Successfuly Deleted"); Clear(); } else { XtraMessageBox.Show("Not Deleted Successfuly." + result.Message); } } } }
//method for saving the data to the database private void toolStripButton109_Click(object sender, EventArgs e) { var birthDal = new BirthRegestration() { BabyName = babynametxt.Text, BabyFatherName = babyfathertext.Text, MotherName = babymotehrtext.Text, Date = dateEdit1.Text, Time = timeEdit1.Text, StaffName = doctornametext.Text, BabyWeight = babyweighttext.Text, BabyHeight = babyheighttxt.Text, Remarks = remarkstext.Text }; var birthbiz = new BirthDayregistrationBiz(); var result = birthbiz.Add(birthDal); if (result.Status) { MessageBox.Show("Saved Successfully"); Clear(); } else { MessageBox.Show("Not Saved Successfully." + result.Message); } }
// method for editing dtata from the database private void BirthDayEdittoolstrip_Click(object sender, EventArgs e) { if (babybirthidtxt.Text == "") { MessageBox.Show("Please Insert Birth ID"); } else { var birthdata = new BirthRegestration() { ID = Convert.ToInt32(babybirthidtxt.Text), BabyName = babynametxt.Text, BabyFatherName = babyfathertext.Text, MotherName = babymotehrtext.Text, Date = dateEdit1.Text, Time = timeEdit1.Text, StaffName = doctornametext.Text, BabyWeight = babyweighttext.Text, BabyHeight = babyheighttxt.Text, Remarks = remarkstext.Text }; var editbirthBiz = new BirthDayregistrationBiz(); if (MessageBox.Show("are you sure you want to Update this file ?", "Confirm Updating", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { var result = editbirthBiz.Update(birthdata); if (result.Status) { MessageBox.Show("Successfuly Updated"); Clear(); } else { MessageBox.Show("Update faild." + result.Message); } } } }