private int DeleteTblEmployeeShift(TblEmployeeShift row) { if (!Att.AttService.EmpCanEdit(row.TransDate, row.EmpId)) { throw new Exception("Cannot edit a transaction because this period is already closed"); } using (var context = new TimeAttEntities()) { var oldRow = (from e in context.TblEmployeeShifts.Include("TblEmployeeShiftLookup1") where e.EmpId == row.EmpId && e.TransDate == row.TransDate select e).SingleOrDefault(); if (oldRow != null) { //if (oldRow.Status == 1) //{ // var srv = new EmployeePayrollServiceClient(); // srv.DeleteEmpCalendarDeviation(row.EmpId, row.TransDate, oldRow.TblEmployeeShiftLookup1.CalendarId); //} context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteTblPeriodLock(TblPeriodLock row) { using (var context = new TimeAttEntities()) { var oldRow = (from e in context.TblPeriodLocks where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteEmpLeavingTransaction(EmpLeavingTransaction row) { using (var context = new TimeAttEntities()) { var oldRow = (from e in context.EmpLeavingTransactions where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private int DeleteTblVariableTermManual(Model.TblVariableTermManual row) { using (var context = new TimeAttEntities()) { var oldRow = (from e in context.TblVariableTermManuals where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }