Exemplo n.º 1
0
        protected void deletesecondrec_Click(object sender, EventArgs e)
        {
            int[] intRowindexarray = Grid1.SelectedRowIndexArray;

            if (intRowindexarray.Length > 0)
            {
                pd_kidclass_secondrec ul = new pd_kidclass_secondrec();
                object[] keys            = Grid1.DataKeys[intRowindexarray[0]];
                string   strID           = keys[0].ToString();
                if (ul.isExistdata("pd_machinekit_feature", "featureid", strID, "featureid").Trim() != "")
                {
                    Alert.Show("该特性已被零件使用不能删除!");
                    return;
                }
                else
                {
                    Dictionary <string, string> dic = new Dictionary <string, string>();
                    dic.Add("ID", " cast(ID as varchar(36))='" + strID + "' ");

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

                    setPageContent1(5);

                    Alert alert = new Alert();

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

                    alert.Show();
                }
            }
        }
Exemplo n.º 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();
        }