public bool StartWorkPeriod(string description) { using (var w = WorkspaceFactory.Create()) { using (var tran = w.BeginTransaction()) { try { _workPeriodDao.StartWorkPeriod(description, w); foreach (var workPeriodProcessor in WorkPeriodProcessors) { workPeriodProcessor.ProcessWorkPeriodStart(CurrentWorkPeriod); } if (tran != null) { tran.Commit(); } } catch (Exception e) { if (tran != null) { tran.Rollback(); } _logService.LogError(e); return(false); } } } _applicationStateSetter.ResetWorkPeriods(); return(true); }
public void StartWorkPeriod(string description, decimal cashAmount, decimal creditCardAmount, decimal ticketAmount) { using (var workspace = WorkspaceFactory.Create()) { _applicationStateSetter.ResetWorkPeriods(); var latestWorkPeriod = workspace.Last <WorkPeriod>(); if (latestWorkPeriod != null && latestWorkPeriod.StartDate == latestWorkPeriod.EndDate) { return; } var now = DateTime.Now; var newPeriod = new WorkPeriod { StartDate = now, EndDate = now, StartDescription = description, CashAmount = cashAmount, CreditCardAmount = creditCardAmount, TicketAmount = ticketAmount }; workspace.Add(newPeriod); workspace.CommitChanges(); _applicationStateSetter.ResetWorkPeriods(); } }
public void StartWorkPeriod(string description) { _applicationStateSetter.ResetWorkPeriods(); _workPeriodDao.StartWorkPeriod(description); _applicationStateSetter.ResetWorkPeriods(); }