Exemple #1
0
    protected bool UpdateSelectedGroups()
    {
        if (rblPlotsBy.SelectedValue != "Single Subject")
        {
            bool       hasgrps = true;
            gvSelector gv      = (gvSelector)gvSubjects_container.FindControlRecursive("gvSubjects");

            //GridView gv = (GridView)gvSubjects_container.FindControlRecursive("gvSubjects");
            string csv = gvSelector.CSVpairs_GetSelectedSubjects(gv);


            if (csv == "")
            {
                lblSelectSubjects.Visible = true;
                hasgrps = false;
            }
            else
            {
                lblSelectSubjects.Visible = false;
                SQL_utils sql = new SQL_utils();
                sql.NonQuery_from_ProcName("dp.spGrp_select", sql.CreateParam("grpIDssID", csv, "text"));
                sql.Close();
            }

            return(hasgrps);
        }
        else
        {
            return(true);
        }
    }
Exemple #2
0
        public static int UpdateDataproject(string pk, int studyID, int subjset_pk, string projTitle, string projSummary
                                            , string meas_csv, string vars_csv, string inthx_csv)
        {
            pk = (String.IsNullOrEmpty(pk)) ? "0" : pk;

            inthx_csv = (inthx_csv == null) ? "": inthx_csv;

            SQL_utils           sql = new SQL_utils("data");
            List <SqlParameter> ps  = new List <SqlParameter>();

            ps.Add(sql.CreateParam("dataproj_pk", pk, "int"));
            ps.Add(sql.CreateParam("studyID", studyID.ToString(), "int"));
            ps.Add(sql.CreateParam("subjset_pk", subjset_pk.ToString(), "int"));
            ps.Add(sql.CreateParam("projTitle", projTitle, "text"));
            ps.Add(sql.CreateParam("projSummary", projSummary, "text"));
            ps.Add(sql.CreateParam("supervisor_staffID", "0", "int"));
            ps.Add(sql.CreateParam("sel_meas", meas_csv, "text"));
            ps.Add(sql.CreateParam("sel_vars", vars_csv, "text"));
            ps.Add(sql.CreateParam("sel_inthx", inthx_csv, "text"));
            ps.Add(sql.CreateParam("out", "", "int", "output"));

            int newdataproj_pk = sql.NonQuery_from_ProcName("dp.spDataProject_UPDATE3", ps, "out");

            sql.Close();

            return(newdataproj_pk);
        }
    protected void btnNewTable_OnCLick(object sender, EventArgs e)
    {
        int newmeasID = Convert.ToInt32(hidNewMeasID.Value.ToString());

        if (newmeasID > 0)
        {
            SQL_utils sql = new SQL_utils("data");

            List <SqlParameter> ps = new List <SqlParameter>();

            string tblname = txtTblName.Value.ToString().Replace("ALL_", "");


            ps.Add(sql.CreateParam("tbl", "ALL_" + tblname, "text"));
            ps.Add(sql.CreateParam("abbr", txtAbbr.Value.ToString(), "text"));
            ps.Add(sql.CreateParam("measureID", newmeasID.ToString(), "int"));

            try
            {
                sql.NonQuery_from_ProcName("def.spPopulate_NEW_Tbl_and_Flds", ps);
            }
            catch (Exception ex)
            {
            }
            sql.Close();
        }

        txtName.Value     = "";
        txtNameFull.Value = "";

        panelMeasure.Visible = true;
        panelTable.Visible   = false;
        hidNewMeasID.Value   = "-1";
    }
