public int InsertDataShiftHistory(ShiftHistoryModel model) { try { var data = new SHIFT_HISTORY(); data.ShiftName = model.ShiftName ?? ""; data.StaffID = model.StaffID; data.CashStart = model.CashStart; data.Status = 1; data.StartShift = DateTime.Now; data.CreateBy = model.CreateBy; data.CreateDate = DateTime.Now; _context.Entry(data).State = EntityState.Added; _context.SaveChanges(); return data.ShiftHistoryID; } catch (Exception ex) { LogPOS.WriteLog("SaveDataStaff :::::::::::::::::::::::::" + ex.Message); return 0; } }
public frmEndShift(ShiftHistoryModel data) { InitializeComponent(); modelShift = data; }
public int UpdateDataShiftHistory(ShiftHistoryModel model) { try { if (model.ShiftHistoryID > 0) { var data = _context.SHIFT_HISTORY.Find(model.ShiftHistoryID); if (data != null) { data.EndShift = DateTime.Now; data.CashEnd = model.CashEnd; data.SafeDrop = model.SafeDrop; data.UpdateBy = model.UpdateBy; data.UpdateDate = DateTime.Now; data.Status = 2; _context.Entry(data).State = EntityState.Modified; _context.SaveChanges(); return data.ShiftHistoryID; } return 0; } return 0; } catch (Exception ex) { LogPOS.WriteLog("SaveDataStaff :::::::::::::::::::::::::" + ex.Message); return 0; } }