private void FillGrid() { if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "") { //MsgBox.Show(this,"Please fix errors first."); return; } DateTime dateMax = new DateTime(2100, 1, 1); if (textDateTo.Text != "") { dateMax = PIn.Date(textDateTo.Text); } table = LabCases.Refresh(PIn.Date(textDateFrom.Text), dateMax, checkShowAll.Checked, checkShowUnattached.Checked); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col; col = new ODGridColumn(Lan.g("TableLabCases", "Appt Date Time"), 120); col.SortingStrategy = GridSortingStrategy.DateParse; gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Procedures"), 200); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Patient"), 120); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Status"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Lab"), 75); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Lab Phone"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Instructions"), 100); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < table.Rows.Count; i++) { row = new ODGridRow(); row.Cells.Add(table.Rows[i]["aptDateTime"].ToString()); row.Cells.Add(table.Rows[i]["ProcDescript"].ToString()); row.Cells.Add(table.Rows[i]["patient"].ToString()); row.Cells.Add(table.Rows[i]["status"].ToString()); row.Cells.Add(table.Rows[i]["lab"].ToString()); row.Cells.Add(table.Rows[i]["phone"].ToString()); row.Cells.Add(table.Rows[i]["Instructions"].ToString()); row.Tag = table.Rows[i]; gridMain.Rows.Add(row); } gridMain.AllowSortingByColumn = true; gridMain.EndUpdate(); }
private void FillGrid() { if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "") { //MsgBox.Show(this,"Please fix errors first."); return; } table = LabCases.Refresh(PIn.PDate(textDateFrom.Text), PIn.PDate(textDateTo.Text)); gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col = new ODGridColumn(Lan.g("TableLabCases", "Appt Date Time"), 120); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Procedures"), 200); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Patient"), 120); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Status"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Lab"), 100); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableLabCases", "Phone"), 100); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < table.Rows.Count; i++) { row = new ODGridRow(); row.Cells.Add(table.Rows[i]["aptDateTime"].ToString()); row.Cells.Add(table.Rows[i]["ProcDescript"].ToString()); row.Cells.Add(table.Rows[i]["patient"].ToString()); row.Cells.Add(table.Rows[i]["status"].ToString()); row.Cells.Add(table.Rows[i]["lab"].ToString()); row.Cells.Add(table.Rows[i]["phone"].ToString()); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
private void FillGrid() { if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" || textDateFrom.errorProvider1.GetError(textDateFrom) != "") { //MsgBox.Show(this,"Please fix errors first."); return; } DateTime dateMax = new DateTime(2100, 1, 1); if (textDateTo.Text != "") { dateMax = PIn.Date(textDateTo.Text); } table = LabCases.Refresh(PIn.Date(textDateFrom.Text), dateMax, checkShowAll.Checked, checkShowUnattached.Checked); gridMain.BeginUpdate(); gridMain.ListGridColumns.Clear(); GridColumn col; col = new GridColumn(Lan.g("TableLabCases", "Appt Date Time"), 120); col.SortingStrategy = GridSortingStrategy.DateParse; gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Procedures"), 200); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Patient"), 120); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Status"), 100); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Lab"), 75); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Lab Phone"), 100); gridMain.ListGridColumns.Add(col); col = new GridColumn(Lan.g("TableLabCases", "Instructions"), 100); gridMain.ListGridColumns.Add(col); gridMain.ListGridRows.Clear(); GridRow row; List <long> operatoryNums = new List <long>(); if (PrefC.HasClinicsEnabled) { if (comboClinic.SelectedIndex == 0 && !Security.CurUser.ClinicIsRestricted) //"All" { operatoryNums = null; } else if (comboClinic.SelectedIndex == 0) //"All" that the user has access to. { foreach (Clinic clinic in _listClinics) { operatoryNums.AddRange(Operatories.GetOpsForClinic(clinic.ClinicNum).Select(x => x.OperatoryNum)); } } else { operatoryNums.AddRange(Operatories.GetOpsForClinic(_listClinics[comboClinic.SelectedIndex - 1].ClinicNum).Select(x => x.OperatoryNum)); } } for (int i = 0; i < table.Rows.Count; i++) { if (PrefC.HasClinicsEnabled && //no filtering for non clinics. operatoryNums != null && //we don't have "All" selected for an unrestricted user. table.Rows[i]["AptNum"].ToString() != "0" && //show unattached for any clinic !operatoryNums.Contains(PIn.Long(table.Rows[i]["OpNum"].ToString()))) //Attached appointment is scheduled in an Op for the clinic { continue; //appointment scheduled in an operatory for another clinic. } row = new GridRow(); row.Cells.Add(table.Rows[i]["aptDateTime"].ToString()); row.Cells.Add(table.Rows[i]["ProcDescript"].ToString()); row.Cells.Add(table.Rows[i]["patient"].ToString()); row.Cells.Add(table.Rows[i]["status"].ToString()); row.Cells.Add(table.Rows[i]["lab"].ToString()); row.Cells.Add(table.Rows[i]["phone"].ToString()); row.Cells.Add(table.Rows[i]["Instructions"].ToString()); row.Tag = table.Rows[i]; gridMain.ListGridRows.Add(row); } gridMain.AllowSortingByColumn = true; gridMain.EndUpdate(); }