public CaseRate GetCaseRateAtDate(DateTime refDate, Cases.Case @case) { return(CaseRates .Where(x => x.EffectiveDate <= refDate && x.CaseID == @case.ID) .OrderByDescending(x => x.EffectiveDate) .FirstOrDefault()); }
public decimal?GetActiveHourlyRate(DateTime refDate, Cases.Case @case, Services.Service service) { // precedence: Case, Service, Provider, Static var caseRate = GetCaseRateAtDate(refDate, @case); if (caseRate != null) { return(caseRate.Rate); } var serviceRate = GetServiceRateAtDate(refDate, service); if (serviceRate != null) { return(serviceRate.Rate); } var providerRate = GetProviderRateAtDate(refDate); if (providerRate != null) { if (providerRate.Type == RateType.Hourly) { return(providerRate.Rate); } else { throw new NotImplementedException(); // need a salary to hours conversion... waiting on client } } return(HourlyRate); }
public Cases.Case GenerateCase() { var c = new Cases.Case(); var p = new Patients.Patient { Address1 = this.ContactInfo.Address1, Address2 = this.ContactInfo.Address2, City = this.ContactInfo.City, DateCreated = DateTime.UtcNow, DateOfBirth = this.DateOfBirth, Email = this.ContactInfo.Email, FirstName = this.FirstName, Gender = this.Gender, GeneratingReferralID = this.ID, GuardianFirstName = this.Guardian.FirstName, GuardianLastName = this.Guardian.LastName, GuardianRelationship = this.Guardian.Relationship, InsuranceCompanyName = this.InsuranceInformation.CompanyName, InsuranceMemberID = this.InsuranceInformation.MemberID, InsurancePrimaryCardholderDOB = this.InsuranceInformation.PrimaryCardholderDateOfBirth, InsuranceProviderPhone = this.InsuranceInformation.CompanyProviderPhone, Language = this.PrimarySpokenLanguage, LastName = this.LastName, Phone = this.ContactInfo.Phone, State = this.ContactInfo.State, Zip = this.ContactInfo.ZipCode }; c.DateCreated = DateTime.UtcNow; c.GeneratingReferralID = this.ID; c.Patient = p; c.StatusNotes = this.StatusNotes; c.RequiredHoursNotes = this.ReferrerNotes; c.CalculateStatus(); return c; }
public Period(int year, int month, Cases.Case @case) { Case = @case; Year = year; Month = month; Hours = Case.Hours.Where(x => x.Date >= StartDate && x.Date <= EndDate).ToList(); }
public void HoursIsEditableByProviderFalseIfCaseFinalized() { var testProvider = new Providers.Provider() { ID = 1 }; var finalization = new Cases.HoursFinalization(); var hours = new Hours(); var period = new Domain2.Cases.MonthlyPeriod(); var c = new Cases.Case(); hours.Provider = new Providers.Provider() { ID = 1 }; hours.Status = HoursStatus.Pending; finalization.ProviderID = 1; finalization.Provider = testProvider; c.Periods = new List <Cases.MonthlyPeriod>(); c.Periods.Add(period); period.Finalizations = new List <Cases.HoursFinalization>(); period.Finalizations.Add(finalization); hours.Case = c; Assert.IsFalse(hours.IsEditableByProvider(testProvider)); }
public static void Should_proxinate_interface_types_and_keep_interface_to_type_mapping( Cases.Case @case) { // Arrange var arrangeRootCollection = (IServiceCollection) new ServiceCollection(); foreach (var implementationType in @case.ImplementationTypes) { arrangeRootCollection.Add( new ServiceDescriptor( @case.ServiceType, implementationType, ServiceLifetime.Singleton)); } var arrangeRootServices = (IServiceProvider)arrangeRootCollection.BuildServiceProvider(); // Act var arrangeCollection = (IServiceCollection) new ServiceCollection(); arrangeCollection.Proxinate(arrangeRootCollection, arrangeRootServices); var arrangeServices = (IServiceProvider)arrangeCollection.BuildServiceProvider(); var proxies = arrangeServices.GetServices(@case.RequestType) .Cast <IProxynatorProxy>() .ToArray(); // Assert foreach (var implementationType in @case.ImplementationTypes) { Assert.Contains( proxies, proxy => { var t = proxy.Target.GetType(); if (t.IsGenericType) { return(t.GetGenericTypeDefinition() == implementationType); } return(t == implementationType); }); } }
public Cases.Case GetCase(UserHeader user, int id) { var @case = _database.GetCaseById(id); if (@case == null) throw new CaseDoesNotExistsException(); if (!CanSeeAllCases(user) && !IsUserAssignedToCase(user, @case)) throw new ForbiddenException(); var state = GetCaseState(@case); var partiesComments = _database.GetPartiesComments(id); var result = new Cases.Case { ReadonlyData = new ReadonlyCaseData { Id = @case.Id, ParentId = @case.ParentId, State = state, }, InitialData = new InitialCaseData { CanBeEdited = state.StateKind == CaseStateKind.New, IsReady = GetIsCaseReadyToStart(@case), StartDate = @case.StartDate, Background = @case.Background, IdealOutcome = @case.IdealOutcome, IssueRaisedWithArchitect = new Question { Answer = @case.IssueRaisedWithArchitect.Answer, Comments = @case.IssueRaisedWithArchitect.Comments, }, SubjectOfLegalProceedings = new Question { Answer = @case.SubjectOfLegalProceedings.Answer, Comments = @case.SubjectOfLegalProceedings.Comments, }, CasePanelMembers = GetPanelMembers(@case), }, Contacts = new CaseContacts { Relationship = @case.Relationship, ContactAgreement = @case.ContactAgreement, ArchitectContact = new ArchitectContact { Name = @case.ArchitectContact.Name, Address = @case.ArchitectContact.Address, EMail = @case.ArchitectContact.EMail, Phone = @case.ArchitectContact.Phone, RegistrationNumber = @case.ArchitectContact.RegistrationNumber, }, ClaimantContact = new Contact { Name = @case.ClaimantContact.Name, Address = @case.ClaimantContact.Address, EMail = @case.ClaimantContact.EMail, Phone = @case.ClaimantContact.Phone, }, }, DatesAndDetails = @case.DatesAndDetails.Select(item => new DateAndDetail { Id = item.Id, Date = item.Date, Text = item.Text, Documents = item.Documents.Select(d => new Document {Id = d.Id, Name = d.Name}).ToArray(), }).ToArray(), Allegations = new AllegationCollection { CanAddAllegation = IsNewOrPreliminaryComments(state), Items = @case.Allegations.Select(item => new Allegation { Id = item.Id, Text = item.Text, MyComment = item.Comments.Where(c => c.PanelMemberId == user.Id).Select(c => new MyAllegationComment { AllegationCommentType = (AllegationCommentType) c.CommentType, Text = c.Text, AdditionalText = c.AdditionalText, }).FirstOrDefault(), Documents = item.Documents.Select(d => new Document {Id = d.Id, Name = d.Name}).ToArray(), CanBeDeleted = !item.Comments.Any() && IsNewOrPreliminaryComments(state), }).ToArray(), }, PartiesComments = partiesComments, }; result.PreliminaryDecisionDocument = @case.PreliminaryDecisionDocument == null ? null : new Document {Id = @case.PreliminaryDecisionDocument.Id, Name = @case.PreliminaryDecisionDocument.Name}; result.FinalDecisionDocument = @case.FinalDecisionDocument == null ? null : new Document {Id = @case.FinalDecisionDocument.Id, Name = @case.FinalDecisionDocument.Name}; return result; }