protected void menuDelete_Click(object sender, EventArgs e)
        {
            FineUIPro.TreeNode treenode = firsttree.SelectedNode;

            string strID = treenode.NodeID.Trim();

            if (strID != "")
            {
                cd_thermal ct     = new cd_thermal();
                string     strtid = ct.isExistdata("cd_thermal", "pid", strID, "ID").Trim();

                if (strtid != "")
                {
                    List <Dictionary <string, string> > listdic = new List <Dictionary <string, string> >();
                    List <string> listTablename     = new List <string>();
                    Dictionary <string, string> dic = new Dictionary <string, string>();

                    dic.Add("cd_thermal", "cast(pid as varchar(36))='" + strID + "' ");
                    listdic.Add(dic);
                    listTablename.Add("cd_thermal");

                    dic = new Dictionary <string, string>();
                    dic.Add("cd_thermal_batch", "cast(tid as varchar(36))='" + strtid + "' ");
                    listdic.Add(dic);
                    listTablename.Add("cd_thermal_batch");

                    dic = new Dictionary <string, string>();
                    dic.Add("cd_thermal_indicator", "cast(tid as varchar(36))='" + strtid + "' ");
                    listdic.Add(dic);
                    listTablename.Add("cd_thermal_indicator");

                    dic = new Dictionary <string, string>();
                    dic.Add("pd_3d", "cast(pid as varchar(36))='" + strtid + "' ");
                    listdic.Add(dic);
                    listTablename.Add("pd_3d");

                    dic = new Dictionary <string, string>();
                    dic.Add("pd_blueprint", "cast(pid as varchar(36))='" + strtid + "' ");
                    listdic.Add(dic);
                    listTablename.Add("pd_blueprint");

                    dic = new Dictionary <string, string>();
                    dic.Add("pd_photo", "cast(pid as varchar(36))='" + strtid + "' ");
                    listdic.Add(dic);
                    listTablename.Add("pd_photo");

                    dic = new Dictionary <string, string>();
                    dic.Add("pd_cad", "cast(pid as varchar(36))='" + strtid + "' ");
                    listdic.Add(dic);
                    listTablename.Add("pd_cad");

                    int intresult = 0;

                    pd_machinekit pm = new pd_machinekit();
                    intresult = pm.deleteMutri(listdic, listTablename);

                    Alert alert = new Alert();

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

                    alert.Show();
                }
            }
        }
Beispiel #2
0
        protected void menuDelete_Click(object sender, EventArgs e)
        {
            FineUIPro.TreeNode treenode = firsttree.SelectedNode;

            string strID = treenode.NodeID.Trim();

            //需检查零件在组件和产品表中是否存在
            //未删除图片图纸
            if (strID != "")
            {
                pd_compongall_compose pcc = new pd_compongall_compose();
                pd_product_compose    ppc = new pd_product_compose();

                if (pcc.isExistdata("pd_compongall_compose", "composeID", strID, "ID").Trim() != "" &&
                    ppc.isExistdata("pd_product_compose", "ppid", strID, "ID").Trim() != "")
                {
                    Alert.Show("当前零件不能删除");
                    return;
                }

                List <Dictionary <string, string> > listdic = new List <Dictionary <string, string> >();
                List <string> listTablename     = new List <string>();
                Dictionary <string, string> dic = new Dictionary <string, string>();

                dic.Add("pd_machinekit", "cast(ID as varchar(36))='" + strID + "' ");
                listdic.Add(dic);
                listTablename.Add("pd_machinekit");

                dic = new Dictionary <string, string>();
                dic.Add("pd_machinekit_feature", "cast(pid as varchar(36))='" + strID + "' ");
                listdic.Add(dic);
                listTablename.Add("pd_machinekit_feature");

                dic = new Dictionary <string, string>();
                dic.Add("pd_3d", "cast(pid as varchar(36))='" + strID + "' ");
                listdic.Add(dic);
                listTablename.Add("pd_3d");

                dic = new Dictionary <string, string>();
                dic.Add("pd_blueprint", "cast(pid as varchar(36))='" + strID + "' ");
                listdic.Add(dic);
                listTablename.Add("pd_blueprint");

                dic = new Dictionary <string, string>();
                dic.Add("pd_photo", "cast(pid as varchar(36))='" + strID + "' ");
                listdic.Add(dic);
                listTablename.Add("pd_photo");

                dic = new Dictionary <string, string>();
                dic.Add("pd_cad", "cast(pid as varchar(36))='" + strID + "' ");
                listdic.Add(dic);
                listTablename.Add("pd_cad");

                int intresult = 0;

                pd_machinekit pm = new pd_machinekit();
                intresult = pm.deleteMutri(listdic, listTablename);

                inittree();

                Alert alert = new Alert();

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

                alert.Show();
            }
        }