Exemple #1
0
        /// <summary>
        /// Returns a RetirementHealthEnrollmentType which holds all transactions
        /// and is the only body element. Acts as transaction wrapper/list
        /// </summary>
        /// <param name="list"> The census enrollments to convert to transactions wrapped in
        /// RetirementHealthEnrollmentType</param>
        /// <returns>RetirementHealthEnrollmentType</returns>
        public static RetirementHealthEnrollmentType BuildBody(List <EnrollData> list)
        {
            RetirementHealthEnrollmentType retirementHealthEnrollmentType = new RetirementHealthEnrollmentType();
            List <TransactionType>         transactions = new List <TransactionType>();

            foreach (var item in list)
            {
                CensusRow        emp  = item.Rows.Where(row => row.RelationshipCode == "0").ToList()[0];
                List <CensusRow> deps = item.Rows.Where(row => row.RelationshipCode != "0").ToList();

                TransactionType transaction = BuildTransaction(emp, deps);
                PrettyPrintXML(SerializeToXmlDocument(transaction).OuterXml);
                transactions.Add(transaction);
            }

            retirementHealthEnrollmentType.Transaction = transactions.ToArray();
            return(retirementHealthEnrollmentType);
        }
Exemple #2
0
        private bool ShouldBeRemovedNew(CensusRow row)
        {
            if (cbNewTerm.Checked)
            {
                if (row.ElectionStatus == "Terminated")
                {
                    return(true);
                }
            }

            if (cbNewWaived.Checked)
            {
                if (row.ElectionStatus == "Waived")
                {
                    return(true);
                }
            }

            if (cbActiveOld.Checked)
            {
                if (row.ElectionStatus == "Waived")
                {
                    return(true);
                }
                else if (row.ElectionStatus == "Terminated")
                {
                    if (DateTime.Parse(row.EffectiveDate) <= dpActiveDateNew.Value)
                    {
                        return(true);
                    }
                }
                else
                {
                    if (DateTime.Parse(row.EffectiveDate) > dpActiveDateNew.Value)
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Exemple #3
0
        // Constructor
        public EnrollmentEntry(CensusRow row)
        {
            MyRow = row;
            if (row.RelationshipCode == "0")
            {
                this.SubscriberIndicator_INS01 = 'Y';
                EmploymentStatusCode_INS08     = "AC";
                SortOrder = 0;
            }
            else
            {
                this.SubscriberIndicator_INS01 = 'N';
                SortOrder = 1;
                if (row.Disabled == "Yes")
                {
                    Disability_INS10 = "Y";
                }
                else
                {
                    Disability_INS10 = "N";
                }
            }

            //if (Form1.INPUTFILE.Contains("Vis")) {
            // InsuranceLineCode_HD03 = "VIS";
            //} else InsuranceLineCode_HD03 = "DEN";

            //if(row.PlanType.Contains("Vis")){
            //    InsuranceLineCode_HD03 = "VIS";
            //    ReferenceNumber2_REF02 = "78910060AL6V0089002";
            //} else {
            //    InsuranceLineCode_HD03 = "DEN";
            //    ReferenceNumber2_REF02 = "78910003AL3V0181001";
            //}

            if (row.Dental != "FALSE" && string.IsNullOrEmpty(row.Dental) == false)
            {
                this.HasDental = true;
            }

            if (row.Vision != "FALSE" && string.IsNullOrEmpty(row.Vision) == false)
            {
                this.HasVision = true;
            }

            this.IndividualRelationshipCode_INS02 = this.RelationshipTranslation(row.RelationshipCode);
            this.BenefitStatusCode_INS05          = 'A';

            var memberSSN = (from record in Form1.Records
                             where record.EID == row.EID && record.RelationshipCode == "0"
                             select record.SSN).First().ToString().Replace("-", string.Empty);

            if (memberSSN != null && memberSSN != string.Empty)
            {
                // ReferenceNumber_REF02 = row.SSN.Replace("-", "");
                this.ReferenceNumber_REF02 = memberSSN;
            }
            else
            {
                // ReferenceNumber_REF02 = "         ";
                Form1.Log.Error("ERR: " + (++Form1.ErrorCounter) + "\tMissing SSN for the following:\n" + row.ToString());
            }

            //string memberDiv = (from record in Form1.Records
            //                    where record.EID == row.EID && record.RelationshipCode == "0"
            //                    select record.JobClass).First().ToString();

            //if (DivList0001.Contains(memberDiv)) {
            //    this.ReferenceNumberHumana_REF02 = "0001";
            //    Form1.Log.Info(row.FirstName + " " + row.LastName + "\t" + memberDiv + "\t" + row.JobClass);
            //} else {
            //    this.ReferenceNumberHumana_REF02 = "0002";
            //    Form1.Log.Info(row.FirstName + " " + row.LastName + "\t" + memberDiv + "\t" + row.JobClass);
            //}
            ReferenceNumberHumana_REF02 = row.JobClass;

            this.NameLast_NM103  = row.LastName;
            this.NameFirst_NM104 = row.FirstName;

            if (row.MiddleName.Length > 0)
            {
                this.NameInitial_NM105 = row.MiddleName.Substring(0, 1);
            }
            else
            {
                this.NameInitial_NM105 = string.Empty;
            }

            this.IdentificationCode_NM109           = row.SSN.Replace("-", string.Empty);
            this.CommunicationNumberQualifier_PER03 = "HP";

            if (row.PersonalPhone != null && row.PersonalPhone != string.Empty)
            {
                this.CommunicationNumber_PER04 = Regex.Replace(row.PersonalPhone, "[^0-9]", string.Empty);
            }

            this.CommunicationNumber_PER06  = row.Email;
            this.ResidenceAddressLine1_N301 = row.Address1;
            this.ResidenceAddressLine2_N302 = row.Address2;
            this.ResidenceCity_N401         = row.City;
            this.ResidenceState_N402        = this.GetStateByName(row.State);
            this.ResidenceZip_N403          = row.Zip;

            if (row.BirthDate != null && row.BirthDate != string.Empty)
            {
                this.DatetimePeriod_DMG02 = DateTime.Parse(row.BirthDate).ToString("yyyyMMdd");
            }

            if (row.Sex == "Male")
            {
                this.SexCode_DMG03 = SexCodes.Male;
            }
            else if (row.Sex == "Female")
            {
                this.SexCode_DMG03 = SexCodes.Female;
            }
            else
            {
                this.SexCode_DMG03 = SexCodes.Unknown;
            }

            this.MaritalStatusCode_DMG04 = this.MaritalTranslation(row.MaritalStatus);
            //this.CoverageLevelCode_HD05 = this.CoverageTranslation(row.CoverageDetails);

            if (row.Dental.ToUpper() == "DROP" || row.Vision.ToUpper() == "DROP")
            {
                this.DateTimePeriod_End_DTP03 = DateTime.Parse(row.EffectiveDate).AddDays(-1).ToString("yyyyMMdd");
            }

            if (row.EffectiveDate != null && row.EffectiveDate != string.Empty)
            {
                this.DateTimePeriod_Start_DTP03 = DateTime.Parse(row.EffectiveDate).ToString("yyyyMMdd");
            }

            if (SubscriberIndicator_INS01 == 'Y')
            {
                DateTimePeriod_Hire_DTP03 = DateTime.Parse(row.HireDate).ToString("yyyyMMdd");
            }


            //***********Just set it to 1/1/2020 for OE*********************************
            //DateTimePeriod_Start_DTP03 = "20200101";

            //if (row.Drop == "TRUE") {
            //    //this.DateTimePeriod_End_DTP03 = DateTime.Parse(row.PlanEffectiveEndDate).ToString("yyyyMMdd");
            //    this.DateTimePeriod_End_DTP03 = "20191231";
            //}

            //if(row.FamChange == "TRUE") {
            //    DateTimePeriod_FamChange = "20200101";
            //}
        }
Exemple #4
0
        /// <summary>
        /// Returns a transactions which holds the employee and depenedednt records
        /// </summary>
        /// <param name="emp">CensusRow of the Employee Info</param>
        /// <param name="deps">List of CensusRows that hold dependent data</param>
        /// <returns></returns>
        public static TransactionType BuildTransaction(CensusRow emp, List <CensusRow> deps)
        {
            TransactionType transactionType = new TransactionType();

            transactionType.TransactionType1 = HEALTHEVENTTYPE2;

            Guid guid = Guid.NewGuid();

            transactionIds.Add(new KeyValuePair <string, string>(emp.EID, guid.ToString()));
            transactionType.UniqueTransactionId       = guid.ToString();
            transactionType.RescindIndicator          = false;
            transactionType.RescindIndicatorSpecified = true;

            IdentifierType identifierType = new IdentifierType();

            if (!String.IsNullOrEmpty(emp.CalPERS_ID))
            {
                identifierType.ItemElementName = ItemChoiceType.CalPERSId;
                identifierType.Item            = emp.CalPERS_ID;
            }
            else
            {
                identifierType.ItemElementName = ItemChoiceType.SSN;
                if (emp.SSN != null)
                {
                    identifierType.Item = emp.CalPERS_ID;
                }
                else
                {
                    identifierType.Item = "";
                }
            }

            PersonInfoType personInfoType = new PersonInfoType();

            personInfoType.PersonId = identifierType;

            if (identifierType.ItemElementName == ItemChoiceType.SSN)
            {
                personInfoType.PersonIdType = IdentificationType.SocialSecurityNumber;
            }
            else
            {
                personInfoType.PersonIdType = IdentificationType.CalPERSIndetification;
            }

            personInfoType.FirstName  = emp.FirstName;
            personInfoType.MiddleName = emp.MiddleName;
            personInfoType.LastName   = emp.LastName;

            DateTime bDate;

            if (DateTime.TryParse(emp.BirthDate, out bDate))
            {
                personInfoType.BirthDate          = bDate;
                personInfoType.BirthDateSpecified = true;
            }
            else
            {
                personInfoType.BirthDateSpecified = false;
            }

            personInfoType.Gender = emp.Gender.Substring(0, 1);
            AddressInfoType addressInfoType = new AddressInfoType();

            addressInfoType.AddressType = AddressType.PhysicalAddress;
            addressInfoType.AddressLine = new string[] { emp.Address1.Trim(), emp.Address2.Trim() };
            addressInfoType.City        = emp.City;

            if (emp.State == "California")
            {
                addressInfoType.State = StateCode.California;
            }

            addressInfoType.ZipCode5 = emp.Zip;
            addressInfoType.Country  = CountryCodes.UnitedStates;

            TransactionTypeDemographics transactionTypeDemographics = new TransactionTypeDemographics();

            transactionTypeDemographics.PersonInfo  = personInfoType;
            transactionTypeDemographics.AddressInfo = addressInfoType;
            transactionType.Demographics            = transactionTypeDemographics;

            TransactionTypeAppointment transactionTypeAppointment = new TransactionTypeAppointment();

            EmployerInfoType employerInfoType = new EmployerInfoType();

            employerInfoType.EmployerCalPERSId      = school.CalPERSID;
            employerInfoType.County                 = CountyCodes.SantaClara;//hard coded for campbell
            transactionTypeAppointment.EmployerInfo = employerInfoType;


            //TODO: MISSING CBU (Collective Bargaining Unit) codes.
            //The collective bargaining unit (CBU) the employee is associated with.
            EmploymentInfoType employmentInfo = new EmploymentInfoType();
            //employmentInfo.CBU = "R03";
            CollectiveBargainingUnit cbu = CollectiveBargainingUnits.GetCollectiveBargainingUnit(emp);

            employmentInfo.CBU = cbu.GroupNumber;
            transactionTypeAppointment.EmploymentInfo = employmentInfo;

            transactionTypeAppointment.JobPositionInfo = new JobPositionInfoType(); //leave empty?
            transactionType.Appointment = transactionTypeAppointment;

            TransactionTypeHealthEnrollment transactionTypeHealthEnrollment = new TransactionTypeHealthEnrollment();

            transactionTypeHealthEnrollment.HealthEventReason = HEALTHEVENTREASON.CodeValue.ToString();

            transactionTypeHealthEnrollment.EventDateSpecified = true;//Docs say turn off for OE,
            //ignore that. Needed
            transactionTypeHealthEnrollment.ReceivedDateSpecified = true;
            if (emp.E_SignDate != null && emp.E_SignDate != "")
            {
                transactionTypeHealthEnrollment.ReceivedDate = DateTime.Parse(emp.E_SignDate);
                transactionTypeHealthEnrollment.EventDate    = DateTime.Parse(emp.E_SignDate);
            }
            else
            {
                transactionTypeHealthEnrollment.ReceivedDate = DateTime.Parse("10/3/2019");
                transactionTypeHealthEnrollment.EventDate    = DateTime.Parse("10/3/2019");
            }

            SubscriberInfoType subscriberInfoType = new SubscriberInfoType();

            subscriberInfoType.ApplyChangeToMedicalPlan = true;
            subscriberInfoType.ApplyChangeToDentalPlan  = false;
            subscriberInfoType.ApplyChangeToVisionPlan  = false;

            //hard coded as Employer zip
            var heInfoTempList = HEinfoList.Where(e => e.CalPERS_ID == emp.CalPERS_ID).ToList();

            if (heInfoTempList != null && heInfoTempList.Count != 0) //if they are in list with a pervious choosen type
            {
                HEInfo heiTemp = heInfoTempList.First();
                if (heiTemp.HEType == "Employer Address") //if they choose employer
                {
                    subscriberInfoType.HealthEligibilityZipCodeType = HealthEligibilityZipCodeTypes.EmployerAddress;
                    subscriberInfoType.HealthEligibilityZipCode     = heiTemp.HEZip;          //already set, so use it instead of hardcoding
                    subscriberInfoType.HealthEligibilityCounty      = CountyCodes.SantaClara; //all schools in same county... right...?
                }
                else                                                                          //this is either physical or mailing. Doesn't matter.
                {
                    subscriberInfoType.HealthEligibilityZipCodeType = HealthEligibilityZipCodeTypes.PersonalAddress;
                    subscriberInfoType.HealthEligibilityZipCode     = emp.Zip;
                    if (String.IsNullOrEmpty(emp.County))
                    {
                        if (String.IsNullOrEmpty(emp.Zip))
                        {
                            subscriberInfoType.HealthEligibilityCounty = CountyCodes.SantaClara;
                        }
                        else
                        {
                            subscriberInfoType.HealthEligibilityCounty = ZipAndCounties.GetCountyCode(emp.Zip);
                        }
                    }
                    else
                    {
                        subscriberInfoType.HealthEligibilityCounty = ZipAndCounties.GetCountyCodeByName(emp.County);
                    }
                }
            }
            else    //the have not previously choosen an eligibility type, default to personal
            {
                subscriberInfoType.HealthEligibilityZipCodeType = HealthEligibilityZipCodeTypes.PersonalAddress;
                subscriberInfoType.HealthEligibilityZipCode     = emp.Zip;
                if (String.IsNullOrEmpty(emp.County))
                {
                    if (String.IsNullOrEmpty(emp.Zip))
                    {
                        subscriberInfoType.HealthEligibilityCounty = CountyCodes.SantaClara;
                    }
                    else
                    {
                        subscriberInfoType.HealthEligibilityCounty = ZipAndCounties.GetCountyCode(emp.Zip);
                    }
                }
                else
                {
                    subscriberInfoType.HealthEligibilityCounty = ZipAndCounties.GetCountyCodeByName(emp.County);
                }
                //subscriberInfoType.HealthEligibilityCounty = ZipAndCounties.GetCountyCodeByName(emp.County);
            }

            try {
                subscriberInfoType.MedicalPlanSelection = MedicalPlanCodes.Plans.Where(
                    c => c.EaseID == emp.PlanImportID).First().PlanCode;
            } catch (InvalidOperationException ioe) {
                log.Error(ioe.Message);
                gui.UpdateStatus("Unmatched Medical Plan for " + emp.PlanImportID);
                transactionType = null;
                return(transactionType);
            }

            transactionTypeHealthEnrollment.SubscriberInfo = subscriberInfoType;
            transactionType.HealthEnrollment = transactionTypeHealthEnrollment;

            List <DependentInfoType> dependents = new List <DependentInfoType>();

            foreach (CensusRow depRow in deps)
            {
                DependentInfoType       dep          = new DependentInfoType();
                DependentPersonInfoType depInfo      = new DependentPersonInfoType();
                IdentifierType          depInfoIdent = new IdentifierType();

                depInfo.FirstName = depRow.FirstName;
                depInfo.LastName  = depRow.LastName;
                depInfo.BirthDate = DateTime.Parse(depRow.BirthDate);

                string tempDepKey = depInfo.FirstName.Substring(0, 1) +
                                    depInfo.LastName.Substring(0, 1) +
                                    depInfo.BirthDate.ToString("MMddyyyy");

                var tempCID = cidList.Where(d => d.GetDepKey() == tempDepKey).
                              ToList();


                if (tempCID.Count == 1)
                {
                    String tempCIDStr = tempCID.First().CalPERSID;
                    depInfoIdent.ItemElementName = ItemChoiceType.CalPERSId;
                    depInfoIdent.Item            = tempCIDStr;
                    depInfo.PersonId             = depInfoIdent;
                    depInfo.PersonIdType         = IdentificationType.CalPERSIndetification;
                }
                else
                {
                    depInfoIdent.ItemElementName = ItemChoiceType.SSN;
                    depInfoIdent.Item            = depRow.SSN;
                    depInfo.PersonId             = depInfoIdent;
                    depInfo.PersonIdType         = IdentificationType.SocialSecurityNumber;
                }

                if (depRow.Gender == null || depRow.Gender == "")
                {
                    depInfo.Gender = Gender.Unknown;
                }
                else
                {
                    depInfo.Gender = depRow.Gender.Substring(0, 1);
                }

                dep.DependentPersonInfo = depInfo;
                dep.Relationship        = GetCalPERSRelationship(depRow.Relationship);

                if (depRow.MaritalDate != null && depRow.MaritalDate != "")
                {
                    dep.DateOfPartnership = DateTime.Parse(depRow.MaritalDate);
                }

                dep.AddressSameAsPrimarySubscriber = true;
                dep.DependentType       = GetCalPERSDependentType(depRow.Relationship);
                dep.DisabilityIndicator = false;
                dep.ApplyToMedical      = true;
                dep.ApplyToDental       = false;
                dep.ApplyToVision       = false;

                if (depRow.Disabled is null || depRow.Disabled == "")
                {
                    dep.DisabilityConfirmIndicator = false;
                }
    public bool Compare(CensusRow rhs)
    {
        bool matched = true;

        if (this.Changes == null)
        {
            this.Changes = string.Empty;
        }

        if (rhs.Changes == null)
        {
            rhs.Changes = string.Empty;
        }

        if (this.ToString() != rhs.ToString())
        {
            matched = false;
            if (this.SSN != rhs.SSN)
            {
                rhs.Changes = this.Changes = this.Changes + "|SSN|";
            }
            if (this.Address1 != rhs.Address1)
            {
                rhs.Changes = this.Changes = this.Changes + "|Address1|";
            }
            if (this.Address2 != rhs.Address2)
            {
                rhs.Changes = this.Changes = this.Changes + "|Address2|";
            }
            if (this.City != rhs.City)
            {
                rhs.Changes = this.Changes = this.Changes + "|City|";
            }
            if (this.State != rhs.State)
            {
                rhs.Changes = this.Changes = this.Changes + "|State|";
            }
            if (this.Zip != rhs.Zip)
            {
                rhs.Changes = this.Changes = this.Changes + "|Zip|";
            }
            if (this.PersonalPhone != rhs.PersonalPhone)
            {
                rhs.Changes = this.Changes = this.Changes + "|PersonalPhone|";
            }
            if (this.WorkPhone != rhs.WorkPhone)
            {
                rhs.Changes = this.Changes = this.Changes + "|WorkPhone|";
            }
            if (this.MobilePhone != rhs.MobilePhone)
            {
                rhs.Changes = this.Changes = this.Changes + "|MobilePhone|";
            }
            if (this.EmployeeStatus != rhs.EmployeeStatus)
            {
                rhs.Changes = this.Changes = this.Changes + "|EmployeeStatus|";
            }
            if (this.HireDate != rhs.HireDate)
            {
                rhs.Changes = this.Changes = this.Changes + "|HireDate|";
            }
            if (this.TerminationDate != rhs.TerminationDate)
            {
                rhs.Changes = this.Changes = this.Changes + "|TerminationDate|";
            }
            if (this.JobClass != rhs.JobClass)
            {
                rhs.Changes = this.Changes = this.Changes + "|JobClass|";
            }
            if (this.Division != rhs.Division)
            {
                rhs.Changes = this.Changes = this.Changes + "|Division|";
            }
            if (this.MaritalStatus != rhs.MaritalStatus)
            {
                rhs.Changes = this.Changes = this.Changes + "|MaritalStatus|";
            }
            if (this.ScheduledHours != rhs.ScheduledHours)
            {
                rhs.Changes = this.Changes = this.Changes + "|ScheduledHours|";
            }
            if (this.PayCycle != rhs.PayCycle)
            {
                rhs.Changes = this.Changes = this.Changes + "|PayCycle|";
            }
            if (this.PlanDisplayName != rhs.PlanDisplayName)
            {
                rhs.Changes = this.Changes = this.Changes + "|PlanDisplayName|";
            }
            if (this.CoverageDetails != rhs.CoverageDetails)
            {
                rhs.Changes = this.Changes = this.Changes + "|CoverageDetails|";
            }
            if (this.EffectiveDate != rhs.EffectiveDate)
            {
                rhs.Changes = this.Changes = this.Changes + "|EffectiveDate|";
            }
            if (this.ElectionStatus != rhs.ElectionStatus)
            {
                rhs.Changes = this.Changes = this.Changes + "|ElectionStatus|";
            }
            if (this.TotalRate != rhs.TotalRate)
            {
                rhs.Changes = this.Changes = this.Changes + "|TotalRate|";
            }
            if (this.EmployeeCostPerDeductionPeriod != rhs.EmployeeCostPerDeductionPeriod)
            {
                rhs.Changes = this.Changes = this.Changes + "|EmployeeCostPerDeductionPeriod|";
            }
            if (this.ESignDate != rhs.ESignDate)
            {
                rhs.Changes = this.Changes = this.Changes + "|ESignDate|";
            }

            rhs.Changes = rhs.Changes.Replace("||", "|").Trim();
            if (rhs.Changes.StartsWith("|"))
            {
                rhs.Changes = rhs.Changes.Substring(1);
            }

            if (rhs.Changes.EndsWith("|"))
            {
                rhs.Changes = rhs.Changes.Substring(0, rhs.Changes.Length - 1);
            }
        }

        return(matched);
    }