Exemplo n.º 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;
     }
 }
Exemplo n.º 2
0
 public frmSection()
 {
     InitializeComponent();
     sectbal = new SectionBAL();
     sect    = new tbl_000_SECTION();
     err     = new ErrorProviderExtended();
 }
Exemplo n.º 3
0
 public Boolean Save(tbl_000_SECTION record)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             db.SectionList.Add(record);
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Rollback();
             throw ex;
         }
     }
 }
Exemplo n.º 4
0
 public Boolean Delete(tbl_000_SECTION record)
 {
     using (var dbContextTransaction = db.Database.BeginTransaction())
     {
         try
         {
             var existrecord = GetByID(record.SECTIONCODE);
             db.SectionList.Remove(existrecord);
             db.SaveChanges();
             dbContextTransaction.Commit();
             return(true);
         }
         catch (Exception ex)
         {
             dbContextTransaction.Rollback();
             throw ex;
         }
     }
 }
Exemplo n.º 5
0
 public Boolean Delete(tbl_000_SECTION record)
 {
     try
     {
         if (record == null)
         {
             throw new Exception("Invalid Parameter!");
         }
         if (!compdal.IsExistID(record.SECTIONCODE))
         {
             throw new Exception("Record does not exist!");
         }
         return(compdal.Delete(record));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 6
0
 public Boolean Save(tbl_000_SECTION record)
 {
     try
     {
         if (record == null)
         {
             throw new Exception("Invalid Parameter!");
         }
         if (compdal.IsExistSectionDesc(record.SECTIONDESC))
         {
             throw new Exception("Description already taken!");
         }
         if (compdal.IsExistID(record.SECTIONCODE))
         {
             throw new Exception("Code already taken!");
         }
         return(compdal.Save(record));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 7
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);
     }
 }