예제 #1
0
    protected void gv_pubvar_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        DxDbOps.BuildInsertSqlCode(e, "tblPubVar", "backend", "dbo");
        gv.CancelEdit();
        e.Cancel = true;
    }
예제 #2
0
    protected void gridLinkedImportTbl_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        DxDbOps.BuildInsertSqlCode(e, "LinkedImportTbl", "data", "def");
        gv.CancelEdit();
        e.Cancel = true;
        Session["LinkedImports"]    = null;
        Session["LinkedImportTbls"] = null;

        LoadlinkedTables();
    }
예제 #3
0
    protected void dxgridPeople_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
    {
        //Add HouseholdID

        e.NewValues.Add("HouseholdID", Request.QueryString["hhID"]);

        bool result = DxDbOps.BuildInsertSqlCode(e, "tblPerson", "backend");

        ASPxGridView gv = (ASPxGridView)sender;

        gv.CancelEdit();
        e.Cancel = true;
        //test
    }
예제 #4
0
    protected void gridDict_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        SQL_utils sql   = new SQL_utils("data");
        int       tblpk = sql.IntScalar_from_SQLstring("select tblpk from def.tbl where measureID=" + Request.QueryString["mID"]);

        e.NewValues.Add("tblpk", tblpk);

        DxDbOps.BuildInsertSqlCode(e, "fld", "data", "def");
        //((ASPxGridView)sender).JSProperties["cpIsUpdated"] = gv.ClientInstanceName.ToString();
        gv.CancelEdit();
        e.Cancel = true;

        gridDict.DataBind();
    }
예제 #5
0
    protected void gridEditStaff_BatchUpdate(object sender, ASPxDataBatchUpdateEventArgs e)
    {
        int staffID = Convert.ToInt32(gridStaffList.GetSelectedFieldValues("staffID").First());

        List <bool> results = new List <bool>();

        foreach (ASPxDataUpdateValues args in e.UpdateValues)
        {
            if (Convert.ToInt32(args.Keys[0].ToString()) < 0)
            {
                //Add staffID to the NewValues
                //int staffID = Convert.ToInt32(cboStaffInLab.Value.ToString());



                args.NewValues["staffID"] = staffID;

                bool result = DxDbOps.BuildInsertSqlCode(args.NewValues, "tbllabgroup_staff", "backend");
                results.Add(result);

                if (result)
                {
                    needrefresh = true;
                }
            }
            else
            {
                bool result = DxDbOps.BuildUpdateSqlCode(args, "tbllabgroup_staff", "backend");
                results.Add(result);
                if (result)
                {
                    needrefresh = true;
                }
            }
        }


        DataTable dt = GetStaffToEdit(staffID);

        Session["labgroups_staff"] = dt;

        e.Handled = true;
    }
예제 #6
0
    protected void dxgrid_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        e.NewValues.Add("HouseholdID", Request.QueryString["hhID"]);
        bool execute = false;


        if (Master.Master_studyID > 0)
        {
            e.NewValues.Add("studyID", Master.Master_studyID.ToString());
            execute = true;
        }
        else
        {
            SQL_utils sql        = new SQL_utils("backend");
            int       hh_studyID = sql.IntScalar_from_SQLstring(
                "select top 1 studyID from trk.vwMasterStatus_S where householdID = " + Request.QueryString["hhID"] + " group by studyID order by count(*)  desc"
                );
            if (hh_studyID > 0)
            {
                sql.NonQuery_from_SQLstring("update tblStaff set defaultstudyID = " + hh_studyID.ToString() + " where  actdirID = sec.systemuser()");
                e.NewValues.Add("studyID", hh_studyID.ToString());
                execute = true;
            }
            sql.Close();
        }

        if (execute)
        {
            DxDbOps.BuildInsertSqlCode(e, GridnameToTable(gv.ClientInstanceName), "backend");
            gv.CancelEdit();
            e.Cancel = true;
        }
        else
        {
            gv.CancelEdit();
            e.Cancel = true;
        }
    }
