コード例 #1
0
        public string GetSearchkidclassInfo()
        {
            StringBuilder sb = new StringBuilder();

            pd_machinekit pm = new pd_machinekit();

            System.Data.DataTable dt = pm.getkidclass();

            foreach (DataRow r in dt.Rows)
            {
                sb.Append(r["classname"].ToString().Trim() + ',');
            }

            return(sb.ToString().TrimEnd(','));
        }
コード例 #2
0
        public string GetSearchmachinekitInfo(string strmtypename)
        {
            StringBuilder sb = new StringBuilder();

            pd_machinekit pm = new pd_machinekit();

            System.Data.DataTable dt = pm.getmachinekit(strmtypename);

            foreach (DataRow r in dt.Rows)
            {
                sb.Append(r["mname"].ToString().Trim() + ',');
            }

            return(sb.ToString().TrimEnd(','));
        }
コード例 #3
0
        private void initbaseinfo(string strID)
        {
            if (strID.Trim() != "")
            {
                pd_machinekit         pm = new pd_machinekit();
                System.Data.DataTable dt = pm.getEditdata(strID);

                if (dt != null && dt.Rows.Count == 1)
                {
                    DataRow r = dt.Rows[0];
                    mname.Text              = r["mname"].ToString().Trim();
                    mcode.Text              = r["mcode"].ToString().Trim();
                    drawdate.SelectedDate   = System.DateTime.Parse(r["drawdate"].ToString().Trim());
                    designer.SelectedValue  = r["designer"].ToString().Trim();
                    checker.SelectedValue   = r["checker"].ToString().Trim();
                    stanarder.SelectedValue = r["stanarder"].ToString().Trim();
                    drawer.SelectedValue    = r["drawer"].ToString().Trim();
                    examiner.SelectedValue  = r["examiner"].ToString().Trim();
                    specifications.Text     = r["specifications"].ToString().Trim();
                }
            }
        }
コード例 #4
0
        private string getmcode(string strmtypeid)
        {
            pd_machinekit pm = new pd_machinekit();

            string strmcode   = pm.getmaxmcode(strmtypeid);
            string strprecode = pm.getpremcode(strmtypeid);

            if (strmcode.Length == 1)
            {
                strmcode = strprecode + "00" + strmcode;
            }
            else if (strmcode.Length == 2)
            {
                strmcode = strprecode + "0" + strmcode;
            }
            else
            {
                strmcode = strprecode + strmcode;
            }

            return(strmcode);
        }
コード例 #5
0
        private void inittree()
        {
            firsttree.Nodes.Clear();
            // 模拟从数据库返回数据表
            pd_machinekit pm    = new pd_machinekit();
            DataTable     table = pm.getBindTreeDataAsdt();

            DataSet ds = new DataSet();

            ds.Tables.Add(table);
            ds.Relations.Add("TreeRelation", ds.Tables[0].Columns["id"], ds.Tables[0].Columns["pid"]);

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                if (row.IsNull("pid"))
                {
                    FineUIPro.TreeNode node = new FineUIPro.TreeNode();
                    node.Text   = row["nodetext"].ToString();
                    node.NodeID = row["id"].ToString();

                    node.Attributes.Add("nodemenu", row["nodemenu"].ToString().Trim());

                    if (row["isclick"].ToString().Trim() == "2")
                    {
                        node.EnableClickEvent = true;
                    }

                    firsttree.Nodes.Add(node);
                    ResolveSubTree(row, node);
                }
            }

            getnodesum(firsttree.Nodes[0]);

            setrepeat();
        }
コード例 #6
0
        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();
                }
            }
        }
コード例 #7
0
        //图片
        protected void filePhoto_FileSelected(object sender, EventArgs e)
        {
            FineUIPro.TreeNode treenode = firsttree.SelectedNode;

            if (treenode != null && treenode.Attributes["nodemenu"].ToString().Trim() == "2")
            {
                pd_machinekit pm     = new pd_machinekit();
                string        strpid = treenode.NodeID.ToString().Trim();

                if (pm.isExistdata("pd_machinekit", "ID", strpid, "ID").Trim() == "")
                {
                    Alert.Show("请先保存零件基本信息");
                    return;
                }

                try
                {
                    if (filePhoto.HasFile)
                    {
                        string fileName = filePhoto.ShortFileName;

                        if (!commonLib.ValidateImgType(fileName))
                        {
                            Alert.Show("无效的文件类型!");
                            return;
                        }

                        fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
                        int    lastDotIndex = fileName.LastIndexOf(".");
                        string strfiletype  = fileName.Substring(lastDotIndex + 1).ToLower();
                        string strpname     = fileName.Substring(0, lastDotIndex);
                        fileName = DateTime.Now.Ticks.ToString() + fileName.Substring(lastDotIndex).Trim();

                        filePhoto.SaveAs(Server.MapPath("~/resources/photo/" + fileName));

                        imgPhoto.ImageUrl = "~/resources/photo/" + fileName;

                        // 清空文件上传组件
                        filePhoto.Reset();

                        Dictionary <string, string> dic = initPhotodic(strpid, strpname, fileName, strfiletype);

                        try
                        {
                            pd_photo pp          = new pd_photo();
                            string   strfilename = pp.isExistdata("pd_photo", "pid", strpid, "filename");

                            if (strfilename.Trim() != "")
                            {
                                strfilename = Server.MapPath("~/resources/photo/") + strfilename;

                                if (File.Exists(strfilename))
                                {
                                    File.Delete(strfilename);
                                }

                                pp.update(dic, "pd_photo", "pid", strpid);
                            }
                            else
                            {
                                dic.Add("ID", Guid.NewGuid().ToString());
                                dic.Add("pid", strpid);
                                pp.add(dic, "pd_photo");
                            }
                        }
                        catch
                        {
                        }
                    }
                }
                catch
                {
                }
            }
        }