Exemple #4
0
    protected void btnDeleteStaffFromBudget_Click(object sender, EventArgs e)
    {
        string staff = ddlStaff.SelectedValue;

        if (utilSelect2.numselected(selBudgets) == 1 & ddlStaff.SelectedValue != "--select specific staff to edit--")
        {
            SQL_utils sql = new SQL_utils("backend");

            List <SqlParameter> ps = new List <SqlParameter>();

            ps.Add(sql.CreateParam("FirstMiddleLastName", staff, "text"));
            ps.Add(sql.CreateParam("budgetNbr", utilSelect2.getselected_ListVal(selBudgets)[0], "text"));

            sql.NonQuery_from_ProcName("fin.spFTE_FutureMo_DELETE", ps);


            sql.Close();
        }
        else
        {
            string err = "";
            if (ddlStaff.SelectedValue == "--select specific staff to edit--")
            {
                err += " Select a staff member.";
            }
            if (utilSelect2.numselected(selBudgets) != 1)
            {
                err += " Select a sinlgle budget.";
            }

            lblError.Text    = err;
            lblError.Visible = true;
            ToggleVisibility("none");
        }
    }
    protected void btnNew_OnCLick(object sender, EventArgs e)
    {
        SQL_utils sql = new SQL_utils("backend");

        List <SqlParameter> ps = new List <SqlParameter>();

        string measname = txtName.Value.ToString();

        ps.Add(sql.CreateParam("measname", txtName.Value.ToString(), "text"));
        ps.Add(sql.CreateParam("measfullname", txtNameFull.Value.ToString(), "text"));
        ps.Add(sql.CreateParam("newmeasureID", "0", "int", "output"));

        int newmeasID = 0;

        try
        {
            newmeasID = sql.NonQuery_from_ProcName("trk.spStudyDesign__CreateNewMeasure", ps, "newmeasureID");
        }
        catch (Exception ex)
        {
        }

        if (newmeasID > 0)
        {
            lblNewMeasName.Text  = measname;
            panelMeasure.Visible = false;
            panelTable.Visible   = true;
            hidNewMeasID.Value   = newmeasID.ToString();
        }

        sql.Close();
    }
    protected void MoveRecord(object sender, EventArgs e)
    {
        SQL_utils           sql = new SQL_utils("data");
        List <SqlParameter> ps  = new List <SqlParameter>();

        ps.Add(sql.CreateParam("old_studymeasID", ddl_studymeasID.SelectedValue, "int"));
        ps.Add(sql.CreateParam("new_studymeasID", ddl_Studymeas_New.SelectedValue, "int"));
        ps.Add(sql.CreateParam("pk", ddl_IDmove.SelectedValue, "int"));
        sql.NonQuery_from_ProcName("spDEF__Update_StudymeasID_for_entered_Measure", ps);

        sql.Close();


        Populate_ID_DDLs();

        btnReset.Visible    = false;
        panelDelete.Visible = false;
        btnDelete.Visible   = false;
        txtDelete.Text      = "";

        lbl_Studymeas_New.Visible = false;
        ddl_Studymeas_New.Visible = false;
        btnMove.Visible           = false;

        UpdatePanel01.Update();
    }
Exemple #7
0
    protected int UpdateSubjset()
    {
        var subj_csv = uwac.trk.dataops.GetCSV(gridLkupSubj.GridView.GetSelectedFieldValues(gridLkupSubj.KeyFieldName));

        if (subj_csv != null)
        {
            string subjset_pk = (Request.QueryString["subjset_pk"] != null) ? Request.QueryString["subjset_pk"] : "0";

            string subjset        = txtSubjset.Text;
            string subjsetdetails = txtSubjsetdetails.Text;

            SQL_utils           sql = new SQL_utils("data");
            List <SqlParameter> ps  = new List <SqlParameter>();
            ps.Add(sql.CreateParam("subjset_pk", subjset_pk, "int"));
            ps.Add(sql.CreateParam("studyID", Master.Master_studyID.ToString(), "int"));
            ps.Add(sql.CreateParam("subjset", subjset, "text"));
            ps.Add(sql.CreateParam("subjsetdetails", subjsetdetails, "text"));
            ps.Add(sql.CreateParam("sel_subj", subj_csv, "text"));
            ps.Add(sql.CreateParam("out", "", "int", "output"));

            int newsubjset_pk = sql.NonQuery_from_ProcName("dp.spSubjSet_UPDATE", ps, "out");


            sql.Close();

            return(newsubjset_pk);
        }
        else
        {
            return(0);
        }
    }
Exemple #8
0
    protected void SaveAllDataStructures(DataTable dt)
    {
        SQL_utils    sql = new SQL_utils();
        SqlParameter p   = sql.CreateParam("NDAR_DS", dt);

        sql.NonQuery_from_ProcName("spNDAR_Insert_DS", p);
    }
    protected void SaveFx(string shortName)
    {
        SQL_utils sql = new SQL_utils("data");

        string fromtopos = txtFromToPos.Text;
        int    from = 0; int to = 0;

        if (fromtopos.Contains('-'))
        {
            string[] pos = fromtopos.Split('-');
            from = Convert.ToInt16(pos[0]);
            to   = Convert.ToInt16(pos[1]);
        }
        else
        {
            from = Convert.ToInt16(fromtopos);
        }

        if (from > 0)
        {
            List <SqlParameter> p = new List <SqlParameter>();
            p.Add(sql.CreateParam("shortName", shortName, "text"));
            p.Add(sql.CreateParam("fx", txtFx.Text, "text"));
            p.Add(sql.CreateParam("params", txtParams.Text, "text"));
            p.Add(sql.CreateParam("from", from.ToString(), "int"));
            p.Add(sql.CreateParam("to", to.ToString(), "int"));

            sql.NonQuery_from_ProcName("spNDAR_AddFx", p);
        }
        else
        {
            lblInfo.Text = "Enter valid From-To positions.";
        }
    }
