private void FillGridSubscribers() { gridSubscribers.BeginUpdate(); gridSubscribers.Columns.Clear(); gridSubscribers.Columns.Add(new ODGridColumn("User Name", -1)); gridSubscribers.Columns.Add(new ODGridColumn("Unlink", 40, HorizontalAlignment.Center)); gridSubscribers.Rows.Clear(); List <Userod> listSubscribers = _listJobLinks.FindAll(x => x.LinkType == JobLinkType.Subscriber) .Select(x => Userods.GetFirstOrDefault(y => y.UserNum == x.FKey)).ToList(); foreach (Userod user in listSubscribers.FindAll(x => x != null)) { ODGridRow row = new ODGridRow() { Tag = user }; row.Cells.Add(user.UserName); row.Cells.Add("X"); gridSubscribers.Rows.Add(row); } gridSubscribers.EndUpdate(); }
///<summary>Will refresh charges from the database if necessary.</summary> private void FillGrid() { if (!_previousDateRange.IsInRange(datePicker.GetDateTimeFrom()) || !_previousDateRange.IsInRange(datePicker.GetDateTimeTo()) || comboClinics.ListSelectedClinicNums.Any(x => !_listPreviousClinicNums.Contains(x))) { RefreshRecurringCharges(); } gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "PatNum"), 55, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Name"), 185)); if (PrefC.HasClinicsEnabled) { gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Clinic"), 65)); } gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Date Charge"), 135, HorizontalAlignment.Center, GridSortingStrategy.DateParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Charge Status"), 90)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "User"), 90)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Family Bal"), PrefC.HasClinicsEnabled ? 70 : 85, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "PayPlan Due"), PrefC.HasClinicsEnabled ? 80 : 90, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Total Due"), PrefC.HasClinicsEnabled ? 65 : 80, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Repeat Amt"), PrefC.HasClinicsEnabled ? 75 : 90, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g(this, "Charge Amt"), PrefC.HasClinicsEnabled ? 85 : 95, HorizontalAlignment.Right, GridSortingStrategy.AmountParse)); if (gridMain.WidthAllColumns > gridMain.Width) { gridMain.HScrollVisible = true; } gridMain.ListGridRows.Clear(); foreach (RecurringCharge charge in _listRecurringCharges.OrderBy(x => x.DateTimeCharge)) { bool isAutomated = (charge.UserNum == 0); if (!datePicker.IsInDateRange(charge.DateTimeCharge) || (PrefC.HasClinicsEnabled && !charge.ClinicNum.In(comboClinics.ListSelectedClinicNums)) || !charge.ChargeStatus.In(comboStatuses.SelectedTags <RecurringChargeStatus>()) || (comboAutomated.SelectedIndex == 1 && !isAutomated) || (comboAutomated.SelectedIndex == 2 && isAutomated)) { continue; } GridRow row = new GridRow(); row.Cells.Add(charge.PatNum.ToString()); string patName; if (!_dictPatNames.TryGetValue(charge.PatNum, out patName)) { patName = Lans.g(this, "UNKNOWN"); } row.Cells.Add(patName); if (PrefC.HasClinicsEnabled) { row.Cells.Add(Clinics.GetFirstOrDefault(x => x.ClinicNum == charge.ClinicNum)?.Description ?? ""); } row.Cells.Add(charge.DateTimeCharge.ToString()); row.Cells.Add(Lans.g(this, charge.ChargeStatus.GetDescription())); row.Cells.Add(Userods.GetFirstOrDefault(x => x.UserNum == charge.UserNum)?.UserName ?? ""); row.Cells.Add(charge.FamBal.ToString("c")); row.Cells.Add(charge.PayPlanDue.ToString("c")); row.Cells.Add(charge.TotalDue.ToString("c")); row.Cells.Add(charge.RepeatAmt.ToString("c")); row.Cells.Add(charge.ChargeAmt.ToString("c")); row.Tag = charge; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }