private void FillGrid() { Pharmacies.RefreshCache(); _listPharmacies = Pharmacies.GetDeepCopy(); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TablePharmacies", "Store Name"), 130); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePharmacies", "Phone"), 90); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePharmacies", "Fax"), 90); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePharmacies", "Address"), 120); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePharmacies", "City"), 90); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TablePharmacies", "Note"), 100); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; string txt; for (int i = 0; i < _listPharmacies.Count; i++) { row = new ODGridRow(); row.Cells.Add(_listPharmacies[i].StoreName); row.Cells.Add(_listPharmacies[i].Phone); if (Programs.GetCur(ProgramName.DentalTekSmartOfficePhone).Enabled) { row.Cells[row.Cells.Count - 1].ColorText = Color.Blue; row.Cells[row.Cells.Count - 1].Underline = YN.Yes; } row.Cells.Add(_listPharmacies[i].Fax); txt = _listPharmacies[i].Address; if (_listPharmacies[i].Address2 != "") { txt += "\r\n" + _listPharmacies[i].Address2; } row.Cells.Add(txt); row.Cells.Add(_listPharmacies[i].City); row.Cells.Add(_listPharmacies[i].Note); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void FillGrid() { Pharmacies.RefreshCache(); _listPharmacies = Pharmacies.GetDeepCopy(); //Key=>PharmacyNum & Value=>List of clinics SerializableDictionary <long, List <Clinic> > dictPharmClinics = null; if (PrefC.HasClinicsEnabled) { dictPharmClinics = Clinics.GetDictClinicsForPharmacy(_listPharmacies.Select(x => x.PharmacyNum).ToArray()); } gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col = new GridColumn(Lan.g("TablePharmacies", "Store Name"), 130); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TablePharmacies", "Phone"), 90); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TablePharmacies", "Fax"), 90); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TablePharmacies", "Address"), 120); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TablePharmacies", "City"), 90); gridMain.ListGridColumns.Add(col); if (PrefC.HasClinicsEnabled) { col = new GridColumn(Lan.g("TablePharmacies", "Clinics"), 115); gridMain.ListGridColumns.Add(col); } col = new GridColumn(Lan.g("TablePharmacies", "Note"), 100); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; string txt; foreach (Pharmacy pharm in _listPharmacies) { row = new GridRow(); row.Cells.Add(pharm.StoreName); row.Cells.Add(pharm.Phone); if (Programs.GetCur(ProgramName.DentalTekSmartOfficePhone).Enabled) { row.Cells[row.Cells.Count - 1].ColorText = Color.Blue; row.Cells[row.Cells.Count - 1].Underline = YN.Yes; } row.Cells.Add(pharm.Fax); txt = pharm.Address; if (pharm.Address2 != "") { txt += "\r\n" + pharm.Address2; } row.Cells.Add(txt); row.Cells.Add(pharm.City); if (PrefC.HasClinicsEnabled) { List <Clinic> listClinics; if (!dictPharmClinics.TryGetValue(pharm.PharmacyNum, out listClinics)) { listClinics = new List <Clinic>(); } row.Cells.Add(string.Join(",", listClinics.Select(x => x.Abbr))); } row.Cells.Add(pharm.Note); gridMain.ListGridRows.Add(row); } gridMain.EndUpdate(); }