private void ListEmpFinLimit(string sefid) { try { grdList.Rows.Clear(); SEFCheckListDB fdb = new SEFCheckListDB(); List <sefcheck> finList = fdb.getSEFCheckList(sefid); foreach (sefcheck flim in finList) { grdList.Rows.Add(flim.rowid, flim.SEFID, flim.Sequenceno, flim.description, ComboFIll.getStatusString(flim.Status)); } } catch (Exception ex) { MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error"); } enableBottomButtons(); pnlDocumentList.Visible = true; }
private void btnSave_Click(object sender, EventArgs e) { try { sefcheck flist = new sefcheck(); SEFCheckListDB fdb = new SEFCheckListDB(); flist.SEFID = ((Structures.ComboBoxItem)cmbSEFType.SelectedItem).HiddenValue; flist.description = txtDescription.Text; try { flist.Sequenceno = Convert.ToInt32(txtSequenceNo.Text); } catch (Exception) { flist.Sequenceno = 0; } flist.Status = ComboFIll.getStatusCode(cmbSEFstatus.SelectedItem.ToString()); System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button; string btnText = btn.Text; { if (btnText.Equals("Update")) { flist.rowid = sef.rowid; if (fdb.updateSEFCheckList(flist)) { MessageBox.Show("SEFCheckList updated"); closeAllPanels(); ListEmpFinLimit(flist.SEFID); cmbSEFType.Enabled = true; } else { MessageBox.Show("Failed to update SEFCheckList"); } } else if (btnText.Equals("Save")) { if (fdb.validateSEFChecklist(flist)) { if (fdb.insertSefChecklist(flist)) { MessageBox.Show("SEFCheckList data Added"); closeAllPanels(); ListEmpFinLimit(flist.SEFID); cmbSEFType.Enabled = true; } else { MessageBox.Show("Failed to Insert SEFCheckList"); } } else { MessageBox.Show("SEFCheckList Data Validation failed"); } } } } catch (Exception ex) { MessageBox.Show("Failed Adding / Editing User Data"); } }