Exemple #10
0
    //public static void UpdateM(Mdata m)
    public static void RemoveFld(int fldpk)
    {
        SQL_utils           sql = new SQL_utils();
        List <SqlParameter> ps  = new List <SqlParameter>();

        ps.Add(sql.CreateParam("fldpk", fldpk.ToString(), "int"));
        sql.NonQuery_from_ProcName("dp.spFld_remove", ps);

        sql.Close();
    }
Exemple #11
0
    protected void btnImportFromNDAR_OnClick(object sender, EventArgs e)
    {
        SQL_utils sql = new SQL_utils("data");

        SqlParameter p = sql.CreateParam("NDAR_DSE", (DataTable)Session["LoadStructureFromNDAR"]);

        sql.NonQuery_from_ProcName("spNDAR_Insert_DSE", p);

        sql.Close();
    }
Exemple #12
0
    public static void UpdateField(Myfield field)
    {
        SQL_utils sql = new SQL_utils();

        string fldpk = field.fldpk;

        string fldtypepk       = field.fldtypepk;
        string fieldlabel      = field.fieldlabel;
        string fieldvaluesetID = field.fieldvaluesetID;


        string missval           = field.missval;
        string minval            = field.minval;
        string maxval            = field.maxval;
        string regex             = field.regex;
        string regexdesc         = field.regexdesc;
        string validlist         = field.validlist;
        string InAnalysis        = field.InAnalysis;
        string RelItem           = field.RelItem;
        string RelAgreeThreshold = field.RelAgreeThreshold;



        List <SqlParameter> ps = new List <SqlParameter>();

        ps.Add(sql.CreateParam("fldpk", fldpk, "int"));
        ps.Add(sql.CreateParam("fldtypepk", fldtypepk, "int"));
        ps.Add(sql.CreateParam("fieldlabel", fieldlabel, "text"));

        ps.Add(sql.CreateParam("missval", missval, "text"));
        ps.Add(sql.CreateParam("minval", minval, "int"));
        ps.Add(sql.CreateParam("maxval", maxval, "int"));
        ps.Add(sql.CreateParam("regex", regex, "text"));
        ps.Add(sql.CreateParam("regexdesc", regexdesc, "text"));
        ps.Add(sql.CreateParam("validlist", validlist, "text"));
        ps.Add(sql.CreateParam("InAnalysis", InAnalysis, "int"));

        ps.Add(sql.CreateParam("RelItem", RelItem, "int"));
        ps.Add(sql.CreateParam("RelAgreeThreshold", RelAgreeThreshold, "text"));



        if (fieldvaluesetID == "")
        {
            ps.Add(sql.CreateParam("fieldvaluesetID", "-999", "int"));
        }
        else
        {
            ps.Add(sql.CreateParam("fieldvaluesetID", fieldvaluesetID, "int"));
        }

        sql.NonQuery_from_ProcName("def.spEdit_Fld2", ps);

        sql.Close();
    }
Exemple #13
0
    protected void LogDownload(string filename)
    {
        SQL_utils sql = new SQL_utils();

        //Log the Download
        List <SqlParameter> ps2 = new List <SqlParameter>();

        ps2.Add(sql.CreateParam("dataproj_pk", Request.QueryString["pk"], "int"));
        ps2.Add(sql.CreateParam("filename", filename, "text"));
        sql.NonQuery_from_ProcName("dp.spLogDownload", ps2);

        sql.Close();
    }
Exemple #14
0
        public static string SaveToDB(string shortname)
        {
            NDAR.NDAR_DataStructure ds = NDAR.GetNDARDataStructure(shortname);

            DataTable dse = NDAR.NDARDataStructureElements_to_DataTable(ds);



            string results = "";
            //lblInfo.Text = "nrow = {" + dse.Rows.Count.ToString() + "}";
            SQL_utils sql = new SQL_utils();

            //Check is NDAR_DS exists
            int n_ds = sql.IntScalar_from_SQLstring(
                String.Format("select count(*) from NDAR_DS where shortname='{0}'", shortname));

            if (n_ds == 0)
            {
                // then insert DSE
                string code = String.Format("insert into ndar_ds (shortname, title, datatype, status ) values ('{0}', '{1}','{2}','{3}')"
                                            , ds.shortName, ds.title, ds.dataType, ds.status);

                sql.NonQuery_from_SQLstring(code);
            }

            //Check is NDAR_DS exists
            int n_dse = sql.IntScalar_from_SQLstring(
                String.Format("select count(*) from NDAR_DSE where shortname='{0}'", shortname));

            if (n_dse > 0)
            {
                sql.NonQuery_from_SQLstring(String.Format("delete from NDAR_DSE where shortname='{0}'", shortname));
            }

            SqlParameter p = sql.CreateParam("NDAR_DSE", dse);

            try
            {
                sql.NonQuery_from_ProcName("spNDAR_Insert_DSE", p);
                results = "Successfully imported " + shortname;
            }
            catch (Exception ex)
            {
                results = "Error: " + ex.Message;
            }

            sql.Close();
            return(results);
        }
Exemple #15
0
    protected void SaveSubject(object source, EventArgs e)
    {
        SQL_utils sql = new SQL_utils("backend");

        List <SqlParameter> ps = new List <SqlParameter>();

        ps.Add(sql.CreateParam("subjid", hidSubjID.Value.ToString(), "int"));
        ps.Add(sql.CreateParam("Notes", txtNotes.Text.ToString(), "text"));
        ps.Add(sql.CreateParam("ssID", cboSS.Value.ToString(), "int"));
        ps.Add(sql.CreateParam("ssdID", cboSSD.Value.ToString(), "int"));

        sql.NonQuery_from_ProcName("trk.spSubject_Update", ps);

        sql.Close();

        GetSubjectInfo(ID);
    }
Exemple #16
0
    protected void btnSaveUWfields_Click(object sender, EventArgs e)
    {
        DataTable dt = GetUWfields();

        //ViewState["uwfldpos"] = dt;
        //gvTest.DataSource = dt;
        //gvTest.DataBind();


        SQL_utils    sql = new SQL_utils("data");
        SqlParameter p   = sql.CreateParam("tbl", dt);

        sql.NonQuery_from_ProcName("spNDAR_DSE_updateUWfld", p);
        sql.Close();

        LoadDataStructure(shortName);
    }
Exemple #17
0
    protected void btnLinkMatched_Click(object sender, EventArgs e)
    {
        shortName = Request.QueryString["shortName"];

        SQL_utils sql = new SQL_utils();

        List <SqlParameter> ps = new List <SqlParameter>();

        ps.Add(sql.CreateParam("shortname", shortName, "text"));
        ps.Add(sql.CreateParam("mode", "link", "text"));

        sql.NonQuery_from_ProcName("def.spNDAR_matching_UWflds", ps);

        sql.Close();

        LoadDataStructure(shortName);
    }
Exemple #18
0
    //protected void ddlSubjStatus2_SelectedIndexChanged(object sender, EventArgs e)
    //{
    //    //UpdateSSD();
    //}

    // protected void UpdateSSD()
    //{
    //    //string x = ddlSubjStatus2.SelectedValue.ToString();

    //    //SQL_utils sql = new SQL_utils("backend");
    //    //DataTable dt = sql.DataTable_from_SQLstring("select 0 subjstatusdetailID, '--select status detail--' subjstatusdetail union " +
    //    //    " select  subjstatusdetailID, subjstatusdetail  from tblSubjStatusDetail_Lkup " +
    //    //    " where subjstatusdetailID in " +
    //    //    "    (select subjstatusdetailID from tblSubjStatusAndDetail where subjstatusID = " + x + ")");

    //    //ddlSubjStatusDetail2.DataSource = dt;
    //    //ddlSubjStatusDetail2.DataTextField = "subjstatusdetail";
    //    //ddlSubjStatusDetail2.DataValueField = "subjstatusdetailID";

    //    //ddlSubjStatusDetail2.DataBind();
    //    //panelSubjectInfo.Update();
    //    //sql.Close();
    //}

    // protected void ddlSubjStatus2_TextChanged(object sender, EventArgs e)
    // {
    //     UpdateSSD();
    // }


    protected void btnUpdateSS_Click(object sender, EventArgs e)
    {
        UpdatePanel("panelSubjectInfo");
        SQL_utils sql = new SQL_utils("backend");

        HiddenField hidSSD = (HiddenField)Page.FindControlRecursive("hidSSD");
        string      ssd    = hidSSD.Value;

        if (ssd != "" | txtNotes.Text != "")
        //if (ddlSSD.SelectedValue.ToString() != "")
        {
            if (ssd == "")
            {
                ssd = "-1";                         //if ssd is blank then set to -1 so that the orig value is retained in the stored proc
            }
            //note that it is blank because the SSD dropdown is not populated until the SS is selected
            List <SqlParameter> ps = new List <SqlParameter>();
            ps.Add(sql.CreateParam("subjID", Request.QueryString["subjID"], "int"));
            ps.Add(sql.CreateParam("subjstatusID", ddlSS.SelectedValue.ToString(), "int"));
            ps.Add(sql.CreateParam("subjstatusdetailID", ssd, "int"));
            ps.Add(sql.CreateParam("notes", txtNotes.Text, "text"));

            sql.NonQuery_from_ProcName("hh.spSubject_MODIFY", ps);


            //panelEditSS.Visible = false;

            //btnUpdateSS.Visible = false;
            //btnEditSS.Visible = true;

            //reset selected index to -1
            ddlSS.SelectedIndex  = -1;
            ddlSSD.SelectedIndex = -1;


            Response.Redirect("subject.aspx?subjID=" + Request.QueryString["subjID"]);
        }

        //LoadSubjectInfo(Request.QueryString["subjID"]);


        sql.Close();
    }
    protected void btnNew_Click(object sender, EventArgs e)
    {
        string err = "";

        if (txtFN.Text == "")
        {
            err += " first name;";
        }
        if (txtLN.Text == "")
        {
            err += "last name; ";
        }
        if (txtDOB.Text == "")
        {
            err += " DOB;";
        }
        if (txtID.Text == "")
        {
            err += " ID;";
        }


        if (err != "")
        {
            lblERR.Text = String.Format("You must enter: {0}", err);
        }

        else
        {
            lblERR.Text = "";
            SQL_utils sql = new SQL_utils("backend");

            List <SqlParameter> ps = new List <SqlParameter>();
            ps.Add(sql.CreateParam("fn", txtFN.Text.ToString(), "text"));
            ps.Add(sql.CreateParam("ln", txtLN.Text.ToString(), "text"));
            ps.Add(sql.CreateParam("dob", txtDOB.Text.ToString(), "text"));
            ps.Add(sql.CreateParam("id", txtID.Text.ToString(), "text"));

            sql.NonQuery_from_ProcName("spCreateSubject_UWACScoring", ps);

            Response.Redirect("UWACscoring_subjects.aspx");
        }
    }
Exemple #20
0
    protected void UpdateCurrentDistribution(string mode)
    {
        List <string> x = new List <string> {
            "-1", "1"
        };
        List <string> grps = new List <string> {
            "A", "B", "C", "D"
        };



        if (x.Contains(txtAge.Text) &
            x.Contains(txtDQ.Text) &
            x.Contains(txtGender.Text) & x
            .Contains(txtUW.Text) &
            x.Contains(txtUCD.Text) &
            x.Contains(txtTOT.Text) &
            grps.Contains(ddlGRP.SelectedValue)
            )
        {
            SQL_utils sql = new SQL_utils("backend");

            List <SqlParameter> ps = new List <SqlParameter>();

            ps.Add(sql.CreateParam("grp", ddlGRP.SelectedValue.ToString(), "text"));
            ps.Add(sql.CreateParam("lev1", txtAge.Text, "int"));
            ps.Add(sql.CreateParam("lev2", txtDQ.Text, "int"));
            ps.Add(sql.CreateParam("lev3", txtGender.Text, "int"));
            ps.Add(sql.CreateParam("lev4", txtUW.Text, "int"));
            ps.Add(sql.CreateParam("lev5", txtUCD.Text, "int"));
            ps.Add(sql.CreateParam("mode", mode, "text"));

            sql.NonQuery_from_ProcName("spUPDATE_tmpTadpole_Randomization_Strata", ps);

            LoadInfo();
            lblInfo.Text = "";
        }
        else
        {
            lblInfo.Text = "Complete the subject profile.";
        }
    }
