public ReusltIssueDBForm(string str_Type, Model.WeightArithmetic _weightArithmetic)
        {
            InitializeComponent();
            strType          = str_Type;
            weightArithmetic = _weightArithmetic;

            SetTitle();
            txtDesignDataName.Text = weightArithmetic.DataName;
        }
        public WeightArithmetic Clone()
        {
            WeightArithmetic weight = new WeightArithmetic();

            weight.DataName       = this.DataName;
            weight.Name           = this.Name;
            weight.SortName       = this.SortName;
            weight.CreateTime     = this.CreateTime;
            weight.LastModifyTime = this.LastModifyTime;
            weight.Remark         = this.Remark;

            List <WeightFormula> lstWeightFormula = new List <WeightFormula>();

            foreach (WeightFormula formula in FormulaList)
            {
                lstWeightFormula.Add(formula.Clone());
            }
            weight.FormulaList = lstWeightFormula;

            return(weight);
        }
        static public WeightArithmetic ReadArithmeticData(string filename)
        {
            System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);

            XmlDocument doc = new XmlDocument();

            try
            {
                doc.Load(filename);
            }
            catch
            {
                MessageBox.Show("打开文件错误!");
                return(null);
            }


            XmlNode xmlnode = doc.SelectSingleNode("重量算法/算法名称");

            if (xmlnode == null)
            {
                MessageBox.Show("错误的算法文件!");
                return(null);
            }

            WeightArithmetic wa = new WeightArithmetic();

            wa.Name = xmlnode.InnerText;

            xmlnode           = doc.SelectSingleNode("重量算法/算法创建时间");
            wa.CreateTime     = xmlnode.InnerText;
            xmlnode           = doc.SelectSingleNode("重量算法/重量分类");
            wa.SortName       = xmlnode.InnerText;
            xmlnode           = doc.SelectSingleNode("重量算法/算法最后修改时间");
            wa.LastModifyTime = xmlnode.InnerText;
            xmlnode           = doc.SelectSingleNode("重量算法/算法备注");
            wa.Remark         = xmlnode.InnerText;
            xmlnode           = doc.SelectSingleNode("重量算法/公式列表");

            Dictionary <WeightParameter, WeightParameter> wpDict = new Dictionary <WeightParameter, WeightParameter>();

            foreach (XmlNode xmlsubnode in xmlnode.ChildNodes)
            {
                WeightFormula wf = new WeightFormula();
                wf.NodePath = xmlsubnode.ChildNodes[0].InnerText;
                wf.Formula  = xmlsubnode.ChildNodes[1].InnerText;

                foreach (XmlNode paranode in xmlsubnode.ChildNodes[2].ChildNodes)
                {
                    string name = paranode.ChildNodes[0].InnerText;
                    string unit = paranode.ChildNodes[2].InnerText;

                    WeightParameter wpGlobal = FindGlobleParameters(name, unit)[0];

                    WeightParameter wp = null;
                    if (wpGlobal == null)
                    {
                        wp            = new WeightParameter();
                        wp.ParaName   = name;
                        wp.ParaUnit   = unit;
                        wp.ParaType   = 10;// int.Parse(paranode.ChildNodes[2].InnerText);
                        wp.ParaValue  = double.Parse(paranode.ChildNodes[1].InnerText);
                        wp.ParaRemark = paranode.ChildNodes[4].InnerText;

                        WeightParameter temp10wp = new WeightParameter(wp);

                        WeightParameter.GetWeightParameterList()[10].Add(temp10wp);

                        wpDict.Add(temp10wp, wp);
                    }
                    else
                    {
                        if (!wpDict.ContainsKey(wpGlobal))
                        {
                            wp = new WeightParameter(wpGlobal);
                            wpDict.Add(wpGlobal, wp);
                        }
                        else
                        {
                            wp = wpDict[wpGlobal];
                        }
                    }
                    wf.ParaList.Add(wp);
                }

                if (xmlsubnode.ChildNodes.Count >= 4)
                {
                    wf.Value = double.Parse(xmlsubnode.ChildNodes[3].InnerText);
                }

                wa.FormulaList.Add(wf);
            }

            return(wa);
        }