예제 #1
0
        protected void deletemainmpic_Click(object sender, EventArgs e)
        {
            Alert alert = new Alert();

            int[] intRowindexarray = mainGrid.SelectedRowIndexArray;

            if (intRowindexarray.Length > 0)
            {
                pd_kidclass_mainmpic ul   = new pd_kidclass_mainmpic();
                object[]             keys = mainGrid.DataKeys[intRowindexarray[0]];
                string strID = keys[0].ToString();
                if (ul.isExistdata("pd_kidclass_secondrec", "mpciID", strID, "mpciID").Trim() != "")
                {
                    alert.Icon    = Icon.Information;
                    alert.Message = "该指标给下级分类使用不能删除";
                    alert.Show();
                }
                else
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("ID", " cast(ID as varchar(36))='" + strID + "' ");

                    int intresult = ul.deletebycondition("pd_kidclass_mainmpic", dic);

                    setPageContent(5);



                    if (intresult > 0)
                    {
                        alert.Icon    = Icon.Information;
                        alert.Message = "成功移除数据";
                    }
                    else
                    {
                        alert.MessageBoxIcon = MessageBoxIcon.Error;
                        alert.Message        = "数据移除失败";
                    }

                    alert.Show();
                }
            }
        }
예제 #2
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Alert alert = new Alert();

            FineUIPro.TreeNode treenode = firsttree.SelectedNode;
            editclassID.Text = treenode.NodeID;
            int    intresult = 0;
            string strID     = treenode.NodeID;
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("ID", " cast(ID as varchar(36))='" + strID + "' ");
            pd_kidclass_main ul = new pd_kidclass_main();
            DataTable        dt = ul.getEditdata(strID);

            if (dt != null && dt.Rows.Count > 0)
            {
                intresult = ul.deletebycondition("pd_kidclass_main", dic);
                pd_kidclass_mainmpic        ulpic = new pd_kidclass_mainmpic();
                Dictionary <string, string> dic1  = new Dictionary <string, string>();
                dic1.Add("mainID", " cast(mainID as varchar(36))='" + strID + "' ");
                ulpic.deletebycondition("pd_kidclass_mainmpic", dic1);
                if (intresult > 0)
                {
                    alert.Icon    = Icon.Information;
                    alert.Message = "成功移除数据";
                    PageContext.RegisterStartupScript("preview();");
                }


                alert.Show();
            }
            else
            {
                if (ul.isExistdata("pd_machinekit", "mtypeid", strID, "mtypeid").Trim() != "")
                {
                    Alert.Show("该类别存在下级零件不能删除!");
                    return;
                }
                else
                {
                    pd_kidclass_secondary ul1 = new pd_kidclass_secondary();
                    intresult = ul1.deletebycondition("pd_kidclass_secondary", dic);
                    pd_kidclass_secondrec       ulpic = new pd_kidclass_secondrec();
                    Dictionary <string, string> dic1  = new Dictionary <string, string>();
                    dic1.Add("subID", " cast(subID as varchar(36))='" + strID + "' ");
                    ulpic.deletebycondition("pd_kidclass_secondrec", dic1);
                    if (intresult > 0)
                    {
                        alert.Icon    = Icon.Information;
                        alert.Message = "成功移除数据";
                        PageContext.RegisterStartupScript("preview();");
                    }


                    alert.Show();
                }
            }


            if (intresult > 0)
            {
                alert.Icon    = Icon.Information;
                alert.Message = "成功移除数据";
                PageContext.RegisterStartupScript("preview();");
            }


            alert.Show();
        }