private void btnSave_Click(object sender, EventArgs e) { if (VD.IsNull(txtDesig)) { return; } try { Desig des = new Desig(); des.DesigId = Convert.ToInt32(txtdesigId.Text); des.DesigNm = txtDesig.Text; des.DesigTypeID = Convert.ToInt32(ddlDesignType.SelectedValue.ToString()); if (flag == true) { Desig.Save(des, "I"); } else if (flag == false) { Desig.Save(des, "U"); } CtrlState(false, 421); Display(); GenerateSerialNo(); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnAdd_Click(object sender, EventArgs e) { CtrlState(true, 388); flag = true; GetDesignationType(); txtdesigId.Text = Desig.GetMaxStateId(); txtDesig.Clear(); txtDesig.Focus(); }
private void btnDelete_Click(object sender, EventArgs e) { if (dgDesig.SelectedRows.Count > 0) { DialogResult chk = MessageBox.Show("Do u want to delete Designation Type " + dgDesig.SelectedRows[0].Cells[2].Value, "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (chk == DialogResult.Yes) { try { string id = dgDesig.SelectedRows[0].Cells[1].Value.ToString(); Desig.Delete(id); Display(); GenerateSerialNo(); } catch (Exception ex) { MessageBox.Show("ERROR" + ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void Display() { dgDesig.AutoGenerateColumns = false; dgDesig.DataSource = Desig.GetStates(); }