Пример #1
0
        public void TestDBConnection()
        {
            string             sqlTEST             = "select * from GMI_TRANS";
            string             OraConnectionString = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=DTCP-GMIGDBC01)(PORT=1521))(CONNECT_DATA=(SID=GMIDPROD)))";
            DBConnectAndRunSQL handler             = new DBConnectAndRunSQL();

            // As a list of strings
            List <string> listSQLResults = handler.GetResultsAsList(handler.GetResultsAsReader(sqlTEST, handler.OpenConnection(OraConnectionString)));

            // Get the properties of the connection for the log and to close it.
            DBConnectLog DBLog = handler.DBLog;

            if (!DBLog.Successful)
            {
                Status.Print(true, true, "DBConnection", DBLog.LogError);
            }
            else
            {
                // Close the connection
                handler.CloseConnection(DBLog.connection);
                Status.Print(false, true, "DBConnection", DBLog.LogInfo);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Initial Page load

                // SSO Authenticate
                SAFESSO();
                Status.Print(false, true, "Login:  "******" " + LoginUser.Surname + " " + "[" + LoginUser.ID + "] has logged on to page");

                //Admin users can additionally see the Delete GMI_REF Record button see web.config GTMAdmins
                if (GTMAdmins.Contains(LoginUser.ID))
                {
                    btnGMI_REF_DeleteRecord.Visible = true;
                    btnGMI_REF_DeleteRecord.Enabled = true;
                    lblProcessID.Visible            = true;
                }

                // Set initial Filter image state
                imgButShowAdvFilters.ImageUrl = IMGURLFiltersShow;

                // CHECK DATABASE CONNECTION IS OK HERE


                // Populate drop down controls.
                // Maybe get this value from a cookie.
                ddListPageRows.DataSource = gridRowsShown;
                ddListPageRows.DataBind();
                ddListPageRows.SelectedItem.Value = gridRowsShown[0];
                ddListPageRows.SelectedIndex      = 0;

                // Get gmi_status as list of values and add a blank unselected at the top
                lov_GMI_STATUS lovGMISTATUS = new lov_GMI_STATUS();
                ddLGMISTATUS.DataSource = lovGMISTATUS.getLOV();
                ddLGMISTATUS.DataBind();
                ddLGMISTATUS.Items.Insert(0, new ListItem(String.Empty, String.Empty));
                ddLGMISTATUS.SelectedIndex = 0;

                // Get gmi_environment as list of values and add a blank unselected at the top
                lov_GMI_ENVIRONMENT lovGMI_ENV = new lov_GMI_ENVIRONMENT();
                ddLENVIRONMENT.DataSource = lovGMI_ENV.getLOV();
                ddLENVIRONMENT.DataBind();
                ddLENVIRONMENT.Items.Insert(0, new ListItem(String.Empty, String.Empty));
                ddLENVIRONMENT.SelectedIndex = 0;

                //Get Feeds as list of values
                lov_FEED lov_FEEDS = new lov_FEED();
                ddlFEED.DataSource = lov_FEEDS.getLOV();
                ddlFEED.DataBind();
                ddlFEED.Items.Insert(0, new ListItem(String.Empty, String.Empty));
                ddlFEED.SelectedIndex = 0;

                ddlEventSeverity.Items.Insert(0, lstSeverity[0]);
                ddlEventSeverity.Items.Insert(1, lstSeverity[1]);
                ddlEventSeverity.Items.Insert(2, lstSeverity[2]);
                ddlEventSeverity.Items.Insert(3, lstSeverity[3]);
                ddlEventSeverity.Items.Insert(4, lstSeverity[4]);
                ddlEventSeverity.Items.Insert(5, lstSeverity[5]);
                ddlEventSeverity.SelectedIndex = 4;
            }
            else
            {
            }
        }