public ValidationIssueCollection GetResults(EntryApp entryApp) { // assume Prepare() has been called already if (_preparedService == null) { throw new InvalidOperationException("Cannot run this version of GetResults without first preparing the service"); } return(_preparedService.Resolve(entryApp)); }
public ValidationIssueCollection GetResults(List <Hours> entries, HoursEntryMode entryMode, EntryApp entryApp, EntryType entryType, bool isPrecheck = false) { var repo = new ResolutionServiceRepository(_context); var service = new ResolutionService(entries, repo) { EntryMode = entryMode, EntryType = entryType, IsPreCheck = isPrecheck }; return(service.Resolve(entryApp)); }
public ValidationIssueCollection TimeBillBatchUpdate(bool ignoreWarnings, MVCxGridViewBatchUpdateValues <TimeBillGridListItemVM, int> updateValues) { using (var transaction = _context.Database.BeginTransaction()) { try { var hourEntries = new List <Domain2.Hours.Hours>(); foreach (var updatedEntry in updateValues.Update) { var existingEntry = _context.Hours.Find(updatedEntry.HoursID); existingEntry.HasCatalystData = updatedEntry.HasCatalystData; existingEntry.Service = _context.Services.Single(x => x.ID == updatedEntry.Service.ID); existingEntry.ServiceID = existingEntry.Service.ID; existingEntry.Date = updatedEntry.Date; existingEntry.StartTime = updatedEntry.TimeIn.TimeOfDay; existingEntry.EndTime = updatedEntry.TimeOut.TimeOfDay; existingEntry.ServiceLocationID = updatedEntry.ServiceLocationID.GetValueOrDefault(GetHomeDefault()); existingEntry.BillableHours = (decimal)updatedEntry.Billable; existingEntry.PayableHours = (decimal)updatedEntry.Payable; hourEntries.Add(existingEntry); } var repository = new ResolutionServiceRepository(_context); var resolutionService = new ResolutionService(hourEntries, repository) { UseExplicitBillableValue = true, UseExplicitPayableValue = true, EntryMode = HoursEntryMode.ManagementEntry }; var issues = resolutionService.Resolve(); if (issues.HasErrors || (issues.HasWarnings && !ignoreWarnings)) { transaction.Rollback(); return(issues); } else { _context.SaveChanges(); transaction.Commit(); return(issues); } } catch (Exception e) { transaction.Rollback(); Exceptions.Handle(e, Global.GetWebInfo()); throw e; } } }
public ValidationIssueCollection AddSingleHourEntry(bool ignoreWarnings, int caseID, int providerID, DateTime date, DateTime timeIn, DateTime timeOut, int serviceID, string notes, bool isAdjustment) { using (var transaction = _context.Database.BeginTransaction()) { try { var hourEntry = new Domain2.Hours.Hours { CaseID = caseID, Provider = _context.Providers.Single(m => m.ID == providerID), Service = _context.Services.Single(m => m.ID == serviceID), Date = date, StartTime = timeIn.TimeOfDay, EndTime = timeOut.TimeOfDay, Memo = notes }; hourEntry.ProviderID = hourEntry.Provider.ID; hourEntry.ServiceID = hourEntry.Service.ID; var repository = new ResolutionServiceRepository(_context); var resolutionService = new ResolutionService(new List <Domain2.Hours.Hours> { hourEntry }, repository) { EntryMode = HoursEntryMode.ManagementEntry }; var issues = resolutionService.Resolve(); if (issues.HasErrors || (issues.HasWarnings && !ignoreWarnings)) { transaction.Rollback(); return(issues); } else { _context.SaveChanges(); transaction.Commit(); return(issues); } } catch (Exception e) { transaction.Rollback(); Exceptions.Handle(e, Global.GetWebInfo()); throw e; } } }