private void lvManageRecord_SelectedIndexChanged(object sender, EventArgs e) { if (lvManageRecord.SelectedItems.Count > 0) { lbPaid.Visible = false; btnPay.Enabled = true; btnPay.Text = "Pay"; lbPaid.Text = "PAID( OR # "; orderOfPaymentID = int.Parse(lvManageRecord.SelectedItems[0].SubItems[0].Text); string query = "SELECT AcctCode, Particular, Amount FROM tbl_PayOrder_Details WHERE OPSeqNo = '" + orderOfPaymentID + "'"; new clsDB().Con().FillLvw(listView1, query); Dictionary <string, string> data = new Dictionary <string, string>(); new clsDB().Con().SelectDataDictionary("SELECT DISTINCT OP.SemNO , OP.Payor as Payor,OP.DateIssued FROM tbl_PayOrder as OP LEFT JOIN Student_Account as SA ON OP.StudID = SA.StudID LEFT JOIN Student as S ON S.StudID = OP.StudID WHERE OP.OPNo = " + orderOfPaymentID, data); //new clsDB().Con().SelectDataDictionary("SELECT * FROM Student_Account as SA JOIN student as S on SA.StudID = S.StudID JOIN tbl_PayOrder as OP ON SA.StudID = OP.StudID WHERE OP.OPNo = "+ orderOfPaymentID , data); lbFName.Text = data["Payor"]; DateTime dt = DateTime.Parse(data["DateIssued"]); lbDate.Text = dt.ToShortDateString(); OrderOfPayment OP = new OrderOfPayment(); if (OP.hasORNumber(orderOfPaymentID)) { btnPay.Enabled = false; btnPay.Text = "PAID"; lbPaid.Visible = true; lbPaid.Text += OP.ORNumber.ToString() + ")"; } // Compute Total float[] total = Payor.computeAccount(listView1); temp = total[0] + total[1]; lbTotal.Text = "Total = " + Convert.ToString(temp); lbTuition.Text = "Tuition = " + Convert.ToString(total[0]); lbMsc.Text = "Msc = " + Convert.ToString(total[1]); listView1.Visible = true; } }
/// <summary> /// Initializes a new instance of the <see cref="PayorCoverage"/> class. /// </summary> /// <param name="payor">The payor.</param> /// <param name="payorSubscriber">The payor subscriber.</param> /// <param name="memberNumber">The member number.</param> /// <param name="effectiveCoverageDateRange">The effective coverage date range.</param> /// <param name="payorCoverageType">Type of the payor coverage.</param> public PayorCoverage(Payor payor, PayorSubscriber payorSubscriber, string memberNumber, DateRange effectiveCoverageDateRange, PayorCoverageType payorCoverageType) { Check.IsNotNull(payor, () => Payor); Check.IsNotNull(payorSubscriber, () => PayorSubscriber); Check.IsNotNull(memberNumber, () => MemberNumber); Check.IsNotNull(effectiveCoverageDateRange, () => EffectiveCoverageDateRange); Check.IsNotNull(payorCoverageType, () => PayorCoverageType); Payor = payor; MemberNumber = memberNumber; EffectiveCoverageDateRange = effectiveCoverageDateRange; PayorSubscriber = payorSubscriber; PayorCoverageType = payorCoverageType; }
private void btnSave_Click(object sender, EventArgs e) { if (listView1.CheckedItems.Count > 0) { checkedItems = Payor.getCheckedItems(listView1); Close(); } else { MessageBox.Show("Please Select a particular"); } }
/// <summary> /// Initializes a new instance of the <see cref="Claim"/> class. /// </summary> /// <param name="encounter">The encounter.</param> /// <param name="payor">The payor.</param> /// <param name="chargeAmount">The charge amount.</param> /// <param name="patientAccount">The patient account.</param> /// <param name="placeOfService">The place of service.</param> /// <param name="serviceDate">The service date.</param> public Claim(Encounter encounter, Payor payor, Money chargeAmount, PatientAccount patientAccount, Location placeOfService, DateTime serviceDate) : this() { Check.IsNotNull(encounter, () => Encounter); Check.IsNotNull(payor, () => Payor); Check.IsNotNull(chargeAmount, () => ChargeAmount); Check.IsNotNull(patientAccount, () => PatientAccount); Check.IsNotNull(placeOfService, () => ServiceLocation); Check.IsNotNull(serviceDate, () => ServiceDate); Encounter = encounter; Payor = payor; ChargeAmount = chargeAmount; PatientAccount = patientAccount; ServiceLocation = placeOfService; ServiceDate = serviceDate; }
/// <summary> /// Processes the single aggregate. /// </summary> /// <param name="dto">The dto.</param> /// <param name="payor">The payor.</param> /// <returns>A <see cref="System.Boolean"/></returns> protected override bool ProcessSingleAggregate(PayorProfileDto dto, Payor payor) { payor.ReviseName(dto.Name); if (dto.EffectiveDate == null && dto.EndDate == null) { payor.ReviseEffectiveDateRange(null); } else { payor.ReviseEffectiveDateRange(new DateRange(dto.EffectiveDate, dto.EndDate)); } payor.ReviseEmailAddress(string.IsNullOrEmpty(dto.EmailAddress) ? null : new EmailAddress(dto.EmailAddress)); payor.RevisePayorIdentifier(dto.PayorIdentifier); if (dto.PayorTypes != null) { foreach (var payorTypeMember in payor.PayorTypeMembers) { var found = dto.PayorTypes.Any(m => payorTypeMember.PayorType.Key == m.Key); if (!found) { //remove it payor.RemovePayorTypeMember(payorTypeMember); } } foreach (var payorTypeMember in dto.PayorTypes) { var found = payor.PayorTypeMembers.Any(m => payorTypeMember.Key == m.PayorType.Key); if (!found) { //get the type and add it var payorType = _payorTypeRepository.GetByKey(payorTypeMember.Key); payor.AddPayorTypeMember(payorType); } } payor.RevisePrimaryPayorTypeMember( dto.PrimaryPayorType == null ? null : _payorTypeRepository.GetByKey(dto.PrimaryPayorType.Key)); } return(true); }
private void btnDelete_Click(object sender, EventArgs e) { try { new clsDB().Con().listViewRemoveSelectedIndex(lvDataEntryOP); float[] account = Payor.computeAccount(lvDataEntryOP); lbTotal.Text = Convert.ToString(account[1]); tAmount.Text = Convert.ToString(account[1]); lvDataEntryOP.Items[lvDataEntryOP.Items.Count - 1].Focused = true; lvDataEntryOP.Items[lvDataEntryOP.Items.Count - 1].Selected = true; } catch (Exception ex) { // Test } }
// # -------------------- DBACTIONS --------------------------- private void addPayment() { if (lvManageRecord.CheckedItems.Count < 1) { frmOrPayDataEntry.show_asAdd(new MsgHandler(RefreshData)); } else { // instantiate an object of student Student st = new Student(lvManageRecord.CheckedItems[0].SubItems[1].Text); // pass values to form frmOrPayDataEntry.checkedItems = Payor.getCheckedItems(lvManageRecord); frmOrPayDataEntry.studentData = st.studentData; frmOrPayDataEntry.show_asAdd(new MsgHandler(RefreshData)); } }
private void btnAddParticular_Click(object sender, EventArgs e) { frmParticulars f = new frmParticulars(); f.ShowDialog(); string[][] data = f.checkedItems; string[] col = new string[f.listView1.Columns.Count]; if (f.listView1.CheckedItems.Count > 0) { for (int i = 0; i < f.listView1.Columns.Count; i++) { col[i] = f.listView1.Columns[i].Text; } try { if (new clsDB().Con().listViewTransferData(data, lvDataEntryOP, col)) { f.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } try { float[] account = Payor.computeAccount(lvDataEntryOP); lbTotal.Text = Convert.ToString(account[1]); tAmount.Text = Convert.ToString(account[1]); } catch (Exception ex) { lvDataEntryOP.Items.Clear(); MessageBox.Show("Particular Has no Amount"); } } }
private void textBox1_TextChanged(object sender, EventArgs e) { string semNo = tbSemNo.Text; isFullPayment = rbtnFull.Checked; if (int.Parse(semNo) == 0) { MessageBox.Show("No Record Found", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } semNo = (!String.IsNullOrEmpty(tbSemNo.Text.Trim())) ? semNo : "" + 0; new clsDB().Con().FillLvw(listView1, StudentAccount.searchBySemester(semNo, studentData[0])); // for Payment summary float[] accountData = null; accountData = Payor.computeAccount(listView1); float tuitionFee = accountData[0]; float mscFee = accountData[1]; // Compute Tuition Fee Based on payment type tuitionFee = (isFullPayment) ? tuitionFee : tuitionFee / 2; lbTuitionFee.Text = "" + tuitionFee; lbMscFee.Text = "" + mscFee; // Total float total = tuitionFee + mscFee; lbTotal.Text = "" + total; tAmount.Text = "" + total; new clsDB().Con().checkAllListView(listView1); }
private void AddPayorAddress(PayorAddressDto payorAddressDto, Payor payor) { var addressType = _mappingHelper.MapLookupField <PayorAddressType> (payorAddressDto.PayorAddressType); var countyAreaLookup = _mappingHelper.MapLookupField <CountyArea> (payorAddressDto.CountyArea); var stateProvinceLookup = _mappingHelper.MapLookupField <StateProvince> (payorAddressDto.StateProvince); var countryLookup = _mappingHelper.MapLookupField <Country> (payorAddressDto.Country); var address = new AddressBuilder() .WithFirstStreetAddress(payorAddressDto.FirstStreetAddress) .WithSecondStreetAddress(payorAddressDto.SecondStreetAddress) .WithCityName(payorAddressDto.CityName) .WithCountyArea(countyAreaLookup) .WithStateProvince(stateProvinceLookup) .WithCountry(countryLookup) .WithPostalCode( string.IsNullOrWhiteSpace(payorAddressDto.PostalCode) ? null : new PostalCode(payorAddressDto.PostalCode)) .Build(); var payorAddress = new PayorAddress(addressType, address); payor.AddPayorAddress(payorAddress); }
private static void RemovePayorPhone( PayorPhoneDto payorPhoneDto, Payor payor, PayorPhone payorPhone) { payor.RemovePayorPhoneNumber(payorPhone); }
private void btnSave_Click(object sender, EventArgs e) { if (lvDataEntryOP.Items.Count > 0) { double total = double.Parse(lbTotal.Text); if (total > 0 && (!string.IsNullOrEmpty(tbFirstname.Text) && !string.IsNullOrEmpty(tbLastname.Text))) { OrderOfPayment OP = null; StudentAccount SAccount = new StudentAccount(); Dictionary <string, float> amountPerParticular = SAccount.getAmountPerParticular(lvDataEntryOP, 2); string payor = tbFirstname.Text.Replace("'", "''") + " " + tbMiddlename.Text + " " + tbLastname.Text; int orderOfPaymentType = 0; try { orderOfPaymentType = int.Parse((mrbUndergrad.Checked) ? mrbUndergrad.Tag.ToString() : (mrbMasteral.Checked) ? mrbMasteral.Tag.ToString() : (mrbFiduciary.Checked) ? mrbFiduciary.Tag.ToString() : (mrbBtr.Checked) ? mrbBtr.Tag.ToString() : (mrbIGD.Checked) ? mrbIGD.Tag.ToString() : "0"); paymentType = (mtrbCash.Checked) ? mtrbCash.Tag.ToString() : (mtrbCheck.Checked) ? mtrbCheck.Tag.ToString() : "0"; } catch (Exception ex) { MessageBox.Show(ex.Message); } // check payment type // check if has student ID int studentID = 0; if (lbStudID.Text != "[ Student ID ]") { studentID = int.Parse(lbStudID.Text); } string purpose = "Other Fees"; // Purpose if (isTuitionFee) { purpose = "Tuition Fee/Misc"; } // has check details if (Payor.validateCheckDetails(mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), mtbCheckAmount.Text) && mtrbCheck.Checked) { OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), purpose, payor, studentID, tbRemarks.Text, mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), float.Parse(mtbCheckAmount.Text), orderOfPaymentType); } else if (mtrbCash.Checked) { OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), purpose, payor, studentID, tbRemarks.Text, null, null, null, 0, orderOfPaymentType); } else { MessageBox.Show("There are some fields missing!"); } // final validation if (OP != null) { if (OP.createOP()) { OP.addOPItem(int.Parse(tPaymentOrNo.Text), amountPerParticular, orderOfPaymentType); MessageBox.Show("Successful! \n \t Please Proceed to Payment"); Dictionary <string, string> OPData = OP.getOPDataWOOR(int.Parse(tPaymentOrNo.Text)); ePrinting print = new ePrinting(OPData); print.ePrint("OP"); this.hasUpdated = true; this.lastOPNumber = int.Parse(tPaymentOrNo.Text); this.Dispose(); // frmOrPayDataEntry temp = new frmOrPayDataEntry(this.lastOPNumber++); //temp.ShowDialog(); } } } else { MessageBox.Show("Invalid Input / Missing Field"); } } else { MessageBox.Show("Please add an item"); } }
private void ChangePayorPhone( PayorPhoneDto payorPhoneDto, Payor payor, PayorPhone payorPhone) { RemovePayorPhone(payorPhoneDto, payor, payorPhone); AddPayorPhone(payorPhoneDto, payor); }
public void NextVisitor(Visitor visitor) { if (_currentSession == null) { RemoveVisitor(visitor); return; } if (!_drugSaved) { var result = MessageBox.Show("Lưu lại toa thuốc hiện tại?", "Nhắc lưu", MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Yes) { SaveDrugs(); } else if (result == MessageBoxResult.Cancel) { return; } } _currentSession.TotalCost = 0; _currentSession.ServiceCost = 0; var services = _esClinicContext.Services.Include("ServiceType").ToList().Where(s => s.SessionId == _currentSession.SessionId); foreach (var service in services) { if (service.IsChecked) { _currentSession.ServiceCost += service.ServiceType.Price; } } var surchanges = _esClinicContext.Surcharges.ToList(); foreach (var surcharge in surchanges) { TotalCost += surcharge.Price; } _currentSession.TotalCost = TotalCost + _currentSession.ServiceCost; _currentSession.Stage = ClinicStage.WaitToPay; var newPayor = new Payor { SessionId = _currentSession.SessionId, Name = _currentVisitor.Patient.Name, Session = _currentSession }; _esClinicContext.Payors.Add(newPayor); _esClinicContext.Entry(_currentVisitor).State = EntityState.Deleted; _esClinicContext.Entry(_currentSession).State = EntityState.Modified; _esClinicContext.SaveChanges(); TotalCost = 0; RefreshVisitors(); _currentVisitor = null; _currentSession = null; Sessions.Clear(); EsRecords.Clear(); Services.Clear(); Drugs.Clear(); }
private void btnAddParticular_Click_1(object sender, EventArgs e) { string particular = ""; string query = "Select AssessmentID, AssessmentName, ISNULL(Amount,0) from assessment WHERE AssessmentName = '"; if (cmbParticular.SelectedIndex > -1) { particular = cmbParticular.SelectedItem.ToString(); } else { particular = cmbParticular.Text; } try { if (!string.IsNullOrEmpty(particular)) { int count = new clsDB().Con().countRecord(query + particular + "'"); string[] column = { "No", "Particulars", "Amount" }; string[][] data = new string[count][]; string[] obj = new string[3]; bool hasAmount = false; // if has record in the database - get data for transfer if (count > 0) { if (new clsDB().Con().SelectData(query + particular + "'", obj)) { data[0] = obj; // check if the amount is zero and ask for input if (float.Parse(data[0][2]) >= 0 || data[0][1] == "Tuition Fee") { frmParticularAmountDataEntry f = new frmParticularAmountDataEntry(int.Parse(data[0][0])); // FLAG for TUITION FEE if (data[0][1] == "Tuition Fee") { f.isTuitionFee = true; isTuitionFee = true; } f.ShowDialog(); data[0][2] = Convert.ToString(f.amount); hasAmount = f.hasAmount; } else { hasAmount = true; } if (hasAmount && new clsDB().Con().listViewTransferData(data, lvDataEntryOP, column)) { float[] account = Payor.computeAccount(lvDataEntryOP); // Set TEMPORARY FIX for TUITION PAYMENT - G lbTotal.Text = Convert.ToString(account[0] + account[1]); tAmount.Text = Convert.ToString(account[0] + account[1]); /** * lbTotal.Text = Convert.ToString(account[1]); * tAmount.Text = Convert.ToString(account[1]); */ } } } else { pNewParticular.Visible = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { // instantiate student object try { if (!Helper.strIsEmpty(tAmount.Text, true)) { Student st = new Student(listView1.Items[0].SubItems[1].Text); string course = st.course(); // temporary conditioning to check if a student is masteral or undergrad int OPType = (course.StartsWith("B")) ? 2 : 3; Dictionary <string, float> amountPerParticular = SAccount.getAmountPerParticular(listView1, 3, "tuition/msc"); if (amountPerParticular["Tuition Fee"] > 0 && amountPerParticular["Tuition Fee"] > float.Parse(tAmount.Text)) { amountPerParticular["Tuition Fee"] = float.Parse(tAmount.Text) - float.Parse(lbMscFee.Text); } // validation bool isValid = false; string paymentType = (isFullPayment) ? "full" : "partial"; bool isCheck = false; if (mtrbCheck.Checked) { isCheck = true; } else if (mtrbCash.Checked) { isCheck = false; } // check if NSTP is selected string NSTP = (mtrbCWTS.Checked) ? mtrbCWTS.Text : (mtrbROTC.Checked) ? mtrbROTC.Text : null; if (string.IsNullOrEmpty(NSTP) && hasNSTP) { isValid = false; MessageBox.Show("Please select NSTP Type"); return; } isValid = StudentAccount.validateAmout(paymentType, float.Parse(lbTotal.Text), float.Parse(tAmount.Text), float.Parse(lbTuitionFee.Text), float.Parse(lbMscFee.Text), isCheck); if (isValid) { // ---------------- FINAL PROCEDURE ------------------- if (isValid) { OrderOfPayment OP = null; if (Payor.validateCheckDetails(mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), mtbCheckAmount.Text) && mtrbCheck.Checked) { OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), "Tuition Fee/Misc", studentData[3] + ' ' + studentData[4] + ' ' + studentData[2], int.Parse(studentData[0]), "", mtbBankName.Text, mtbCheckNo.Text, mtdCheckDate.Value.ToShortDateString(), float.Parse(mtbCheckAmount.Text)); } else if (mtrbCash.Checked) { OP = new OrderOfPayment(float.Parse(tAmount.Text), int.Parse(tPaymentOrNo.Text), dtOrDate.Value.ToShortDateString(), "Tuition Fee/Misc", studentData[3] + ' ' + studentData[4] + ' ' + studentData[2], int.Parse(studentData[0])); } else { MessageBox.Show("There are some fields missing!"); } // validated if (OP != null) { if (OP.createOP()) { OP.addOPItem(int.Parse(tPaymentOrNo.Text), amountPerParticular, OPType, NSTP); MessageBox.Show("Successful! \n \t Please Proceed to Payment"); Dictionary <string, string> OPData = OP.getOPDataWOOR(int.Parse(tPaymentOrNo.Text)); ePrinting print = new ePrinting(OPData); print.ePrint("OP"); Close(); } } } } } else { MessageBox.Show("Please select "); } } catch (Exception ex) { MessageBox.Show("There are some fields missing", "", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Coverage; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.FinancialResourceStatusCodes>)StatusElement.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (PolicyHolder != null) { dest.PolicyHolder = (Hl7.Fhir.Model.ResourceReference)PolicyHolder.DeepCopy(); } if (Subscriber != null) { dest.Subscriber = (Hl7.Fhir.Model.ResourceReference)Subscriber.DeepCopy(); } if (SubscriberId != null) { dest.SubscriberId = (Hl7.Fhir.Model.Identifier)SubscriberId.DeepCopy(); } if (Beneficiary != null) { dest.Beneficiary = (Hl7.Fhir.Model.ResourceReference)Beneficiary.DeepCopy(); } if (DependentElement != null) { dest.DependentElement = (Hl7.Fhir.Model.FhirString)DependentElement.DeepCopy(); } if (Relationship != null) { dest.Relationship = (Hl7.Fhir.Model.CodeableConcept)Relationship.DeepCopy(); } if (Period != null) { dest.Period = (Hl7.Fhir.Model.Period)Period.DeepCopy(); } if (Payor != null) { dest.Payor = new List <Hl7.Fhir.Model.ResourceReference>(Payor.DeepCopy()); } if (Class != null) { dest.Class = new List <Hl7.Fhir.Model.Coverage.ClassComponent>(Class.DeepCopy()); } if (OrderElement != null) { dest.OrderElement = (Hl7.Fhir.Model.PositiveInt)OrderElement.DeepCopy(); } if (NetworkElement != null) { dest.NetworkElement = (Hl7.Fhir.Model.FhirString)NetworkElement.DeepCopy(); } if (CostToBeneficiary != null) { dest.CostToBeneficiary = new List <Hl7.Fhir.Model.Coverage.CostToBeneficiaryComponent>(CostToBeneficiary.DeepCopy()); } if (SubrogationElement != null) { dest.SubrogationElement = (Hl7.Fhir.Model.FhirBoolean)SubrogationElement.DeepCopy(); } if (Contract != null) { dest.Contract = new List <Hl7.Fhir.Model.ResourceReference>(Contract.DeepCopy()); } return(dest); }
/// <summary> /// Revises the payor. /// </summary> /// <param name="payor">The payor.</param> public virtual void RevisePayor(Payor payor) { Check.IsNotNull(payor, () => Payor); Payor = payor; }
private void ChangePayorAddress( PayorAddressDto payorAddressDto, Payor payor, PayorAddress payorAddress) { RemovePayorAddress(payorAddressDto, payor, payorAddress); AddPayorAddress(payorAddressDto, payor); }
private static void RemovePayorAddress( PayorAddressDto payorAddressDto, Payor payor, PayorAddress payorAddress) { payor.RemovePayorAddress(payorAddress); }
/// <summary> /// Removes the payor. /// </summary> /// <param name="payor">The payor.</param> public virtual void RemovePayor(Payor payor) { Check.IsNotNull(payor, "Payor is required."); _payors.Remove(payor); NotifyItemRemoved(() => Payors, payor); }
public List <Program> GetReportPrograms(int contractId, int?measureTypeId, string groupIds) { List <Program> programs = new List <Program>(); Contract contract = ContractService.Instance.GetContractById(contractId); DataSet dsReportFilters = QueryDataSet(contract.ConnectionString, contract.Database, StoredProcedure.GetProgramAndRelatedReportFilters, groupIds, measureTypeId); dsReportFilters.Tables[0].TableName = "Programs"; dsReportFilters.Tables[1].TableName = "Groups"; dsReportFilters.Tables[2].TableName = "Conditions"; dsReportFilters.Tables[3].TableName = "Populations"; dsReportFilters.Tables[4].TableName = "Measures"; dsReportFilters.Tables[5].TableName = "Subscribers"; dsReportFilters.Tables[6].TableName = "Payers"; dsReportFilters.Tables[7].TableName = "ReportDate"; dsReportFilters.Tables[8].TableName = "AttributionTypes"; //Build Programs out based upon dataset table. if (dsReportFilters.Tables["Programs"].Rows.Count > 0) { foreach (DataRow row in dsReportFilters.Tables["Programs"].Rows) { Program program = new Program(); program.ProgramId = Convert.ToInt32(row[Program.Columns.PROGRAMIDCOLUMN].ToString()); program.Name = row[Program.Columns.PROGRAMNAMECOLUMN].ToString(); if (dsReportFilters.Tables["ReportDate"].Rows.Count > 0) { program.ReportDate = Convert.ToDateTime(dsReportFilters.Tables["ReportDate"].Rows[0][Program.Columns.REPORTDATE].ToString()); } programs.Add(program); if (dsReportFilters.Tables["Groups"].Rows.Count > 0) { program.Groups = new List <Group>(); foreach (DataRow groupRow in dsReportFilters.Tables["Groups"].Select(string.Format("ProgramId = '{0}'", program.ProgramId))) { Group group = Group.Build(groupRow); if (dsReportFilters.Tables["Subscribers"].Rows.Count > 0) { group.Subscribers = new List <Subscriber>(); foreach (DataRow subscriberRow in dsReportFilters.Tables["Subscribers"].Select(string.Format("ProgramId = '{0}' AND GroupId = '{1}'", program.ProgramId, group.GroupId))) { Subscriber subscriber = Subscriber.Build(subscriberRow); group.Subscribers.Add(subscriber); } } program.Groups.Add(group); } } if (dsReportFilters.Tables["Conditions"].Rows.Count > 0) { program.Conditions = new List <Condition>(); foreach (DataRow conditionRow in dsReportFilters.Tables["Conditions"].Select(string.Format("ProgramId = '{0}'", program.ProgramId))) { Condition condition = Condition.Build(conditionRow); program.Conditions.Add(condition); if (dsReportFilters.Tables["Populations"].Rows.Count > 0) { condition.Populations = new List <Population>(); foreach (DataRow populationRow in dsReportFilters.Tables["Populations"].Select(string.Format("ProgramConditionId = '{0}'", condition.ProgramConditionId))) { Population population = Population.Build(populationRow); condition.Populations.Add(population); if (dsReportFilters.Tables["Measures"].Rows.Count > 0) { population.Measures = new List <Measure>(); foreach (DataRow measureRow in dsReportFilters.Tables["Measures"].Select(string.Format("DenominatorId = '{0}'", population.DenominatorId))) { Measure measure = Measure.BuildLight(measureRow); population.Measures.Add(measure); } } } } } } if (dsReportFilters.Tables["Payers"].Rows.Count > 0) { program.Payers = new List <Payor>(); foreach (DataRow payerRow in dsReportFilters.Tables["Payers"].Rows) { Payor payer = Payor.Build(payerRow); program.Payers.Add(payer); } } if (dsReportFilters.Tables["AttributionTypes"].Rows.Count > 0) { program.AttributionTypes = new List <AttributionType>(); foreach (DataRow attributionTypeRow in dsReportFilters.Tables["AttributionTypes"].Rows) { AttributionType attributionTypes = AttributionType.Build(attributionTypeRow); program.AttributionTypes.Add(attributionTypes); } } } } return(programs); }