Exemple #21
0
    protected void btnClone_OnClick(object sender, EventArgs e)
    {
        Debug.Print("btnClone_OnClick " + System.DateTime.Now.ToString());

        SQL_utils sql = new SQL_utils("data");

        List <SqlParameter> ps = new List <SqlParameter>();

        ps.Add(sql.CreateParam("dataproj_pk", Request.QueryString["pk"], "int"));
        ps.Add(sql.CreateParam("newdataproj_pk", "0", "int", "output"));

        int newdataproj_pk = sql.NonQuery_from_ProcName("dp.CloneDataProject", ps, "newdataproj_pk");

        sql.Close();

        if (newdataproj_pk > 0)
        {
            Response.Redirect("Edit.aspx?pk=" + newdataproj_pk.ToString());
        }
    }
    protected void DeleteRecord(object sender, EventArgs e)
    {
        SQL_utils           sql = new SQL_utils("data");
        List <SqlParameter> ps  = new List <SqlParameter>();

        ps.Add(sql.CreateParam("studymeasID", ddl_studymeasID.SelectedValue, "int"));
        ps.Add(sql.CreateParam("pk", ddl_IDdelete.SelectedValue, "int"));
        sql.NonQuery_from_ProcName("spDEF_DELETE_to_XML_RAW", ps);



        Populate_ID_DDLs();

        btnReset.Visible    = false;
        panelDelete.Visible = false;
        btnDelete.Visible   = false;
        txtDelete.Text      = "";

        UpdatePanel01.Update();
    }
Exemple #23
0
        public static void SaveChartImage(Chart chart, string filepath, string ChartType, string ChartDetails, int studyID, string id)
        {
            string filename = filepath + ChartType + ChartDetails + studyID.ToString() + id + ".png";

            chart.SaveImage(filename);

            Debug.WriteLine("Saving..." + filename);

            //Log this chart
            SQL_utils sql = new SQL_utils();

            List <SqlParameter> ps = new List <SqlParameter>();

            ps.Add(sql.CreateParam("ChartType", ChartType, "text"));
            ps.Add(sql.CreateParam("ChartDetail", ChartDetails, "text"));
            ps.Add(sql.CreateParam("studyID", studyID.ToString(), "int"));
            ps.Add(sql.CreateParam("id", id, "text"));


            sql.NonQuery_from_ProcName("dp.spChartLog_BySubject_INSERT", ps);
        }
Exemple #24
0
    public static void UpdateREV(string p1, string p2, string p3)
    {
        double calcrev;

        Double.TryParse(p3, out calcrev);

        if (calcrev >= 0)
        {
            SQL_utils sql = new SQL_utils("backend");

            List <SqlParameter> ps = new List <SqlParameter>();

            ps.Add(sql.CreateParam("budgetNbr", p1, "text"));
            ps.Add(sql.CreateParam("mo", p2, "text"));
            ps.Add(sql.CreateParam("calcREV", p3, "int"));


            sql.NonQuery_from_ProcName("fin.spREV_FutureMo_UPDATE", ps);

            sql.Close();
        }
    }
Exemple #25
0
    public static void UpdateFTE(string p1, string p2, string p3, string p4)
    {
        double fte;

        Double.TryParse(p4, out fte);

        if (fte >= 0)
        {
            SQL_utils sql = new SQL_utils("backend");

            List <SqlParameter> ps = new List <SqlParameter>();

            ps.Add(sql.CreateParam("idnbr", p1, "text"));
            ps.Add(sql.CreateParam("budgetNbr", p2, "text"));
            ps.Add(sql.CreateParam("mo", p3, "text"));
            ps.Add(sql.CreateParam("calcFTE", p4, "float"));

            sql.NonQuery_from_ProcName("fin.spFTE_FutureMo_UPDATE", ps);

            sql.Close();
        }
    }