コード例 #8
0
        //CAD图纸
        protected void filemxcad_FileSelected(object sender, EventArgs e)
        {
            FineUIPro.TreeNode treenode = firsttree.SelectedNode;

            if (treenode != null && treenode.Attributes["nodemenu"].ToString().Trim() == "2")
            {
                pd_machinekit pm     = new pd_machinekit();
                string        strpid = treenode.NodeID.ToString().Trim();

                if (pm.isExistdata("pd_machinekit", "ID", strpid, "ID").Trim() == "")
                {
                    Alert.Show("请先保存零件基本信息");
                    return;
                }

                try
                {
                    if (filemxcad.HasFile)
                    {
                        string fileName = filemxcad.ShortFileName;

                        if (!commonLib.ValidateCADType(fileName))
                        {
                            Alert.Show("无效的文件类型!");
                            return;
                        }

                        fileName = fileName.Replace(":", "_").Replace(" ", "_").Replace("\\", "_").Replace("/", "_");
                        int    lastDotIndex = fileName.LastIndexOf(".");
                        string strfiletype  = fileName.Substring(lastDotIndex + 1).ToLower();
                        string strpname     = fileName.Substring(0, lastDotIndex);
                        fileName = DateTime.Now.Ticks.ToString() + fileName.Substring(lastDotIndex).Trim();

                        filemxcad.SaveAs(Server.MapPath("~/resources/cad/" + fileName));

                        // 清空文件上传组件
                        filemxcad.Reset();

                        Dictionary <string, string> dic = initCADdic(strpid, strpname, fileName, strfiletype);

                        try
                        {
                            pd_cad pc          = new pd_cad();
                            string strfilename = pc.isExistdata("pd_cad", "pid", strpid, "filename");

                            if (strfilename.Trim() != "")
                            {
                                strfilename = Server.MapPath("~/resources/cad/") + strfilename;

                                if (File.Exists(strfilename))
                                {
                                    File.Delete(strfilename);
                                }

                                pc.update(dic, "pd_cad", "pid", strpid);
                            }
                            else
                            {
                                dic.Add("ID", Guid.NewGuid().ToString());
                                dic.Add("pid", strpid);
                                pc.add(dic, "pd_cad");
                            }


                            PageContext.RegisterStartupScript("openwebcad('http://" + Request.Url.Authority.Trim() + "/resources/cad/" + fileName + "')");
                        }
                        catch
                        {
                        }
                    }
                }
                catch
                {
                }
            }
        }
コード例 #9
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();
            }
        }
コード例 #10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            FineUIPro.TreeNode treenode = firsttree.SelectedNode;

            if (treenode != null && treenode.Attributes["nodemenu"].ToString().Trim() == "2")
            {
                string strID      = treenode.NodeID.ToString().Trim();
                string strmtypeid = treenode.ParentNode.NodeID.Trim();

                Dictionary <string, string> dic = initDatadic();
                dic.Add("mtypeid", strmtypeid);

                pd_machinekit pm        = new pd_machinekit();
                int           intresult = 0;

                if (pm.isExistdata("pd_machinekit", "ID", strID, "ID").Trim() == "")
                {
                    if (pm.isExistdata("mname", dic["mname"].ToString().Trim(), strID, false).Trim() == "" &&
                        pm.isExistdata("mcode", dic["mcode"].ToString().Trim(), strID, false).Trim() == "")
                    {
                        dic.Add("ID", strID);
                        intresult = pm.add(dic, "pd_machinekit");
                    }
                    else
                    {
                        Alert.Show("零件名称或零件编码已经存在");
                        return;
                    }
                }
                else
                {
                    if (pm.isExistdata("mname", dic["mname"].ToString().Trim(), strID, true).Trim() == "" &&
                        pm.isExistdata("mcode", dic["mcode"].ToString().Trim(), strID, true).Trim() == "")
                    {
                        pd_compongall_compose pcc = new pd_compongall_compose();
                        pd_product_compose    ppc = new pd_product_compose();

                        if (pcc.isExistdata("pd_compongall_compose", "ID", strID, "ID").Trim() != "" &&
                            ppc.isExistdata("pd_product_compose", "ID", strID, "ID").Trim() != "")
                        {
                            Alert.Show("当前零件不能修改名称编码");
                            return;
                        }

                        intresult = pm.update(dic, "pd_machinekit", "cast(ID as varchar(36))", strID);
                    }
                    else
                    {
                        Alert.Show("零件名称或零件编码已经存在");
                        return;
                    }
                }

                inittree();

                Alert alert = new Alert();

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

                alert.Show();
            }
        }