Example #1
0
 private void grdList_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     try
     {
         if (e.ColumnIndex == 5)
         {
             clearDocumentData();
             int rowID = e.RowIndex;
             btnSave.Text             = "Update";
             pnlDocumentInner.Visible = true;
             pnlDocumentOuter.Visible = true;
             pnlDocumentList.Visible  = false;
             sef                        = new sefcheck();
             sef.rowid                  = Convert.ToInt32(grdList.Rows[e.RowIndex].Cells["RowID"].Value.ToString());
             sef.SEFID                  = grdList.Rows[e.RowIndex].Cells["SEFID"].Value.ToString();
             txtSequenceNo.Text         = grdList.Rows[e.RowIndex].Cells["Seqno"].Value.ToString();
             txtDescription.Text        = grdList.Rows[e.RowIndex].Cells["Description"].Value.ToString();
             cmbSEFstatus.SelectedIndex = cmbSEFstatus.FindStringExact(grdList.Rows[e.RowIndex].Cells["empStatus"].Value.ToString());
             cmbSEFType.Enabled         = false;
             disableBottomButtons();
         }
     }
     catch (Exception ex)
     {
     }
 }
Example #2
0
 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");
     }
 }