Exemple #26
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        SQL_utils sql = new SQL_utils("backend");

        List <SqlParameter> ps = new List <SqlParameter>();

        ps.Add(sql.CreateParam("idtype", ddlIDtype.SelectedValue, "text"));
        ps.Add(sql.CreateParam("idissuedby", txtIssuedBy.Text, "text"));
        ps.Add(sql.CreateParam("idnumber", txtIDnumber.Text, "text"));
        ps.Add(sql.CreateParam("idexpiredate", txtIDexpiredate.Text, "text"));
        ps.Add(sql.CreateParam("fname", txtfirst.Text, "text"));
        ps.Add(sql.CreateParam("mname", txtmiddle.Text, "text"));
        ps.Add(sql.CreateParam("lname", txtlast.Text, "text"));
        ps.Add(sql.CreateParam("dob", txtdob.Text, "text"));
        ps.Add(sql.CreateParam("currentemail", txtemail.Text, "text"));

        sql.NonQuery_from_ProcName("spNETIDinfo_INSERT", ps);



        GridView  gv = new GridView();
        DataTable dt = sql.DataTable_from_SQLstring("exec spNETIDinfo_SELECT");

        if (dt.Rows.Count > 0)
        {
            panel_input.Visible = false;

            gv.DataSource = dt;
            gv.DataBind();
            panel_submitted.Controls.Add(gv);
            panel_submitted.Visible = true;
        }
        else
        {
            lblVerify.Text          = "The may have been a problem saving your info.  Contact Jeff at 425-478-0920.";
            panel_submitted.Visible = true;
        }
    }
Exemple #27
0
    public static void UpdateOBJ(string p1, string p2, string p3, string p4)
    {
        double calcobj;

        Double.TryParse(p4, out calcobj);

        if (calcobj >= 0)
        {
            SQL_utils sql = new SQL_utils("backend");

            List <SqlParameter> ps = new List <SqlParameter>();

            ps.Add(sql.CreateParam("ObjCode", p1, "text"));
            ps.Add(sql.CreateParam("budgetNbr", p2, "text"));
            ps.Add(sql.CreateParam("mo", p3, "text"));
            ps.Add(sql.CreateParam("calcOBJ", p4, "int"));


            sql.NonQuery_from_ProcName("fin.spOBJ_FutureMo_UPDATE", ps);

            sql.Close();
        }
    }
    protected void ResetForm(object sender, EventArgs e)
    {
        SQL_utils           sql = new SQL_utils("data");
        List <SqlParameter> ps  = new List <SqlParameter>();

        ps.Add(sql.CreateParam("studymeasID", ddl_studymeasID.SelectedValue, "int"));
        ps.Add(sql.CreateParam("pk", ddl_ID.SelectedValue, "int"));
        sql.NonQuery_from_ProcName("spDEF_RESET_Verified_to_0", ps);



        Populate_ID_DDLs();


        btnReset.Visible    = false;
        panelDelete.Visible = false;
        btnDelete.Visible   = false;
        txtDelete.Text      = "";

        error_label.Text = "";

        UpdatePanel01.Update();
    }