예제 #7
0
    protected void dxgrid_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        string shortname = String.Format("{0}{1}"
                                         , e.NewValues["firstname"].ToString().Substring(0, 1)
                                         , e.NewValues["lastname"].ToString());

        string staffinits = String.Format("{0}{1}"
                                          , e.NewValues["firstname"].ToString().Substring(0, 1)
                                          , e.NewValues["lastname"].ToString().Substring(0, 1));

        e.NewValues.Add("active", "1");
        e.NewValues.Add("staffshortname", shortname);
        e.NewValues.Add("staffinits", staffinits);


        bool result = DxDbOps.BuildInsertSqlCode(e, "tblStaff", "backend");

        gv.CancelEdit();
        e.Cancel = true;
    }
예제 #8
0
    protected void gridLinkedREDCapForm_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
    {
        ASPxGridView gv      = (ASPxGridView)sender;
        SQL_utils    sql     = new SQL_utils("data");
        string       sqlcode = String.Format("select min(tokenID) from def.vwREDCap_Form where studyID={0} and measureID={1}",
                                             Session["studyID"].ToString(), cboMeas.Value.ToString());
        int tokenid = sql.IntScalar_from_SQLstring(sqlcode);

        sql.Close();

        int measureID = Convert.ToInt32(cboMeas.Value.ToString());

        e.NewValues.Add("tokenid", tokenid);
        e.NewValues.Add("measureid", measureID);


        DxDbOps.BuildInsertSqlCode(e, "REDCap_Form", "data", "def");
        gv.CancelEdit();
        e.Cancel = true;
        Session["LinkedREDCapForm"] = null;

        LoadlinkedTables();
    }
예제 #9
0
    protected void dxgrid_OnRowInserting(object sender, ASPxDataInsertingEventArgs e)
    {
        ASPxGridView gv = (ASPxGridView)sender;

        e.NewValues.Add("HouseholdID", Request.QueryString["hhID"]);
        e.NewValues.Add("studyID", Master.Master_studyID.ToString());

        int       newgroupID = -1;
        int       staffID    = -1;
        int       labID      = -1;
        SQL_utils sql        = new SQL_utils("backend");

        if (gv.ClientInstanceName == "grid_tblgroup")
        {
            newgroupID             = sql.IntScalar_from_SQLstring("select max(groupID) + 1 from tblGroup");
            staffID                = sql.IntScalar_from_SQLstring("select sec.systemuser_staffID()");
            labID                  = sql.IntScalar_from_SQLstring("select labID from tblStudy where studyID=" + Master.Master_studyID.ToString());
            e.NewValues["groupID"] = newgroupID;
        }

        if (gv.ClientInstanceName == "grid_tblSSD")
        {
            int ssID = Convert.ToInt32(gv.GetMasterRowFieldValues("ssID").ToString());
            if (ssID > 0)
            {
                e.NewValues["ssID"] = ssID;
            }
        }


        DxDbOps.BuildInsertSqlCode(e, GridnameToTable(gv.ClientInstanceName), "backend");


        if (gv.ClientInstanceName == "grid_tblgroup")
        {
            if (newgroupID > 0 & staffID > 0 & labID > 0)
            {
                // Add the group to this lab
                string sqlcode = String.Format("insert into tbllabgroup(groupID, labID, labgroup_enabled) values({0},{1},{2})"
                                               , newgroupID.ToString(), labID, "1");
                sql.NonQuery_from_SQLstring(sqlcode);

                int labgroupID = sql.IntScalar_from_SQLstring(String.Format("select labgroupID from tbllabgroup where groupID={0} and labID={1}", newgroupID, labID));

                if (labgroupID > 0)
                {
                    // Add the group to this staff
                    string sqlcode2 = String.Format("insert into tbllabgroup_staff(StaffID, LabGroupID , DBroleID) values({0}, {1}, {2})"
                                                    , staffID, labgroupID, "1");
                    sql.NonQuery_from_SQLstring(sqlcode2);
                }
            }
        }


        ((ASPxGridView)sender).JSProperties["cpIsUpdated"] = gv.ClientInstanceName.ToString();
        gv.CancelEdit();
        e.Cancel = true;

        RefreshGrids();
    }