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

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

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

        LoadlinkedTables();
    }
예제 #3
0
    protected void dxgrid_OnRowDeleting(object sender, ASPxDataDeletingEventArgs e)
    {
        bool         proceed_as_normal = true;
        ASPxGridView gv     = (ASPxGridView)sender;
        string       result = "Error (uninitialized.)";

        #region Conditions for specific grids
        //For people, first check if there are any subjects
        if (gv.ClientInstanceName == "grid_tblgroup")
        {
            var       pk  = e.Keys[0];
            SQL_utils sql = new SQL_utils("backend");
            int       n   = sql.IntScalar_from_SQLstring("select count(*) from tblSubject where groupID=" + pk.ToString());

            if (n > 0)
            {
                string study   = (n == 1) ? " study" : " studies";
                string subject = (n == 1) ? " this subject" : " these subjects";
                string msg     = "This group is assigned to " + n.ToString() + " subjects.  Please delete these first.";
                result            = msg;
                proceed_as_normal = false;
            }
            else
            {
                try
                {
                    sql.NonQuery_from_SQLstring("delete from tblStudyActionGroup where groupID=" + pk.ToString());
                    sql.NonQuery_from_SQLstring("delete from tblStudyMeasGroup where groupID=" + pk.ToString());
                    sql.NonQuery_from_SQLstring("delete from tblLabGroup_Staff where labgroupID in (select labgroupID from tblLabGroup where groupID=" + pk.ToString() + ")");
                    sql.NonQuery_from_SQLstring("delete from tblLabGroup where groupID =" + pk.ToString());
                }
                catch (Exception ex)
                { }
            }
            sql.Close();
        }


        #endregion


        if (proceed_as_normal)
        {
            result = DxDbOps.BuildDeleteSqlCode(e, GridnameToTable(gv.ClientInstanceName), "backend");
        }


        //
        ((ASPxGridView)sender).JSProperties["cpIsUpdated"] = String.Format("DELETED.{0}", result);
        gv.CancelEdit();
        e.Cancel = true;

        RefreshGrids();
    }
예제 #4
0
    protected void gridDict_OnRowDeleting(object sender, ASPxDataDeletingEventArgs 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"]);



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

        gridDict.DataBind();
    }
예제 #5
0
    protected void dxgrid_OnRowDeleting(object sender, ASPxDataDeletingEventArgs e)
    {
        bool         proceed_as_normal = true;
        ASPxGridView gv     = (ASPxGridView)sender;
        string       result = "Error (uninitialized.)";

        #region Conditions for specific grids
        //For people, first check if there are any subjects
        if (gv.ClientInstanceName == "dxgridPeople")
        {
            var personID = e.Keys[0];

            SQL_utils sql = new SQL_utils("backend");

            string personid = hidPersonID.Value.ToString();
            int    nsubj    = sql.IntScalar_from_SQLstring("select count(*) from tblSubject where personID=" + personID.ToString());
            sql.Close();

            if (nsubj > 0)
            {
                string study   = (nsubj == 1) ? " study" : " studies";
                string subject = (nsubj == 1) ? " this subject" : " these subjects";

                string msg = "This person is assigned to " + nsubj.ToString() + study + ".  Please delete" + subject + " first.";

                result            = msg;
                proceed_as_normal = false;
            }
        }
        #endregion


        if (proceed_as_normal)
        {
            result = DxDbOps.BuildDeleteSqlCode(e, GridnameToTable(gv.ClientInstanceName), "backend");
        }

        //
        ((ASPxGridView)sender).JSProperties["cpIsUpdated"] = result;
        gv.CancelEdit();
        e.Cancel = true;
    }
예제 #6
0
    protected void DeleteSubject(object sender, EventArgs e)
    {
        if (Convert.ToInt32(ddl_delSubj1.SelectedValue) == Convert.ToInt32(ddl_delSubj2.SelectedValue))
        {
            int subjID = Convert.ToInt32(ddl_delSubj1.SelectedValue);

            SQL_utils sql = new SQL_utils("backend");

            try{
                var del1 = DxDbOps.BuildDeleteSqlCode("tblstudymeassubj", "backend", "subjID", subjID);


                sql.NonQuery_from_SQLstring("update uwautism_research_backend.dbo.tblstudymeassubj set actionid = null where subjid = " + subjID.ToString());

//tblSubject
//tblaction
//tblReliabilityTracking
//tblSubjConsent
//tblstudymeassubj

                var del2 = DxDbOps.BuildDeleteSqlCode("tblapptstaff", "backend", "actionID in (select actionID from tblaction where subjID = " + subjID.ToString() + ")");
                var del3 = DxDbOps.BuildDeleteSqlCode("tblSubjConsentitem", "backend", "subjconsentid in (select subjconsentid from uwautism_research_backend.dbo.tblSubjConsent where subjid = " + subjID.ToString() + ")");
                var del4 = DxDbOps.BuildDeleteSqlCode("tblSubjConsent", "backend", "subjID", subjID);
                var del5 = DxDbOps.BuildDeleteSqlCode("tblReliabilityTracking", "backend", "subjID", subjID);
                var del6 = DxDbOps.BuildDeleteSqlCode("tblaction", "backend", "subjID", subjID);
                var del7 = DxDbOps.BuildDeleteSqlCode("tblSubject", "backend", "subjID", subjID);

                error_label.Text = "Subject deleted.";

                btnDelete.Visible = false;
            }
            catch (SqlException exc)
            {
                error_label.Text = exc.Message;
            }


            //SQL_utils sql = new SQL_utils("backend");
            //List<SqlParameter> ps = new List<SqlParameter>();
            //ps.Add(sql.CreateParam("subjID", ddl_delSubj1.SelectedValue, "int"));
            //ps.Add(sql.CreateParam("code", "Confirm deletion of " + Convert.ToString(ddl_delSubj1.SelectedValue), "text"));


            //try
            //{
            //	sql.NonQuery_from_ProcName("spDeleteSubject_from_web", ps);

            //}
            //catch (SqlException exc)
            //{
            //	error_label.Text = exc.Message;
            //}

            sql.Close();

            Populate_delSubj_ID_DDL();

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

            UpdatePanel01.Update();
        }
    }