Exemple #29
0
    //protected void btnSave_Click(object sender, EventArgs e)
    //{
    //	DataTable dt = NDAR.LoadFullDataStructureList("NDAR");

    //	SaveAllDataStructures(dt);
    //}


    //protected void SaveAllDataStructures(DataTable dt)
    //{
    //	SQL_utils sql = new SQL_utils();
    //	SqlParameter p = sql.CreateParam("NDAR_DS", dt);
    //	sql.NonQuery_from_ProcName("spNDAR_Insert_DS", p);
    //}


    protected void gvScroll_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        //save DSE here
        if (e.CommandName == "Import flds")
        {
            NDAR.NDAR_DataStructure ds = NDAR.GetNDARDataStructure(e.CommandArgument.ToString());

            DataTable dse = NDAR.NDARDataStructureElements_to_DataTable(ds);

            //lblInfo.Text = "nrow = {" + dse.Rows.Count.ToString() + "}";

            SQL_utils    sql = new SQL_utils();
            SqlParameter p   = sql.CreateParam("NDAR_DSE", dse);
            sql.NonQuery_from_ProcName("spNDAR_Insert_DSE", p);


            //GridView gv_Fields = new GridView();
            //gv_Fields.DataSource = dse;
            //gv_Fields.DataBind();

            //Panel_dataElements.Controls.Add(gv_Fields);
            //Panel_dataElements.Visible = true;
        }
    }
    protected void MovePersonIntoStudy()
    {
        #region Move Person Into Study
        int    nPersonID    = Convert.ToInt32(hidPersonID.Value);
        int    nStudyID     = Convert.ToInt32(cboStudyID.Value);
        int    nGroupID     = Convert.ToInt32(cboGroupID.Value);
        string sID          = txtSubjectID.Value;
        string sReturnValue = "0";
        string sSubjectID   = "0";



        //SqlCommand oCmd = new SqlCommand();

        //oCmd.Connection = Master.SqlConn;
        //oCmd.CommandText = "trk.spCreateSubject_WEB";
        //oCmd.CommandTimeout = 90;
        //oCmd.CommandType = CommandType.StoredProcedure;

        //oCmd.Parameters.Add(new SqlParameter("@PersonID", SqlDbType.Int, 4, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Current, nPersonID));
        //oCmd.Parameters.Add(new SqlParameter("@StudyID", SqlDbType.Int, 4, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Current, nStudyID));
        //oCmd.Parameters.Add(new SqlParameter("@GroupID", SqlDbType.Int, 4, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Current, nGroupID));
        //oCmd.Parameters.Add(new SqlParameter("@ID", SqlDbType.VarChar, 100, ParameterDirection.Input, true, 0, 0, "", DataRowVersion.Current, sID));
        //oCmd.Parameters.Add(new SqlParameter("@SubjectID", SqlDbType.Int, 4, ParameterDirection.Output, true, 0, 0, "", DataRowVersion.Current, DBNull.Value));
        //oCmd.Parameters.Add(new SqlParameter("@ReturnValue", SqlDbType.Int, 4, ParameterDirection.ReturnValue, true, 0, 0, "", DataRowVersion.Current, DBNull.Value));

        if (nGroupID > 0 & nStudyID > 0 & nPersonID > 0 & sID.Length > 0)
        {
            lblInfo.Text = "OK: " + nGroupID.ToString() + "  " + nStudyID.ToString() + "  " + nPersonID.ToString() + "  " + sID;

            try
            {
                //oCmd.ExecuteNonQuery();


                //NEW VERSION IF NEEDED
                SQL_utils sql = new SQL_utils("backend");

                List <SqlParameter> ps = new List <SqlParameter>();
                ps.Add(sql.CreateParam("PersonID", nPersonID.ToString(), "int"));
                ps.Add(sql.CreateParam("StudyID", nStudyID.ToString(), "int"));
                ps.Add(sql.CreateParam("GroupID", nGroupID.ToString(), "int"));
                ps.Add(sql.CreateParam("ID", sID, "text"));
                ps.Add(sql.CreateParam("SubjectID", "0", "int", "output"));

                int newsubjID = sql.NonQuery_from_ProcName("trk.spCreateSubject_WEB", ps, "SubjectID");

                sSubjectID = newsubjID.ToString();
            }
            catch (Exception)
            {
            }
        }
        else
        {
            lblInfo.Text = nGroupID.ToString() + "  " + nStudyID.ToString() + "  " + nPersonID.ToString() + "  " + sID;
        }

        //sReturnValue = oCmd.Parameters["@ReturnValue"].Value.ToString();
        //sSubjectID = oCmd.Parameters["@SubjectID"].Value.ToString();

        //if (sReturnValue == "0")
        if (sSubjectID != "0")
        {
            Response.Redirect(@"~/Track/Subject.aspx?subjID=" + sSubjectID);
        }
        else
        {
            HtmlTableRow       oTr   = new HtmlTableRow();
            HtmlTableCell      oTd   = new HtmlTableCell();
            HtmlGenericControl oSpan = new HtmlGenericControl("span");
            oSpan.Attributes["class"] = "error";
            oTd.Controls.Add(oSpan);
            oTr.Cells.Add(oTd);
            tblMaster.Rows.Insert(1, oTr);

            switch (sReturnValue)
            {
            case "1":
                oSpan.InnerHtml = "The Person you selected is already a Subject in the Study you selected.";
                break;

            case "2":
                oSpan.InnerHtml = "The ID you entered already exists in the Study you selected.";
                break;

            case "3":
                oSpan.InnerHtml = "The Person you selected has an ID in other related Studies that is different than the ID you entered.";
                break;

            case "4":
                oSpan.InnerHtml = "The ID you entered has already been used to identify a subject in a related study. This ID number is reserved for the same person it was applied to in the related study. Please select a different ID number.";
                break;

            case "5":
                oSpan.InnerHtml = "A Parent-Main subject must first be added to this household.";
                break;

            case "6":
                oSpan.InnerHtml = "Only 1 Proband subject per household is allowed.";
                break;

            case "7":
                oSpan.InnerHtml = "Only 1 Parent-Main subject per household is allowed.";
                break;

            case "8":
                oSpan.InnerHtml = "An internal error occurred in creating the Subject.";
                break;
            }
        }
        #endregion
    }