public Boolean Save(tbl_000_H_ITEM_MPT record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { db.ItemMPTList.Add(record); db.SaveChanges(); dbContextTransaction.Commit(); return(true); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } }
public Boolean Delete(tbl_000_H_ITEM_MPT record) { try { if (record == null) { throw new Exception("Invalid Parameter!"); } if (!itmptdal.IsExistID(record.DocID)) { throw new Exception("Record does not exist!"); } return(itmptdal.Delete(record)); } catch (Exception ex) { throw ex; } }
public Boolean Save(tbl_000_H_ITEM_MPT record) { try { if (record == null) { throw new Exception("Invalid Parameter!"); } if (itmptdal.IsExistID(record.DocID)) { throw new Exception("MPT Code already taken!"); } return(itmptdal.Save(record)); } catch (Exception ex) { throw ex; } }
public Boolean Update(tbl_000_H_ITEM_MPT record) { using (var dbContextTransaction = db.Database.BeginTransaction()) { try { //var existrecord = GetByID(record.YEARUSED, record.ItemNo, record.SectionCode); var existrecord = GetByID(record.DocID); db.Entry(existrecord).GetDatabaseValues().SetValues(record); db.SaveChanges(); dbContextTransaction.Commit(); return(true); } catch (Exception ex) { dbContextTransaction.Rollback(); throw ex; } } }