private void BtnCreate_Click(object sender, EventArgs e) { if (txtDescription.Text != "Description" && txtDesignation.Text != "Designation") { try { dbll.Designation = txtDesignation.Text.ToUpper(); dbll.Description = txtDescription.Text.ToUpper(); bool IsSuccess = ddal.Insert(dbll); if (IsSuccess) { MessageBox.Show("Successfully created", "Designation", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); Reset(); DataTable dt = new DataTable(); dt = ddal.Select(); dataGridView1.DataSource = dt; return; } else { MessageBox.Show("Failed to initiate a record", "Designation", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); return; } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "UI error"); } } else { MessageBox.Show("Invalid parameters", "Designation parameters", MessageBoxButtons.OKCancel, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } }
public Boolean Insert(DesignationENT entDesignation) { DesignationDAL dalDesignation = new DesignationDAL(); if (dalDesignation.Insert(entDesignation)) { return(true); } else { Message = dalDesignation.Message; return(false); } }