}         // Obsolete...

        #endregion

        #region User Controls

        #region Combo Box Events and Functions

        private void initDropDown(DropDownList dpID, string sql, int showSelect)
        {
            if (AppMode)
            {
                clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["remoteConn"]);
            }
            else
            {
                clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["infiniConn"]);
            }

            SqlDataReader rsCombo = clsUtility.GetDataReader(sql);

            // if the showSelect flag is 1 then show the [Select] option, otherwise enter a blank option
            if (showSelect > 0)
            {
                // add a null option to each drop down list
                dpID.Items.Add(new ListItem("[Select]", "-1"));
            }
            else
            {
                dpID.Items.Add(new ListItem("", ""));
            }

            // get all of the values and text from the data reader
            while (rsCombo.Read())
            {
                string val1 = rsCombo[0].ToString();
                string val2 = rsCombo[1].ToString();
                dpID.Items.Add(new ListItem(val2, val1));
            }

            // close the reader
            rsCombo.Close();
        }
Example #2
0
        } // Done...Tested

        #endregion

        #endregion

        #region Datagrid Events

        #region initGrid(DataGrid dgGrid, string strSQL, string pKey)
        private void initGrid(DataGrid dgGrid, string strSQL, string pKey)
        {
            if (AppMode)
            {
                clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["remoteConn"]);
            }
            else
            {
                clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["infiniConn"]);
            }

            SqlDataReader rData = clsUtility.GetDataReader(strSQL);

            // set the grid's visible property to false to initialize the control
            dgGrid.Visible = false;

            int i;

            if (rData.HasRows)
            {
                dgGrid.Visible = true;
                for (i = 0; i < rData.FieldCount; i++)
                {
                    BoundColumn objBC = new BoundColumn();
                    objBC.DataField  = rData.GetName(i).ToString();
                    objBC.HeaderText = rData.GetName(i).ToString();

                    // use this function to make the primary key of the table hidden
                    if (rData.GetName(i).ToString() == pKey)
                    {
                        objBC.Visible = false;
                    }
                    dgGrid.Columns.Add(objBC);
                }
                dgGrid.DataSource = rData;
                dgGrid.DataBind();
                rData.Close();
            }
            else
            {
                if (pKey == "MedicationID")
                {
                    MedHdr.Visible = false;
                }
                if (pKey == "VitalSignID")
                {
                    VitalHdr.Visible = false;
                }
            }

            // if in view mode then remove the Action column
            if (Session["mode"] != null && Session["mode"].ToString() == "view")
            {
                dgGrid.Columns[0].Visible = false;;
            }

            // cleanup
            rData.Close();
        }
Example #3
0
        // need a method that will get the names of the textboxes, radio buttons, and drop down lists
        private void getFields(Control c, string strSQL)
        {
            if (AppMode)
            {
                clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["remoteConn"]);
            }
            else
            {
                clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["infiniConn"]);
            }

            SqlDataReader rEncounter = clsUtility.GetDataReader(strSQL);

            while (rEncounter.Read())
            {
                for (int i = 0; i < rEncounter.FieldCount; i++)
                {
                    Control ctrl = getControl(c, rEncounter.GetName(i).ToString());
                    if (ctrl != null)
                    {
                        switch (ctrl.GetType().ToString())
                        {
                        case "System.Web.UI.WebControls.TextBox":
                            TextBox txtCtrl = new TextBox();
                            txtCtrl.Text = rEncounter.GetString(i);
                            break;

                        case "System.Web.UI.WebControls.DropDownList":
                            DropDownList cboCtrl = new DropDownList();
                            cboCtrl.SelectedIndex = rEncounter.GetInt16(i);
                            break;

                        case "System.Web.UI.WebControls.RadioButtonList":
                            RadioButtonList rdoCtrl = new RadioButtonList();
                            rdoCtrl.SelectedValue = rEncounter.GetString(i);
                            break;
                        }
                    }
                }
            }
            rEncounter.Close();
        }