private void initinfo(string strID)
        {
            pd_kidclass_main ul = new pd_kidclass_main();

            System.Data.DataTable dt = ul.getEditdata(strID);
            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow r = dt.Rows[0];

                editID.Text       = strID;
                editmainname.Text = r["mainname"].ToString().Trim();
                editorder.Text    = r["orderint"].ToString().Trim();
                editcode.Text     = r["maincode"].ToString().Trim();
            }
            else
            {
                pd_kidclass_secondary ul1 = new pd_kidclass_secondary();
                DataTable             dt1 = ul1.getEditdata(strID);
                DataRow r = dt1.Rows[0];

                editID.Text       = strID;
                editmainname.Text = r["classname"].ToString().Trim();
                editorder.Text    = r["orderint"].ToString().Trim();
                editcode.Text     = r["darycode"].ToString().Trim();
            }
        }
        private void displaydetailinfo(string NodeID)
        {
            pd_kidclass_main um = new pd_kidclass_main();

            System.Data.DataTable dt = um.getEditdata(NodeID);

            string strhtml = "空白详细信息";

            firsttree.UncheckAllNodes();

            if (dt != null && dt.Rows.Count > 0)
            {
                strhtml = "<div style=\"line-height:27px;\">";
                foreach (System.Data.DataRow r in dt.Rows)
                {
                    strhtml += "类别名:" + r["mainname"] + "<br/>序号:" + r["orderint"].ToString().Trim() + "<br/>编码:" + r["maincode"].ToString().Trim() + "<br/>创建时间:" +
                               r["adddate"].ToString().Trim() + "";
                    pd_kidclass_mainmpic mainpic = new pd_kidclass_mainmpic();
                    DataTable            picdt   = mainpic.getEditdata(r["ID"].ToString());
                    if (picdt != null && picdt.Rows.Count > 0)
                    {
                        strhtml += "<br/>主类别特性指标:";
                        foreach (DataRow r1 in picdt.Rows)
                        {
                            strhtml += r1["mpci"] + ",";
                        }
                    }
                }

                strhtml += "</div>";
            }
            else
            {
                pd_kidclass_secondary second = new pd_kidclass_secondary();
                System.Data.DataTable dt1    = second.getEditdata(NodeID);
                if (dt1 != null && dt1.Rows.Count > 0)
                {
                    strhtml = "<div style=\"line-height:27px;\">";
                    foreach (System.Data.DataRow r in dt1.Rows)
                    {
                        strhtml += "类别名:" + r["classname"] + "<br/>序号:" + r["orderint"].ToString().Trim() + "<br/>编码:" + r["darycode"].ToString().Trim() + "<br/>创建时间:" +
                                   r["adddate"].ToString().Trim() + "";
                        pd_kidclass_secondrec mainpic = new pd_kidclass_secondrec();
                        DataTable             picdt   = mainpic.getEditdata(r["ID"].ToString());
                        if (picdt != null && picdt.Rows.Count > 0)
                        {
                            strhtml += "<br/>特性指标:";
                            foreach (DataRow r1 in picdt.Rows)
                            {
                                strhtml += r1["mpci"] + ",";
                            }
                        }
                    }

                    strhtml += "</div>";
                }
            }
            detailinfo.Text = strhtml;
        }
        protected void btnMpci_Click(object sender, EventArgs e)
        {
            FineUIPro.TreeNode treenode = firsttree.SelectedNode;
            editclassID.Text = treenode.NodeID;
            pd_kidclass_main ul = new pd_kidclass_main();
            DataTable        dt = ul.getEditdata(treenode.NodeID);

            if (dt != null && dt.Rows.Count > 0)
            {
                mainmpicWindow.Hidden = false;
                mainmpicweditID.Text  = treenode.NodeID;
                setPageContent(1);
            }
            else
            {
                secondrecWin.Hidden     = false;
                secondrecWineditID.Text = treenode.NodeID;
                setPageContent1(1);
            }
        }
        protected void btnSave1_Click(object sender, EventArgs e)
        {
            Alert            alert = new Alert();
            string           strID = editclassID.Text.ToString().Trim();
            pd_kidclass_main ul    = new pd_kidclass_main();
            int intresult          = 0;

            if (ul.isExistdata("pd_kidclass_main", "ID", strID, "ID").Trim() != "")
            {
                DataTable dt = ul.getEditdata(strID, editmainname.Text.Trim());
                if (dt != null && dt.Rows.Count > 0)
                {
                    alert.Icon    = Icon.Information;
                    alert.Message = "名称已存在";
                    return;
                }
                else if (ul.isExistdata("pd_kidclass_main", "maincode", editcode.Text.Trim(), "maincode").Trim() != "")
                {
                    alert.Icon    = Icon.Information;
                    alert.Message = "编码已存在";
                    return;
                }
                else
                {
                    Dictionary <string, string> dic = initDatadicmain(editmainname.Text.Trim(), editorder.Text.Trim(), editcode.Text.Trim());
                    string strmainname = dic["mainname"].ToString().Trim();

                    intresult = ul.update(dic, "pd_kidclass_main", "ID", strID);
                }
            }
            else
            {
                pd_kidclass_secondary ul1 = new pd_kidclass_secondary();
                DataTable             dt  = ul1.getEditdatabyname(strID, editmainname.Text.Trim());
                if (dt != null && dt.Rows.Count > 0)
                {
                    alert.Icon    = Icon.Information;
                    alert.Message = "名称已存在";
                    return;
                }
                else if (ul.isExistdata("pd_kidclass_secondary", "darycode", editcode.Text.Trim(), "darycode").Trim() != "")
                {
                    alert.Icon    = Icon.Information;
                    alert.Message = "编码已存在";
                    return;
                }
                else
                {
                    Dictionary <string, string> dic = initDatadicsecondedit(editmainname.Text.Trim(), editorder.Text.Trim(), editcode.Text.Trim());
                    string strmainname = dic["classname"].ToString().Trim();

                    intresult = ul.update(dic, "pd_kidclass_secondary", "ID", strID);
                }
            }


            if (intresult == 1)
            {
                alert.Icon    = Icon.Information;
                alert.Message = "数据保存成功";
            }

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