public int AddBill(BillModel bill) { try { bill_t_test billDB = new bill_t_test(); billDB.BILL_T_TEST_ID = bill.BILL_T_TEST_ID; billDB.EMP_T_TEST_ID = bill.EMP_T_TEST_ID; billDB.EMP_T_TEST_NAME = bill.EMP_T_TEST_NAME; billDB.TYPE_M_TEST_ID = bill.TYPE_M_TEST_ID; billDB.STAT_M_TEST_ID = bill.STAT_M_TEST_ID; billDB.BILL_T_TES_VALUES = bill.BILL_T_TES_VALUES; billDB.BILL_T_TEST_DATE = bill.BILL_T_TEST_DATE; billDB.BILL_T_TEST_TIMESTMP = bill.BILL_T_TEST_TIMESTMP; billDB.BILL_T_TEST_ACTINE = bill.BILL_T_TEST_ACTINE; billDB.BILL_T_TEST_APPROVE_IDNAME = bill.BILL_T_TEST_APPROVE_IDNAME; db.bill_t_test.Add(billDB); db.SaveChanges(); int idBill = billDB.BILL_T_TEST_ID; return(idBill); } catch (Exception ex) { throw ex; } }
public bool DeleteRequestWithdraw(List <BillModel> delUniqueID) { try { List <bill_t_test> b = new List <bill_t_test>(); foreach (BillModel billT in delUniqueID) { bill_t_test bt = new bill_t_test(); bt.BILL_T_TEST_ID = billT.BILL_T_TEST_ID; bt.BILL_T_TEST_ACTINE = billT.BILL_T_TEST_ACTINE; bt.BILL_T_TEST_APPROVE_IDNAME = billT.BILL_T_TEST_APPROVE_IDNAME; bt.BILL_T_TEST_DATE = billT.BILL_T_TEST_DATE; bt.BILL_T_TEST_TIMESTMP = billT.BILL_T_TEST_TIMESTMP; bt.BILL_T_TES_VALUES = billT.BILL_T_TES_VALUES; bt.EMP_T_TEST_ID = billT.EMP_T_TEST_ID; bt.EMP_T_TEST_NAME = billT.EMP_T_TEST_NAME; bt.STAT_M_TEST_ID = billT.STAT_M_TEST_ID; bt.TYPE_M_TEST_ID = billT.TYPE_M_TEST_ID; b.Add(bt); } foreach (bill_t_test btt in b) { db.bill_t_test.Attach(btt); db.bill_t_test.Remove(btt); db.SaveChanges(); } return(true); } catch (Exception ex) { throw ex; } }
internal BillModel Mapping(bill_t_test m) { try { if (m != null) { return(new BillModel() { BILL_T_TEST_ID = m.BILL_T_TEST_ID, EMP_T_TEST_NAME = m.EMP_T_TEST_NAME, EMP_T_TEST_ID = (int)m.EMP_T_TEST_ID, TYPE_M_TEST_ID = (int)m.TYPE_M_TEST_ID, STAT_M_TEST_ID = (int)m.STAT_M_TEST_ID, BILL_T_TES_VALUES = (int)m.BILL_T_TES_VALUES, BILL_T_TEST_DATE = (DateTime)m.BILL_T_TEST_DATE, BILL_T_TEST_TIMESTMP = (DateTime)m.BILL_T_TEST_TIMESTMP, BILL_T_TEST_ACTINE = m.BILL_T_TEST_ACTINE, BILL_T_TEST_APPROVE_IDNAME = (int)m.BILL_T_TEST_APPROVE_IDNAME }); } return(null); } catch (Exception ex) { throw ex; } }
public bool UpdateRequestApprove(List <BillModel> billStatus) { try { foreach (BillModel b in billStatus) { bill_t_test bbT = IQueryableBill().FirstOrDefault(bil => bil.BILL_T_TEST_ID == b.BILL_T_TEST_ID); bbT.STAT_M_TEST_ID = b.STAT_M_TEST_ID; db.SaveChanges(); } return(true); } catch (Exception ex) { throw ex; } }
public bool UpdateApprove(List <BillModel> billStatus) { try { foreach (BillModel b in billStatus) { bill_t_test billDB = IQueryableBill().FirstOrDefault(s => s.BILL_T_TEST_ID == b.BILL_T_TEST_ID); billDB.STAT_M_TEST_ID = b.STAT_M_TEST_ID; billDB.BILL_T_TEST_APPROVE_IDNAME = b.BILL_T_TEST_APPROVE_IDNAME; db.SaveChanges(); } return(true); } catch (Exception ex) { throw ex; } }