Esempio n. 1
0
    /// <summary>
    /// US:891
    /// US:894
    /// Populate Item Group Data
    /// </summary>
    /// <param name="gvr"></param>
    /// <param name="dr"></param>
    protected void PopulateItemGroupValues(GridViewRow gvr)
    {
        for (int i = nDefaultColumnCount; i < gvr.Cells.Count; i++)
        {
            TableCell Cell = gvr.Cells[i];
            if (Cell == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(Cell.Text))
            {
                continue;
            }

            long lCellValue = Convert.ToInt64(Cell.Text);
            if (lCellValue > 0)
            {
                DataRow[] draDSSelect = States.Select("STATE_ID = " + Cell.Text);

                Cell.Text = draDSSelect[0]["STATE_LABEL"].ToString();

                switch (lCellValue)
                {
                case (long)k_STATE_ID.Bad:
                    Cell.BackColor = System.Drawing.Color.Red;
                    break;

                case (long)k_STATE_ID.Good:
                    Cell.BackColor = System.Drawing.Color.Green;
                    break;

                default:
                    Cell.BackColor = System.Drawing.Color.Yellow;
                    break;
                }
            }
            else
            {
                Cell.Text      = "NA";
                Cell.BackColor = System.Drawing.Color.Gray;
            }

            if (!WorstStateIDInColumn.ContainsKey(i) || lCellValue > WorstStateIDInColumn[i])
            {
                WorstStateIDInColumn[i] = lCellValue;
            }
        }
    }
Esempio n. 2
0
    /// <summary>
    /// US:896
    /// US:897
    /// method
    /// dynamically adds the columns from the result set
    /// </summary>
    protected void AddColumns()
    {
        gvMultiPatientView.SelectedIndex = -1;
        gvMultiPatientView.Columns.Clear();
        WorstStateIDInColumn.Clear();

        int nGridviewWidth = 0;

        //Add Columns To Gridview
        foreach (DataColumn col in MultiPatients.Columns)
        {
            // create columns
            string strColumn = col.ToString();
            if (strColumn == "WR_ITEM_GROUP_STATE_ID")
            {
                ImageField imageField = new ImageField();
                imageField.AccessibleHeaderText      = "Row State";
                imageField.AlternateText             = "Row State for";
                imageField.DataImageUrlField         = "WR_ITEM_GROUP_URL";
                imageField.HeaderStyle.CssClass      = "gv_pleasewait";
                imageField.HeaderStyle.Width         = 40;
                imageField.HeaderText                = imageField.AccessibleHeaderText;
                imageField.ItemStyle.Width           = 40;
                imageField.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
                imageField.SortExpression            = strColumn;

                gvMultiPatientView.Columns.Insert(0, imageField);

                nGridviewWidth += Convert.ToInt32(imageField.HeaderStyle.Width.Value);
            }
            else if (strColumn == "LAST_NAME")
            {
                ButtonField buttonField = new ButtonField();
                buttonField.AccessibleHeaderText  = strColumn.Replace("_", " ");
                buttonField.ButtonType            = ButtonType.Link;
                buttonField.CommandName           = "Select";
                buttonField.ControlStyle.CssClass = "gv_truncated";
                buttonField.ControlStyle.Width    = 150;
                buttonField.DataTextField         = strColumn;
                buttonField.HeaderStyle.CssClass  = "gv_pleasewait";
                buttonField.HeaderText            = buttonField.AccessibleHeaderText;
                buttonField.HeaderStyle.Width     = 150;
                buttonField.ItemStyle.CssClass    = "gv_pleasewait";
                buttonField.ItemStyle.Width       = 150;
                buttonField.SortExpression        = strColumn;

                gvMultiPatientView.Columns.Add(buttonField);

                nGridviewWidth += Convert.ToInt32(buttonField.HeaderStyle.Width.Value);
            }
            else if (strColumn != "CHECKLIST_ID" &&
                     strColumn != "PAT_CL_ID" &&
                     strColumn != "PATIENT_ID" &&
                     strColumn != "WR_ITEM_GROUP_URL")
            {
                BoundField boundfield = new BoundField();
                boundfield.AccessibleHeaderText = strColumn.Replace("_", " ");
                boundfield.DataField            = strColumn;
                boundfield.HeaderStyle.CssClass = "gv_pleasewait";
                boundfield.HeaderText           = boundfield.AccessibleHeaderText;
                boundfield.ItemStyle.CssClass   = "gv_truncated";
                boundfield.ItemStyle.Wrap       = false;
                boundfield.SortExpression       = strColumn;

                switch (strColumn)
                {
                case "FIRST_NAME":
                case "CHECKLIST_LABEL":
                    boundfield.HeaderStyle.Width = 100;
                    boundfield.ItemStyle.Width   = 100;
                    break;

                case "LAST_4":
                    boundfield.HeaderStyle.Width = 40;
                    boundfield.ItemStyle.Width   = 40;
                    break;

                default:
                    boundfield.HeaderStyle.Width = 75;
                    boundfield.ItemStyle.Width   = 75;
                    break;
                }

                gvMultiPatientView.Columns.Add(boundfield);

                nGridviewWidth += Convert.ToInt32(boundfield.HeaderStyle.Width.Value);
            }
        }

        gvMultiPatientView.Width = nGridviewWidth + gvMultiPatientView.Columns.Count + 1;
    }