示例#1
0
    protected void LoadNDARview(string shortName, string studymeasIDs)
    {
        int    studyID   = sql.GetUserStudyID();
        string IDexclude = txtIDexclude.Text;

        try
        {
            gvNDARview.DataSource = null;

            DataTable dt = NDAR.GetNDAR_view(shortName, studyID, IDexclude, studymeasIDs);
            if (dt.Rows.Count > 0)
            {
                Session["NDARview"] = dt;

                gridNDARview.DataSource = dt;
                gridNDARview.DataBind();
                gridNDARview.Visible = true;

                gridNDARview.Columns[0].FixedStyle = DevExpress.Web.GridViewColumnFixedStyle.Left;
                gridNDARview.Columns[1].FixedStyle = DevExpress.Web.GridViewColumnFixedStyle.Left;
                gridNDARview.Columns[2].FixedStyle = DevExpress.Web.GridViewColumnFixedStyle.Left;
                gridNDARview.Columns[3].FixedStyle = DevExpress.Web.GridViewColumnFixedStyle.Left;
                gridNDARview.Columns[4].FixedStyle = DevExpress.Web.GridViewColumnFixedStyle.Left;


                //count rows where reason_exclude is not null
                int n_reason_exclude_NotNull = dt.AsEnumerable().Where(f => f.Field <string>("reason_exclude") != "").Count();
                int n_reason_exclude_IsNull  = dt.Rows.Count - n_reason_exclude_NotNull;

                v5.Text      = dt.Rows.Count.ToString();
                v5.ForeColor = Color.Navy;
                v6.Text      = n_reason_exclude_IsNull.ToString();
                v6.ForeColor = Color.Navy;
                v7.Text      = n_reason_exclude_NotNull.ToString();
                v7.ForeColor = Color.DarkRed;
            }
            else
            {
                gvNDARview.Visible = false;

                v5.Text      = "This query returned 0 records.";
                v5.ForeColor = Color.Red;
            }
        }
        catch (Exception ex)
        {
            //To show the query
            string sqlout = NDAR.GetSQL_for_NDAR_view(shortName, studyID, IDexclude, studymeasIDs);
            lblInfo.Text = ex.Message + "<br/><br/>" + sqlout;

            //string sqlout = NDAR.GetSQL_for_NDAR_studymeas_to_include(shortName, studyID, 0);
            //lblInfo.Text =  "<br/><br/>" + sqlout;
        }
    }
示例#2
0
    protected void Process_Button_Command(object sender, CommandEventArgs e)
    {
        if (e.CommandName == "LoadData")
        {
            int DatStructureInfo_isOK = LoadDataStructureInfo(shortName);
            if (DatStructureInfo_isOK == 0)
            {
                //            UpdatePanel_O_CheckBoxes p = (UpdatePanel_O_CheckBoxes)panelStudymeas.FindControlRecursive("smID");

                try
                {
                    UpdatePanel_O_CheckBoxes p = (UpdatePanel_O_CheckBoxes)panelStudymeas.FindControlRecursive("studymeasID");

                    string studymeasIDs = p.GetChecked_as_CSV();

                    if (studymeasIDs == "")
                    {
                        //string message = "alert('Please choose which study measures to include.');";
                        //ScriptManager.RegisterClientScriptBlock(sender as Control, this.GetType(), "alert", message, true);
                        lblPleaseSelect.Visible = true;
                    }

                    else
                    {
                        lblPleaseSelect.Visible = false;
                        LoadNDARview(shortName, studymeasIDs);

                        btnSaveNDARCSV.Visible = true;


                        if (chkShowSQLsyntax.Checked)
                        {
                            string sqlout = NDAR.GetSQL_for_NDAR_view(shortName, Master.Master_studyID, studymeasIDs);
                            lblSQLsyntax.Text = "<b><u>SQL syntax for creating NDAR data for '" + shortName + "':</u></b><br/><br/>" + sqlout;
                        }
                    }
                }
                catch (Exception)
                { }
            }
        }
    }