///<summary>Makes the "Before" and "After" columns human-readable for certain logs.</summary> private void TranslateBeforeAndAfter() { foreach (InsEditLog logCur in _listLogs) { long beforeKey = PIn.Long(logCur.OldValue, false); long afterKey = PIn.Long(logCur.NewValue, false); switch (logCur.FieldName) { case "CarrierNum": if (logCur.LogType == InsEditLogType.Carrier) { break; } string carrierNameBefore = Carriers.GetCarrier(beforeKey).CarrierName; string carrierNameAfter = Carriers.GetCarrier(afterKey).CarrierName; if (logCur.LogType == InsEditLogType.InsPlan && carrierNameBefore == carrierNameAfter) //Edits to carrier. { break; //Don't translate CarrierNum to CarrierName when both carriers have the same name, loses too much useful detail. } logCur.OldValue = beforeKey == 0 ? logCur.OldValue : carrierNameBefore; logCur.NewValue = afterKey == 0 ? logCur.NewValue : carrierNameAfter; break; case "EmployerNum": if (logCur.LogType == InsEditLogType.Employer) { break; } logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Employers.GetName(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : Employers.GetName(afterKey); break; case "FeeSched": case "CopayFeeSched": case "AllowedFeeSched": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : FeeScheds.GetDescription(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : FeeScheds.GetDescription(afterKey); break; case "BenefitType": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Enum.GetName(typeof(InsBenefitType), beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : Enum.GetName(typeof(InsBenefitType), afterKey); break; case "CovCatNum": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : CovCats.GetDesc(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : CovCats.GetDesc(afterKey); break; case "CodeNum": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : ProcedureCodes.GetStringProcCode(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : ProcedureCodes.GetStringProcCode(afterKey); break; default: break; } } }
///<summary></summary> private void FillGrid() { Cursor = Cursors.WaitCursor; //ListAll: Set externally before loading. gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn("Employer", 100); gridMain.Columns.Add(col); col = new ODGridColumn("Carrier", 100); gridMain.Columns.Add(col); col = new ODGridColumn("Phone", 82); gridMain.Columns.Add(col); col = new ODGridColumn("Address", 100); gridMain.Columns.Add(col); col = new ODGridColumn("City", 80); gridMain.Columns.Add(col); col = new ODGridColumn("ST", 25); gridMain.Columns.Add(col); col = new ODGridColumn("Zip", 50); gridMain.Columns.Add(col); col = new ODGridColumn("Group#", 70); gridMain.Columns.Add(col); col = new ODGridColumn("Group Name", 90); gridMain.Columns.Add(col); col = new ODGridColumn("Subs", 40); gridMain.Columns.Add(col); col = new ODGridColumn("Plan Note", 180); gridMain.Columns.Add(col); //TrojanID and PlanNote not shown gridMain.Rows.Clear(); ODGridRow row; Carrier carrier; for (int i = 0; i < ListAll.Length; i++) { row = new ODGridRow(); row.Cells.Add(Employers.GetName(ListAll[i].EmployerNum)); carrier = Carriers.GetCarrier(ListAll[i].CarrierNum); row.Cells.Add(carrier.CarrierName); row.Cells.Add(carrier.Phone); row.Cells.Add(carrier.Address); row.Cells.Add(carrier.City); row.Cells.Add(carrier.State); row.Cells.Add(carrier.Zip); row.Cells.Add(ListAll[i].GroupNum); row.Cells.Add(ListAll[i].GroupName); row.Cells.Add(ListAll[i].NumberSubscribers.ToString()); row.Cells.Add(ListAll[i].PlanNote); gridMain.Rows.Add(row); } gridMain.EndUpdate(); gridMain.SetSelected(0, true); Cursor = Cursors.Default; }
///<summary>Makes the "Before" and "After" columns human-readable for certain logs.</summary> private void TranslateBeforeAndAfter() { foreach (InsEditLog logCur in _listLogs) { long beforeKey = PIn.Long(logCur.OldValue, false); long afterKey = PIn.Long(logCur.NewValue, false); switch (logCur.FieldName) { case "CarrierNum": if (logCur.LogType == InsEditLogType.Carrier) { break; } logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Carriers.GetCarrier(beforeKey).CarrierName; logCur.NewValue = afterKey == 0 ? logCur.NewValue : Carriers.GetCarrier(afterKey).CarrierName; break; case "EmployerNum": if (logCur.LogType == InsEditLogType.Employer) { break; } logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Employers.GetName(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : Employers.GetName(afterKey); break; case "FeeSched": case "CopayFeeSched": case "AllowedFeeSched": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : FeeScheds.GetDescription(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : FeeScheds.GetDescription(afterKey); break; case "BenefitType": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : Enum.GetName(typeof(InsBenefitType), beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : Enum.GetName(typeof(InsBenefitType), afterKey); break; case "CovCatNum": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : CovCats.GetDesc(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : CovCats.GetDesc(afterKey); break; case "CodeNum": logCur.OldValue = beforeKey == 0 ? logCur.OldValue : ProcedureCodes.GetStringProcCode(beforeKey); logCur.NewValue = afterKey == 0 ? logCur.NewValue : ProcedureCodes.GetStringProcCode(afterKey); break; default: break; } } }
private void butMerge_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length < 2) { MessageBox.Show(Lan.g(this, "Please select at least two items first.")); return; } InsPlan[] listSelected = new InsPlan[gridMain.SelectedIndices.Length]; for (int i = 0; i < listSelected.Length; i++) { listSelected[i] = InsPlans.GetPlan(PIn.PInt(table.Rows[gridMain.SelectedIndices[i]]["PlanNum"].ToString()), null); } FormInsPlansMerge FormI = new FormInsPlansMerge(); FormI.ListAll = listSelected; FormI.ShowDialog(); if (FormI.DialogResult != DialogResult.OK) { return; } //Do the merge. InsPlan planToMergeTo = FormI.PlanToMergeTo.Copy(); List <Benefit> benList = Benefits.RefreshForAll(planToMergeTo); Cursor = Cursors.WaitCursor; List <int> planNums; for (int i = 0; i < listSelected.Length; i++) //loop through each selected plan group //skip the planToMergeTo, because it's already correct { if (planToMergeTo.PlanNum == listSelected[i].PlanNum) { continue; } planNums = new List <int>(InsPlans.GetPlanNumsOfSamePlans(Employers.GetName(listSelected[i].EmployerNum), listSelected[i].GroupName, listSelected[i].GroupNum, listSelected[i].DivisionNo, Carriers.GetName(listSelected[i].CarrierNum), listSelected[i].IsMedical, listSelected[i].PlanNum, false));//remember that planNum=0 //First plan info InsPlans.UpdateForLike(listSelected[i], planToMergeTo); //for(int j=0;j<planNums.Count;j++) { //InsPlans.ComputeEstimatesForPlan(planNums[j]); //Eliminated in 5.0 for speed. //} //then benefits Benefits.UpdateListForIdentical(new List <Benefit>(), benList, planNums); //there will always be changes //Then PlanNote. This is much simpler than the usual synch, because user has seen all versions of note. InsPlans.UpdateNoteForPlans(planNums, planToMergeTo.PlanNote); } FillGrid(); //highlight the merged plan for (int i = 0; i < table.Rows.Count; i++) { for (int j = 0; j < listSelected.Length; j++) { if (table.Rows[i]["PlanNum"].ToString() == listSelected[j].PlanNum.ToString()) { gridMain.SetSelected(i, true); } } } Cursor = Cursors.Default; }