예제 #1
0
 private void AssignRecord(Boolean IsSave)
 {
     try
     {
         if (IsSave)
         {
             sect.SECTIONCODE = mtxtSectionCode.Text;
             sect.SECTIONDESC = mtxtSectionDesc.Text;
             sect.IsActive    = mcbActive.Checked;
             sect.ISCOSTING   = mcbCosting.Checked;
             sect.SUPERVISOR  = mtxtSectionSupervisor.Text;
         }
         else
         {
             sect = sectbal.GetByID(SectionCode);
             if (sect != null)
             {
                 mtxtSectionCode.Text       = sect.SECTIONCODE.ToString();
                 mtxtSectionDesc.Text       = sect.SECTIONDESC;
                 mtxtSectionSupervisor.Text = sect.SUPERVISOR;
                 mcbActive.Checked          = sect.IsActive;
                 mcbCosting.Checked         = sect.ISCOSTING;
             }
             else
             {
                 throw new Exception("Record doesn't exist!");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #2
0
 public void DeleteRecord()
 {
     try
     {
         var    sectioncode = mgridList.Rows[mgridList.SelectedCells[0].RowIndex].Cells["colSectionCode"].Value.ToString();
         string scode       = sectioncode;
         if (MessageHelpers.ShowQuestion("Are you sure you want to delete record?") == System.Windows.Forms.DialogResult.Yes)
         {
             var DeletingisSuccess = false;
             var msg = "Deleting";
             sect = Sectionbal.GetByID(sectioncode);
             if (Sectionbal.Delete(sect))
             {
                 DeletingisSuccess = true;
             }
             if (DeletingisSuccess)
             {
                 MessageHelpers.ShowInfo(msg + " Successful!");
                 RefreshGrid();
                 PageManager(1);
             }
             else
             {
                 MessageHelpers.ShowWarning(msg + " Failed!");
             }
         }
     }
     catch (Exception ex)
     {
         MessageHelpers.ShowError(ex.Message);
     }
     finally
     {
         FormHelpers.CursorWait(false);
     }
 }