private void FormDisplayFields_Load(object sender, EventArgs e) { labelCategory.Text = category.ToString(); textCustomField.Visible = false; labelCustomField.Visible = false; listAvailable.Height = 412; DisplayFields.RefreshCache(); ListShowing = DisplayFields.GetForCategory(category); if (category == DisplayFieldCategory.OrthoChart) { textCustomField.Visible = true; labelCustomField.Visible = true; listAvailable.Height = 227; //227px for short, 412px for tall labelAvailable.Text = Lan.g(this, "Previously Used Fields"); } FillGrids(); }
private void FillGrids() { _listPatClones = Patients.GetAllPatients(); //change this to get a list of all patients WITH possible clones gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col; List <DisplayField> fields = DisplayFields.GetForCategory(DisplayFieldCategory.PatientInformation); col = new GridColumn("First Name", 115); gridMain.ListGridColumns.Add(col); col = new GridColumn("Last Name", 115); gridMain.ListGridColumns.Add(col); col = new GridColumn("Middle", 65); gridMain.ListGridColumns.Add(col); col = new GridColumn("Gender", 65); gridMain.ListGridColumns.Add(col); col = new GridColumn("Birthdate", 75); gridMain.ListGridColumns.Add(col); col = new GridColumn("PriProv", 135); gridMain.ListGridColumns.Add(col); col = new GridColumn("SecProv", 135); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; for (int i = 0; i < _listPatClones.Count; i++) { row = new GridRow(); row.Cells.Add(_listPatClones[i].FName.ToString()); row.Cells.Add(_listPatClones[i].LName.ToString()); row.Cells.Add(_listPatClones[i].MiddleI.ToString()); row.Cells.Add(_listPatClones[i].Gender.ToString()); row.Cells.Add(_listPatClones[i].Birthdate.ToShortDateString()); row.Cells.Add(Providers.GetLongDesc(Patients.GetProvNum(_listPatClones[i]))); row.Cells.Add(Providers.GetLongDesc(_listPatClones[i].SecProv)); row.Tag = _listPatClones[i]; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }
private void FormOrthoChart_Load(object sender, EventArgs e) { //define the table---------------------------------------------------------------------------------------------------------- table = new DataTable("OrthoChartForPatient"); //define columns---------------------------------------------------------------------------------------------------------- table.Columns.Add("Date", typeof(DateTime)); listOrthDisplayFields = DisplayFields.GetForCategory(DisplayFieldCategory.OrthoChart); for (int i = 0; i < listOrthDisplayFields.Count; i++) { table.Columns.Add((i + 1).ToString()); //named by number, but probably refer to by index } //define rows------------------------------------------------------------------------------------------------------------ listOrthoCharts = OrthoCharts.GetAllForPatient(PatCur.PatNum); List <DateTime> datesShowing = new List <DateTime>(); List <string> listDisplayFieldNames = new List <string>(); for (int i = 0; i < listOrthDisplayFields.Count; i++) //fill listDisplayFieldNames to be used in comparison { listDisplayFieldNames.Add(listOrthDisplayFields[i].Description); } //start adding dates starting with today's date datesShowing.Add(DateTime.Today); for (int i = 0; i < listOrthoCharts.Count; i++) { if (!listDisplayFieldNames.Contains(listOrthoCharts[i].FieldName)) //skip rows not in display fields { continue; } if (!datesShowing.Contains(listOrthoCharts[i].DateService)) //add dates not already in date list { datesShowing.Add(listOrthoCharts[i].DateService); } } datesShowing.Sort(); //We now have a list of dates. //add all blank cells to each row except for the date. DataRow row; //create and add row for each date in date showing for (int i = 0; i < datesShowing.Count; i++) { row = table.NewRow(); row["Date"] = datesShowing[i]; for (int j = 0; j < listOrthDisplayFields.Count; j++) { row[j + 1] = ""; //j+1 because first row is date field. } table.Rows.Add(row); } //We now have a table with all empty strings in cells except dates. //Fill with data as necessary. for (int i = 0; i < listOrthoCharts.Count; i++) //loop { if (!datesShowing.Contains(listOrthoCharts[i].DateService)) { continue; } if (!listDisplayFieldNames.Contains(listOrthoCharts[i].FieldName)) { continue; } for (int j = 0; j < table.Rows.Count; j++) { if (listOrthoCharts[i].DateService == (DateTime)table.Rows[j]["Date"]) { table.Rows[j][listDisplayFieldNames.IndexOf(listOrthoCharts[i].FieldName) + 1] = listOrthoCharts[i].FieldValue; } } } FillGrid(); FillGridPat(); }
private void FillGrid() { RefAttachList = RefAttaches.RefreshFiltered(PatNum, true, 0); string referralDescript = DisplayFields.GetForCategory(DisplayFieldCategory.PatientInformation) .FirstOrDefault(x => x.InternalName == "Referrals")?.Description; if (string.IsNullOrWhiteSpace(referralDescript)) //either not displaying the Referral field or no description entered, default to 'Referral (other)' { referralDescript = Lan.g(this, "Referral (other)"); } gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Referral Type"), 85)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Name"), 120)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Date"), 65)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Status"), 70)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Proc"), 120)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Note"), 170)); gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRefList", "Email"), 190)); gridMain.ListGridRows.Clear(); bool hasInvalidRef = false; GridRow row; List <string> listRefTypeNames = new List <string>() { Lan.g(this, "To"), Lan.g(this, "From"), referralDescript }; for (int i = 0; i < RefAttachList.Count; i++) { RefAttach refAttachCur = RefAttachList[i]; if (ProcNum != 0 && !checkShowAll.Checked && ProcNum != refAttachCur.ProcNum) { continue; } row = new GridRow(); row.Cells.Add(listRefTypeNames[(int)refAttachCur.RefType]); row.Cells.Add(Referrals.GetNameFL(refAttachCur.ReferralNum)); if (refAttachCur.RefDate.Year < 1880) { row.Cells.Add(""); } else { row.Cells.Add(refAttachCur.RefDate.ToShortDateString()); } row.Cells.Add(Lan.g("enumReferralToStatus", refAttachCur.RefToStatus.ToString())); if (refAttachCur.ProcNum == 0) { row.Cells.Add(""); } else { Procedure proc = Procedures.GetOneProc(refAttachCur.ProcNum, false); string str = Procedures.GetDescription(proc); row.Cells.Add(str); } row.Cells.Add(refAttachCur.Note); Referral referral = ReferralL.GetReferral(refAttachCur.ReferralNum, false); if (referral == null) { hasInvalidRef = true; continue; } row.Cells.Add(referral.EMail); row.Tag = refAttachCur; gridMain.ListGridRows.Add(row); } if (hasInvalidRef) { ReferralL.ShowReferralErrorMsg(); } gridMain.EndUpdate(); for (int i = 0; i < RefAttachList.Count; i++) { if (RefAttachList[i].RefAttachNum == DefaultRefAttachNum) { gridMain.SetSelected(i, true); break; } } }
private void FormDisplayFields_Load(object sender, EventArgs e) { DisplayFields.Refresh(); ListShowing = DisplayFields.GetForCategory(); FillGrids(); }
private void FillGrid() { gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); List <DisplayField> fieldsForGrid = DisplayFields.GetForCategory(DisplayFieldCategory.AccountModule); if (!PrefC.HasClinicsEnabled) { //remove clinics from displayfields if clinics are disabled fieldsForGrid.RemoveAll(x => x.InternalName.ToLower().Contains("clinic")); } fieldsForGrid.RemoveAll(x => x.InternalName.In("Abbr", "Balance", "Signed")); HorizontalAlignment align; GridSortingStrategy sort; for (int i = 0; i < fieldsForGrid.Count; i++) { align = HorizontalAlignment.Left; sort = GridSortingStrategy.StringCompare; if (fieldsForGrid[i].InternalName.In("Charges", "Credits")) { align = HorizontalAlignment.Right; sort = GridSortingStrategy.AmountParse; } if (fieldsForGrid[i].InternalName == "Tth") { sort = GridSortingStrategy.ToothNumberParse; } if (fieldsForGrid[i].InternalName == "Date") { sort = GridSortingStrategy.DateParse; } gridMain.ListGridColumns.Add(new GridColumn(fieldsForGrid[i].Description == ""?fieldsForGrid[i].InternalName:fieldsForGrid[i].Description, fieldsForGrid[i].ColumnWidth, align, sort)); } if (gridMain.ListGridColumns.Sum(x => x.ColWidth) > gridMain.Width) { gridMain.HScrollVisible = true; } gridMain.ListGridRows.Clear(); GridRow row; for (int i = 0; i < _listLimitedRows.Count; i++) { LimitedRow limitedRow = _listLimitedRows[i]; if (!limitedRow.Type.In(listBoxTransTypes.GetListSelected <AccountEntryType>())) { continue; } DateTime date = limitedRow.DateTime.Date; if (date.Date < odDatePickerFrom.GetDateTime().Date || date.Date > odDatePickerTo.GetDateTime().Date) { continue; //do not add to grid if it is outside the filtered date range. } row = new GridRow(); for (int f = 0; f < fieldsForGrid.Count; f++) { switch (fieldsForGrid[f].InternalName) { case "Date": row.Cells.Add(date.ToShortDateString()); break; case "Patient": row.Cells.Add(limitedRow.PatientName); break; case "Prov": row.Cells.Add(limitedRow.ProvName); break; case "Clinic": row.Cells.Add(Clinics.GetAbbr(limitedRow.ClinicNum)); break; case "ClinicDesc": row.Cells.Add(Clinics.GetDesc(limitedRow.ClinicNum)); break; case "Code": row.Cells.Add(limitedRow.ProcCode); break; case "Tth": row.Cells.Add(limitedRow.Tooth); break; case "Description": row.Cells.Add(limitedRow.Description); break; case "Charges": row.Cells.Add(limitedRow.Charges); break; case "Credits": row.Cells.Add(limitedRow.Credits); break; default: row.Cells.Add(""); break; } } row.ColorText = limitedRow.ColorText; if (i == _listLimitedRows.Count - 1 || limitedRow.DateTime.Date != _listLimitedRows[i + 1].DateTime.Date) { row.ColorLborder = Color.Black; } row.Tag = limitedRow; gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); for (int i = 0; i < gridMain.ListGridRows.Count; i++) { LimitedRow lRow = gridMain.ListGridRows[i].Tag as LimitedRow; gridMain.SetSelected(i, _dictSelectedRows.TryGetValue(lRow.Type, out List <long> listPriKeys) && listPriKeys.Contains(lRow.PrimaryKey)); } //this will refresh _dictSelectedRows and add any associated trans to the previously selected rows SelectAssociatedTrans(); }