コード例 #1
0
        /// <summary>
        /// </summary>
        private void FillGrid()
        {
            DateTime dateFrom = DateTimeOD.Today;
            DateTime dateTo   = DateTimeOD.Today;

            try {
                dateFrom = PIn.Date(textDateStart.Text); //handles blank
                if (textDateEnd.Text != "")              //if it is blank, default to today
                {
                    dateTo = PIn.Date(textDateEnd.Text);
                }
            }
            catch {
                MsgBox.Show(this, "Invalid date");
                return;
            }
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g(this, "Date"), 70);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Time"), 42);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Patient Last Name"), 110);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Patient First Name"), 110);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Description"), 240);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g(this, "Deleted"), 0, HorizontalAlignment.Center);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            DataTable table = Sheets.GetWebFormSheetsTable(dateFrom, dateTo, Clinics.ClinicNum);

            for (int i = 0; i < table.Rows.Count; i++)
            {
                long    patNum   = PIn.Long(table.Rows[i]["PatNum"].ToString());
                long    sheetNum = PIn.Long(table.Rows[i]["SheetNum"].ToString());
                Patient pat      = Patients.GetPat(patNum);
                if (pat != null)
                {
                    ODGridRow row = new ODGridRow();
                    row.Cells.Add(table.Rows[i]["date"].ToString());
                    row.Cells.Add(table.Rows[i]["time"].ToString());
                    row.Cells.Add(pat.LName);
                    row.Cells.Add(pat.FName);
                    row.Cells.Add(table.Rows[i]["description"].ToString());
                    row.Cells.Add(table.Rows[i]["IsDeleted"].ToString() == "0" ? "" : "X");
                    row.Tag = sheetNum;
                    gridMain.Rows.Add(row);
                }
            }
            gridMain.EndUpdate();
        }