using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web.Mvc; using BeWo.View.Navigation.Filter; using BeWoPlanerMobil.Service; using BeWoPlanerMobil.Util; using BS.Shared; using BS.Shared.DataContracts; using BS.Shared.DataContracts.Compact; using BS.Shared.Extensions; using BS.Shared.Settings; namespace BeWoPlanerMobil.Models { public class MainModel : AbstractModel { public long? SelectedCostBearerSupportConceptRelOid { get; set; } [Display(Name = "Nur meine Klienten anzeigen")] public bool ShowOnlyOwnSupportConcepts { get; set; } [Display(Name = "Nur Klienten meiner Teams anzeigen")] public bool ShowOnlyMyTeamsSupportConcepts { get; set; } public CustomerFilterEnum SelectedSupportConceptFilter { get; set; } public List SupportConceptFilter { get { /* * Hat man das Recht "Hilfepläne ansehen (alle)": * "Alle Hiflepläne anzeigen" und * "Nur meine Hilfepläne anzeigen". * * Hat man die Rechte "Hilfepläne ansehen (alle)" und "Hilepläne ansehen (von Teams betreut)": * "Alle Hiflepläne anzeigen", * "Nur Hilfepläne meiner Teams anzeigen" und * "Nur meine Hilfepläne anzeigen". * * Hat man das Recht "Hilepläne ansehen (von Mitarbeiter betreut): * ENTFÄLLT -> nur die eigenen Hilfepläne * * Hat man die Rechte "Hilfepläne ansehen (von Mitarbeiter betreut)" und "Hilfepläne ansehen (von Teams betreut)": * "Nur meine Hilfepläne anzeigen" * "Nur Hilfepläne meiner Teams anzeigen" */ var result = new List(); var user = MobileSessionFacade.LoggedInUser; var alle = new CustomerFilterItem(CustomerFilterEnum.All); var nurMeine = new CustomerFilterItem(CustomerFilterEnum.MyCustomer); var meinesTeams = new CustomerFilterItem(CustomerFilterEnum.TeamCustomer); var allSupportConcepts = alle.CustomerFilterName; var mySupportConceptsOnly = nurMeine.CustomerFilterName; var myTeamsSupportConceptsOnly = meinesTeams.CustomerFilterName; const string allSupportConceptsValue = "0"; const string mySupportConceptsValue = "1"; const string myTeamsSupportConceptsOnlyValue = "2"; if(user != null) { if(user.CheckForAtLeastOneRight(new List { UserRightType.ViewAll, UserRightType.SupportConcept_ViewAllSupportConcepts })) { if(user.CheckForRight(UserRightType.SupportConcept_ViewMyTeams)) { result.Add(new SelectListItem { Text = allSupportConcepts, Value = allSupportConceptsValue }); result.Add(new SelectListItem { Text = myTeamsSupportConceptsOnly, Value = myTeamsSupportConceptsOnlyValue }); result.Add(new SelectListItem { Text = mySupportConceptsOnly, Value = mySupportConceptsValue }); } else { result.Add(new SelectListItem { Text = allSupportConcepts, Value = allSupportConceptsValue }); result.Add(new SelectListItem { Text = mySupportConceptsOnly, Value = mySupportConceptsValue }); } } else if(user.CheckForRight(UserRightType.SupportConcept_ViewMyTeams)) { result.Add(new SelectListItem { Text = myTeamsSupportConceptsOnly, Value = myTeamsSupportConceptsOnlyValue }); result.Add(new SelectListItem { Text = mySupportConceptsOnly, Value = mySupportConceptsValue }); } } return result; } } [Display(Name = "Abgelaufene Hilfepläne anzeigen")] public bool ShowExpiredSupportConcepts { get; set; } [Display(Name = "Hilfeplan")] public long? CostBearer2SupportConceptOid { get; set; } public long? SelectedServiceCategoryOid => SelectedServiceCategory?.ServiceCategoryOid; public long? SelectedServiceDescriptionOid => SelectedServiceDescription?.ServiceDescriptionOid; public long? SelectedServiceRecordOid { get; set; } public static bool IsAllowedToDeleteServiceRecord(ServiceRecordDC serviceRecord) { var allowed = false; if(MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordView_Delete)) { allowed = true; } else if(MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowChangeWithin24Hours)) { if(serviceRecord.InsertedOn.HasValue) { if(DateTime.Now < serviceRecord.InsertedOn.Value.AddDays(ApplicationSettings.ServiceRecordAllowChangeHours)) { allowed = true; } } } if(allowed && ApplicationSettings.MaxDaysEditServiceRecordsAllowed > 0) { if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth)) { if(serviceRecord.Start.HasValue) { var dateTime = new DateTime(serviceRecord.Start.Value.Year, serviceRecord.Start.Value.Month, 1); dateTime = dateTime.AddMonths(1); dateTime = dateTime.AddDays(ApplicationSettings.MaxDaysEditServiceRecordsAllowed); if(DateTime.Now >= dateTime) { allowed = false; } } } } if (allowed && ApplicationSettings.AnzTageZeiterfassErfolgt > 0) { if (!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordAllowEditAfterMindays)) { if (serviceRecord.Start != null) { var dt = new DateTime(serviceRecord.Start.Value.Year, serviceRecord.Start.Value.Month, serviceRecord.Start.Value.Day); dt = dt.AddDays(ApplicationSettings.AnzTageZeiterfassErfolgt + 1); if (DateTime.Now >= dt) { allowed = false; } } } } if(allowed && !MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditForOtherEmployees)) { if(MobileSessionFacade.LoggedInEmployee.EmployeeOid != serviceRecord.Employee.EmployeeOid) { allowed = false; } } if(allowed && serviceRecord.GroupOid.HasValue) { if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking)) { allowed = false; } } return allowed; } public ServiceRecordDC SelectedServiceRecord { get; set; } public SupportConceptDC SelectedSupportConcept { get; set; } public int Zeitraum { get; set; } public int ErrorWert { get; set; } public bool ShowSignature { get; set; } public long ServiceRecordOid { get; set; } public List SupportConcepts { get; set; } public List Textbausteine { get; set; } = new List(); public List TextModules { get; set; } = new List(); private List _ServiceRecords; public List ServiceRecords { get { if(_ServiceRecords == null) { return _ServiceRecords = new List(); } return _ServiceRecords.OrderByDescending(sr => sr.Start).ToList(); } set => _ServiceRecords = value; } private List _SelectedGoals; public List SelectedGoals { get => _SelectedGoals ?? new List(); set => _SelectedGoals = value; } private string GetRatingName(ValueListEntryDC ratedValueListEntry) { var rating = GoalRatingTypes.FirstOrDefault(f => f.RatingTypeOid.HasValue && f.RatingTypeOid.Value.Equals(ratedValueListEntry.RatingTypeOid)); return rating?.DisplayName ?? "NULL"; } public ServiceRecordDC NewServiceRecord { get; set; } public long? ServiceRecordOidToDelete { get; set; } public bool ShowDistanceField { get; set; } public MainModel() { NewServiceRecord = new ServiceRecordDC(); ShowOnlyOwnSupportConcepts = true; ErrorWert = 1; } public IEnumerable SupportConceptListObjects { get { var allCostBearerRelations = new List {new CostBearer2SupportConceptRelListObject("Hilfeplan auswählen", "", "-1", false, false), new CostBearer2SupportConceptRelListObject("Ohne Hilfeplan", "", "-2", false, false) }; foreach(var sc in SupportConcepts.OrderBy(sc => sc.Customer.LastName)) { allCostBearerRelations.AddRange(sc.CostBearerRelations.Where(w => ShowExpiredSupportConcepts || w.EndDate is null || w.EndDate.Value >= DateTime.Now.Date).Select( cb => new CostBearer2SupportConceptRelListObject( $"{sc.Customer.SimpleDescription} {(sc.Customer.DateOfBirth.HasValue ? "*" + sc.Customer.DateOfBirth.Value.ToString("dd.MM.yyyy") : string.Empty)}", $"{cb.AuswahlBezeichnung} {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}{GetIsNotApproved(cb)}", cb.CostBearer2SupportConceptOid.ToString(), cb.SupportConcept.IsAboutToExpire, cb.SupportConcept.ExpiresIn3MonthOrLess)) ); } return allCostBearerRelations; } } public CostBearer2SupportConceptRelListObject SelectedCostBearer2SupportConceptRelListObject { get; set; } public List SelectedConceptCostBearerRelations { get; set; } public GroupBookingSelectionObject GroupBookingSelectionObject => new GroupBookingSelectionObject(SelectedConceptCostBearerRelations, GroupBookingSelectedGroupOfPeopleOids); public IEnumerable SupportConceptListObjectsForGroupBooking { get { var allCostbearerRelations = new List(); foreach(var sc in SupportConcepts.OrderBy(sc => sc.Customer.LastName)) { allCostbearerRelations.AddRange(sc.CostBearerRelations.Where(w => ShowExpiredSupportConcepts || w.EndDate is null || w.EndDate.Value >= DateTime.Now).Select( cb => new CostBearer2SupportConceptRelListObject( $"{sc.Customer.SimpleDescription} {(sc.Customer.DateOfBirth.HasValue ? "*" + sc.Customer.DateOfBirth.Value.ToString("dd.MM.yyyy") : string.Empty)}", $"{cb.AuswahlBezeichnung} {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}", cb.CostBearer2SupportConceptOid.ToString(), cb.SupportConcept.IsAboutToExpire, cb.SupportConcept.ExpiresIn3MonthOrLess)) ); } return allCostbearerRelations; } } public IEnumerable GroupOfPeopleListItems { get { return GroupsOfPeople.Select(group => new SelectListItem {Value = $"{group.GroupOfPeopleOid.Value}", Text = group.Name}).ToList(); } } public List Employees { get; set; } public List EmployeesForGroupAndMultiBooking { get; set; } public List AllEmployees { get; set; } [Display(Name = "Mitarbeiter")] public long? SelectedEmployeeOid => SelectedEmployee?.EmployeeOid; public CompactEmployeeDC SelectedEmployee { get; set; } public List GroupsOfPeople { get; set; } = new List(); public List GroupBookingSelectedGroupOfPeopleOids { get; set; } = new List(); public IEnumerable EmployeeListItems { get { var result = new List(); result.AddRange(Employees.Select(item => new SelectListItem {Value = item.EmployeeOid.ToString(), Text = $"{item.LastName}, {item.FirstName}", Selected = item.Equals(MobileSessionFacade.LoggedInCompactEmployee)}).OrderBy(s => s.Text).ToList()); return result; } } public ValueListEntryDC[] Dokutypes { get; set; } public int NumberOfDokuTypes => Dokutypes?.Length ?? 0; public static DateTime? GetEndDateOfSupportConcept(SupportConceptDC pSupportConcept) { DateTime? maxDate = null; foreach(var relation in pSupportConcept.CostBearerRelations) { var end = relation.ApprovedEndDate ?? relation.RequestedEndDate; if(maxDate == null || end != null && end.Value > maxDate.Value) { maxDate = end; } } return maxDate; } public List GroupBookingSelectedSupportConcepts { get; set; } = new List(); public List GroupBookingSelectedCostbearerRelOids { get; set; } = new List(); public List GroupBookingSelectedEmployees { get; set; } = new List(); [Display(Name = "Gruppenbuchung")] public bool IsInGroupBookingMode { get => _IsInGroupBookingMode; set { _IsInGroupBookingMode = value; if(!_IsInGroupBookingMode) { GroupBookingSelectedSupportConcepts?.Clear(); GroupBookingSelectedEmployees?.Clear(); } } } private bool _IsInGroupBookingMode; public bool IsInEditingMode { get; set; } public List GetServiceDesctiptions() { var result = new List(); foreach(var category2Descriptions in Categories2Descriptions) { result.AddRangeIfElementsNotIn(category2Descriptions.Value); } return result; } public bool IsServiceRecordNoticeMandatory { get; set; } = true; public CompactEmployeeDC PreviouslySelectedEmployee { get; set; } public SupportConceptDC PreviouslySelectedSupportConcept { get; set; } public long? PreviouslySelectedCostbearer2SupportConceptOid { get; set; } public bool IsEndDateVisible { get; set; } public static string GetServiceRecordTimeHeader(ServiceRecordDC serviceRecord, bool isForServiceRecordsList) { if (serviceRecord?.Start is null || serviceRecord.End is null) { return string.Empty; } var start = serviceRecord.Start.Value; var end = serviceRecord.End.Value; var gruppenInfo = string.Empty; var signatureToken = serviceRecord.SignatureOid.HasValue && isForServiceRecordsList ? "✔" : string.Empty; if(serviceRecord.GroupOid.HasValue) { gruppenInfo = $"Gruppe ({serviceRecord.GroupPersonCount} Teilnehmer, {serviceRecord.GroupEmployeeCount} Betreuer) Dauer: {(end - start).TotalMinutes} {signatureToken}"; } return $"{GetServiceRecordTimeString(serviceRecord)} {gruppenInfo} {signatureToken}"; } public static string GetServiceRecordTimeString(ServiceRecordDC serviceRecord) { if(serviceRecord?.Start is null || serviceRecord.End is null) { return string.Empty; } var start = serviceRecord.Start.Value; var end = serviceRecord.End.Value; //start.AddMinutes((int) serviceRecord.RoundedDuration), AB, 12.03.2025: Änderung vom 12.11.2024 rückgängig; Endzeit bleibt bei Gruppen- und Einzelbuchungen die tatäschliche Zeit - genau wie FAK if (start.Second == 0) { return start.Date != end.Date ? $"{start.ToShortDateString()} {start.ToShortTimeString()} - {end.ToShortDateString()} {end.ToShortTimeString()}" : $"{start.ToShortDateString()} {start.ToShortTimeString()} - {end.ToShortTimeString()}"; } return start.Date != end.Date ? $"{start.ToShortDateString()} - {end.ToShortDateString()}" : $"{start.ToShortDateString()}"; } public bool HasRightToEditServiceRecord(ServiceRecordDC serviceRecord) { var allowed = false; if(MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordView_Edit)) { allowed = true; } else if(MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowChangeWithin24Hours)) { if(serviceRecord.InsertedOn != null) { if(DateTime.Now < serviceRecord.InsertedOn.Value.AddDays(1)) { allowed = true; } } } if(allowed && ApplicationSettings.MaxDaysEditServiceRecordsAllowed > 0) { if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth)) { if(serviceRecord.Start != null) { var date = new DateTime(serviceRecord.Start.Value.Year, serviceRecord.Start.Value.Month, 1); date = date.AddMonths(1); date = date.AddDays(ApplicationSettings.MaxDaysEditServiceRecordsAllowed); if(DateTime.Now >= date) { allowed = false; } } } } if(allowed && !MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditForOtherEmployees)) { if(MobileSessionFacade.LoggedInEmployee.EmployeeOid != serviceRecord.Employee.EmployeeOid) { allowed = false; } } if(allowed && serviceRecord.GroupOid.HasValue) { if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowCreatingGroupBooking)) { allowed = false; } } if(allowed && ApplicationSettings.AnzTageZeiterfassErfolgt > 0) { if(!MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecordAllowEditAfterMindays)) { if(serviceRecord.Start != null) { var date = new DateTime(serviceRecord.Start.Value.Year, serviceRecord.Start.Value.Month, serviceRecord.Start.Value.Day); date = date.AddDays(ApplicationSettings.AnzTageZeiterfassErfolgt + 1); if(DateTime.Now >= date) { allowed = false; } } } } return allowed; } public bool IsZeiterfassungInStdMin => EinheitZeiterfassung == 2; public int EinheitZeiterfassung { get; set; } public string StartDateToEdit => SelectedServiceRecord?.Start?.ToShortDateString() ?? DateTime.Today.ToShortDateString(); public string EndDateToEdit => SelectedServiceRecord?.End?.ToShortDateString() ?? DateTime.Today.ToShortDateString(); public string StartTimeToEdit { get { var start = SelectedServiceRecord?.Start; if(start != null && !start.Value.GetServiceRecordNoDateTimeDate().Equals(start)) { return start.Value.ToString("HH:mm"); } return string.Empty; } } public string EndTimeToEdit { get { var end = SelectedServiceRecord?.End; if(end != null && end.Value.Second != 1) { return end.Value.ToString("HH:mm"); } return string.Empty; } } public string DurationToEdit { get { if(SelectedDurationUnit == "Stunden") { return SelectedServiceRecord is null ? string.Empty : (SelectedServiceRecord.RoundedDuration / 60).ToString(); } return SelectedServiceRecord?.RoundedDuration.ToString() ?? string.Empty; } } public string DistanceToEdit => SelectedServiceRecord?.DistanceInMeterDecimal.ToString() ?? string.Empty; public string NoticeToEdit => SelectedServiceRecord?.NoticeList.FirstOrDefault() ?? string.Empty; public List NoticeListToEdit => SelectedServiceRecord != null ? SelectedServiceRecord.NoticeList : new List {string.Empty, string.Empty, string.Empty, string.Empty, string.Empty}; public string SubmitButtonValue => IsInEditingMode || IsInGroupBookingMode ? "Speichern" : "Anlegen"; public long SelectedServiceRecordsServiceDescriptionOid => SelectedServiceRecord?.ServiceDescription?.ServiceDescriptionOid ?? 0L; public ServiceRecordDC GetServiceRecord(long serviceRecordOid) { return ServiceRecords.FirstOrDefault(serviceRecord => serviceRecord.ServiceRecordOid.Equals(serviceRecordOid)); } public List GoalRatingTypes { get; set; } = new List(); public ValueListEntryDC GetGoalByOid(long goalOid) { return SelectedSupportConcept?.Goals.FirstOrDefault(goal => goal.ValueListEntryOid == goalOid); } public bool HasAnyRatingTypes { get; set; } public List GoalTree { get; set; } = new List(); public List AllTextModules { get; set; } = new List(); public bool SetStartTimeToEndTimeAfterSave { get; set; } public DateTime? NewStartDate { get; set; } public string NewStartTime { get { var start = NewStartDate; if(start.HasValue && !start.Value.GetServiceRecordNoDateTimeDate().Equals(start)) { return start.Value.ToString("HH:mm"); } return string.Empty; } } public string NewStartDateStr => NewStartDate?.ToShortDateString(); public DateTime? NewEndDate { get; set; } public string NewEndTime { get { var start = NewEndDate; if(start != null && !start.Value.GetServiceRecordNoDateTimeDate().Equals(start)) { return start.Value.ToString("HH:mm"); } return string.Empty; } } public string NewEndDateStr => NewEndDate?.ToShortDateString(); public int? NewDuration { get { if(NewStartDate.HasValue && NewEndDate.HasValue) { return (int?) (NewEndDate.Value - NewStartDate.Value).TotalMinutes; } return null; } } public bool IsShowingDurationInHours { get; set; } public string SelectedDurationUnit => IsShowingDurationInHours ? "Stunden" : "Minuten"; public DateTime LastSelectedServiceRecordMonth { get; set; } public int LastSelectedServiceRecordTimeIntervalDays { get; set; } /// /// Zeitraum der Zeiterfassungseintragsliste (z.B. Alle, Letzte 7 Tage, etc.) /// public ServiceRecordTimeInterval ServiceRecordTimeInterval { get; set; } public int SelectedDayCount { get; set; } public NullableDateTimeSpan SelectedZeitraum { get; set; } public bool IsOnlyYearMonthVisible { get; set; } #region Mehrfachbuchung private bool _IsInMultiBookingMode; [Display(Name = "Mehrfachbuchung")] public bool IsInMultiBookingMode { get => _IsInMultiBookingMode; set { _IsInMultiBookingMode = value; if(!_IsInMultiBookingMode) { } } } public List MultiBookingSelectedSupportConcepts { get; set; } = new List(); public List MultiBookingSelectedGroupOfPeopleOids { get; set; } = new List(); public List MultiBookingSelectedConceptCostBearerRelations { get; set; } public GroupBookingSelectionObject MultiBookingSelectionObject => new GroupBookingSelectionObject(MultiBookingSelectedConceptCostBearerRelations, MultiBookingSelectedGroupOfPeopleOids); public List MultiBookingSelectedCostbearerRelOids { get; set; } = new List(); public List MultiBookingSelectedEmployees { get; set; } = new List(); public List MultiBookingSupportConceptListObjects { get { var allCostbearerRelations = new List(); foreach(var sc in SupportConcepts.OrderBy(sc => sc.Customer.LastName)) { allCostbearerRelations.AddRange(sc.CostBearerRelations.Where(w => ShowExpiredSupportConcepts || w.EndDate == null || w.EndDate.Value >= DateTime.Now).Select( cb => new CostBearer2SupportConceptRelListObject( $"{sc.Customer.SimpleDescription} {(sc.Customer.DateOfBirth.HasValue ? "*" + sc.Customer.DateOfBirth.Value.ToString("dd.MM.yyyy") : string.Empty)}", $"{cb.AuswahlBezeichnung} {cb.StartDate?.ToShortDateString().Remove(6, 2) ?? string.Empty}-{cb.EndDate?.ToShortDateString().Remove(6, 2) ?? string.Empty} {cb.CostBearer.Name}", cb.CostBearer2SupportConceptOid.ToString(), cb.SupportConcept.IsAboutToExpire, cb.SupportConcept.ExpiresIn3MonthOrLess)) ); } return allCostbearerRelations; } } #endregion public MandatorDC Mandator { get; set; } public bool IsPasswordSecurityEnabled { get; set; } public bool ShowMarker { get; set; } #region ServiceRecord-Pagination public int ServiceRecordCount { get; set; } public int CurrentPage { get; set; } public int MaxResults { get; set; } = 10; public int ServiceRecordPageCount { get; set; } #endregion public string OneTimeLink { get; set; } public string OneTimeLinkText { get; set; } public string ShareDetails { get; set; } public bool IsCustomerAbsence { get; set; } public string CustomerAbsenceInfo { get; set; } public Dictionary> ServiceRecordOids2GoalHeader { get; set; } public bool FilterGroupServiceCategories { get; set; } public Dictionary> Categories2Descriptions { get; set; } = new Dictionary>(); public ServiceCategoryDC SelectedServiceCategory { get; set; } public ServiceDescriptionDC SelectedServiceDescription { get; set; } public ServiceDescriptionDC GetSelectedOrFirstServiceDescription() { if(!(SelectedServiceDescription is null) || Categories2Descriptions is null) { return SelectedServiceDescription; } var firstServiceCategory2ServiceDescriptions = Categories2Descriptions.OrderBy(c2d => c2d.Key.Position).ThenBy(c2d => c2d.Key.ServiceCategoryOid).FirstOrDefault(c2d => c2d.Value.Any()); if(firstServiceCategory2ServiceDescriptions.Key != null && (firstServiceCategory2ServiceDescriptions.Value?.Any() ?? false)) { return firstServiceCategory2ServiceDescriptions.Value.OrderBy(sd => sd.Position).ThenBy(sd => sd.ServiceDescriptionOid).First(); } return SelectedServiceDescription; } public bool ShowBetrag { get; set; } } public class CustomSelectListItem { public string Text1 { get; } public string Text2 { get; } public string Value { get; } public string TextColor { get; } public long? SupportConceptOid { get; } public long? CostBearer2SupportConceptOid { get; } public CustomSelectListItem(string pText1, string pText2, string pValue, string pTextColor, long? supportConceptOid, long? costBearer2SupportConceptOid) { Text1 = pText1; Text2 = pText2; Value = pValue; TextColor = pTextColor; SupportConceptOid = supportConceptOid; CostBearer2SupportConceptOid = costBearer2SupportConceptOid; } } public class CostBearer2SupportConceptRelListObject { public string NameAndDateOfBirth { get; } public string SupportConceptTimeSpan { get; } public string CostBearer2SupportConceptOid { get; } public string CostBearer2SupportConceptOidName { get; } public bool IsAboutToExpire { get; } public bool ExpiresInThreeMonthsOrLess { get; } public CostBearer2SupportConceptRelListObject(string pNameAndDateOfBirth, string pSupportConceptTimeSpan, string pCostBearer2SupportConceptOid, bool isAboutToExpire, bool expiresIn3MonthOrLess) { NameAndDateOfBirth = pNameAndDateOfBirth; SupportConceptTimeSpan = pSupportConceptTimeSpan; CostBearer2SupportConceptOid = pCostBearer2SupportConceptOid; CostBearer2SupportConceptOidName = "OidHolder_" + CostBearer2SupportConceptOid; IsAboutToExpire = isAboutToExpire; ExpiresInThreeMonthsOrLess = expiresIn3MonthOrLess; } public override bool Equals(object obj) { if (!(obj is CostBearer2SupportConceptRelListObject)) { return false; } var obj2 = (CostBearer2SupportConceptRelListObject) obj; return Equals(CostBearer2SupportConceptOid, obj2.CostBearer2SupportConceptOid); } public override int GetHashCode() { unchecked { const int hashingBase = (int)2166136261; const int hashingMultiplier = 16777619; var hash = hashingBase; hash = (hash * hashingMultiplier) ^ (NameAndDateOfBirth?.GetHashCode() ?? 0); hash = (hash * hashingMultiplier) ^ (SupportConceptTimeSpan?.GetHashCode() ?? 0); hash = (hash * hashingMultiplier) ^ (CostBearer2SupportConceptOid?.GetHashCode() ?? 0); hash = (hash * hashingMultiplier) ^ IsAboutToExpire.GetHashCode(); hash = (hash * hashingMultiplier) ^ ExpiresInThreeMonthsOrLess.GetHashCode(); return hash; } } } }