public void HoursEntryFutureDateSetsValidationStatusNone() { Case c = getTimeOverlapTestCaseStub(); var hoursToTest = new CaseAuthorizationHours() { Date = DateTime.Now.AddDays(1), TimeIn = new DateTime(2016, 7, 2, 10, 30, 0), TimeOut = new DateTime(2016, 7, 2, 11, 30, 0), Service = new Service() { ID = 0 }, Notes = "fake notes", Provider = new CaseProvider() { Type = new Domain.Providers.ProviderType() { ID = 0 } } }; var resolver = new HoursEntryResolver(c, hoursToTest, _caseService); resolver.Resolve(); Assert.IsTrue(resolver.PassingStatus == HoursEntryResolver.ValidationResultStatus.None); }
public void HoursEntryTimeInOutDatePartsMatchDateProperty() { Case c = getTimeOverlapTestCaseStub(); var hoursToTest = new CaseAuthorizationHours() { Date = DateTime.Now.AddDays(-2), TimeIn = new DateTime(2011, 7, 2, 10, 30, 0), TimeOut = new DateTime(2011, 7, 2, 11, 30, 0), Service = new Service() { ID = 0 }, Notes = "fake notes", Provider = new CaseProvider() { Type = new Domain.Providers.ProviderType() { ID = 0 } } }; var resolver = new HoursEntryResolver(c, hoursToTest, _caseService); resolver.Resolve(); Assert.IsTrue(hoursToTest.TimeIn.Date == hoursToTest.Date); Assert.IsTrue(hoursToTest.TimeOut.Date == hoursToTest.Date); }
public void HoursEntryBillablePayableRoundNearestQuarter() { Case c = getTimeOverlapTestCaseStub(); var hoursToTest = new CaseAuthorizationHours() { CaseID = 420, Date = DateTime.Now.AddDays(-2), TimeIn = new DateTime(2011, 7, 2, 10, 02, 0), TimeOut = new DateTime(2011, 7, 2, 11, 28, 0), Service = new Service() { ID = 0 }, Notes = "fake notes", Provider = new CaseProvider() { Type = new Domain.Providers.ProviderType() { ID = 0 } } }; var resolver = new HoursEntryResolver(c, hoursToTest, _caseService); resolver.Resolve(); Assert.IsTrue(hoursToTest.BillableHours == 1.5); Assert.IsTrue(hoursToTest.PayableHours == 1.5); }
public static CaseAuthorizationHours CaseAuthorizationHour(CaseAuthHour entity, List <Domain.Services.ServiceLocation> serviceLocations = null) { var hours = new CaseAuthorizationHours(); hours.Date = entity.HoursDate; hours.DateCreated = entity.DateCreated; hours.Status = (AuthorizationHoursStatus)entity.HoursStatus; hours.CaseID = entity.CaseID; hours.HoursTotal = (double)entity.HoursTotal; hours.ID = entity.ID; hours.Notes = entity.HoursNotes; hours.TimeIn = hours.Date + entity.HoursTimeIn; hours.TimeOut = hours.Date + entity.HoursTimeOut; if (entity.HoursServiceID.HasValue) { hours.Service = new Data.Services.CaseService().GetServices().Where(x => x.ID == entity.HoursServiceID.Value).FirstOrDefault(); } hours.Provider = new Domain.Cases.CaseProvider() { ID = entity.CaseProviderID }; hours.Authorization = new CaseAuthorization() { ID = entity.CaseAuthID }; hours.PayableHours = (double?)entity.HoursPayable; hours.BillableHours = (double?)entity.HoursBillable; hours.BillingRef = entity.HoursBillingRef; hours.PayableRef = entity.HoursPayableRef; hours.ProviderID = entity.CaseProviderID; hours.HasCatalystData = entity.HoursHasCatalystData; hours.WatchEnabled = entity.HoursWatchEnabled; hours.WatchNote = entity.HoursWatchNote; hours.SSGParentID = entity.HoursSSGParentID; hours.CorrelationID = entity.HoursCorrelationID; hours.InternalNotes = entity.HoursInternalNotes; hours.IsPayrollOrBillingAdjustment = entity.IsPayrollOrBillingAdjustment; hours.ServiceLocationID = entity.ServiceLocationID; if (entity.ServiceLocationID.HasValue) { if (serviceLocations == null) { hours.ServiceLocation = new Services.ServicesService().GetActiveServiceLocations().Where(x => x.ID == entity.ServiceLocationID).FirstOrDefault(); } else { hours.ServiceLocation = serviceLocations.Where(x => x.ID == entity.ServiceLocationID).FirstOrDefault(); } } return(hours); }
public CaseAuthorizationHours GetCaseHoursItem(int hoursID) { var item = new CaseAuthorizationHours(); var context = new Models.CoreEntityModel(); var entity = context.CaseAuthHours.Find(hoursID); if (entity == null) { return(null); } else { return(Mappings.AuthorizationMappings.CaseAuthorizationHour(entity)); } }
/*********************** * * PRIVATE METHODS * **********************/ void AddError(ValidationErrors error, CaseAuthorizationHours sourceHours, CaseAuthorizationHours correlatedHours) { // make sure this hasn't been previously matched var existing = Errors.Where(x => (x.MatchedOn.ID == correlatedHours?.ID) && (x.ErrorType == error)) .ToList(); if (existing.Count == 0) { Error err = new Error { ErrorType = error, MatchedOn = sourceHours }; if (correlatedHours != null) { err.MatchedTo.Add(correlatedHours); } Errors.Add(err); } }
public void SaveCaseAuthHours(CaseAuthorizationHours hours, int caseID, int?authID, int providerID) { using (SqlConnection conn = new SqlConnection(this.connectionString)) using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conn; cmd.CommandText = "INSERT INTO dbo.CaseAuthHours (" + "CaseAuthID, CaseID, CaseProviderID, HoursDate, HoursTimeIn, HoursTimeOut, HoursTotal, HoursServiceID, HoursNotes, HoursStatus, HoursPayable, HoursBillable " + ") VALUES (" + "@AuthID, @CaseID, @ProviderID, @Date, @TimeIn, @TimeOut, @Hours, @ServiceID, @Notes, @Status, @Payable, @Billable);"; cmd.Parameters.AddWithValue("@ProviderID", providerID); cmd.Parameters.AddWithValue("@Date", hours.Date); cmd.Parameters.AddWithValue("@TimeIn", hours.TimeIn); cmd.Parameters.AddWithValue("@TimeOut", hours.TimeOut); cmd.Parameters.AddWithValue("@Hours", hours.HoursTotal); cmd.Parameters.AddWithValue("@ServiceID", hours.Service.ID.Value); cmd.Parameters.AddWithValue("@Notes", hours.Notes); if (authID.HasValue) { cmd.Parameters.AddWithValue("@AuthID", authID.Value); } else { cmd.Parameters.AddWithNullableValue("@AuthID", null); } cmd.Parameters.AddWithValue("@CaseID", caseID); cmd.Parameters.AddWithValue("@Status", hours.Status); cmd.Parameters.AddWithNullableValue("@Payable", hours.PayableHours); cmd.Parameters.AddWithNullableValue("@Billable", hours.BillableHours); var id = cmd.InsertToIdentity(); ProcessAuthBreakdown(id); } }