//method for editing data from the database private void EdittoolStripButton46_Click(object sender, EventArgs e) { if (psitionidtext.Text == "") { MessageBox.Show("Please Insert Possition ID"); } else { var updatpossition = new Possition() { ID = Convert.ToInt32(psitionidtext.Text), Department = textEdit4.Text, Branch = textEdit3.Text, PossitionName = textEdit2.Text, Remarks = textEdit1.Text }; var uppossitionBiz = new PossitionsBiz(); if (MessageBox.Show("are you sure you want to Edit this file ?", "Confirm Updating", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { var result = uppossitionBiz.Update(updatpossition); if (result.Status) { MessageBox.Show("Successfuly Updated"); clearpo(); } else { MessageBox.Show("Update faild." + result.Message); } } } }
//Mthod for deleting data from the database private void DeletdtoolStripButton51_Click(object sender, EventArgs e) { if (psitionidtext.Text == "") { MessageBox.Show("Please Insert Possition ID"); } else { int poid = Convert.ToInt32(psitionidtext.Text); var positonbiz = new PossitionsBiz(); if (MessageBox.Show("are you sure you want to delet ?", "Confirm Deletion", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { var result = positonbiz.Delete(poid); if (result.Status) { XtraMessageBox.Show("Successfully Deleted"); clearpo(); } else { XtraMessageBox.Show("Not Deleted Successfully ." + result.Message); } } } }
// method for saving data to the database private void SavetoolStripButton45_Click(object sender, EventArgs e) { var possitons = new Possition() { Department = textEdit4.Text, Branch = textEdit3.Text, PossitionName = textEdit2.Text, Remarks = textEdit1.Text }; var PossitionBiz = new PossitionsBiz(); var result = PossitionBiz.Add(possitons); if (result.Status) { MessageBox.Show("Successfully saved."); clearpo(); } else { MessageBox.Show("Save failed. " + result.Message); } }