/// <summary>
        /// 导出重量设计结果为对应的SyswareDataObject.xml
        /// </summary>
        /// <param name="result"></param>
        /// <param name="isAddChildren"></param>
        /// <returns></returns>
        public static string saveWeightArithmeticDataObjectToXml(WeightArithmetic result, bool isAddChildren)
        {
            string path = null;

            try
            {
                SyswareDataObject sdo = new SyswareDataObject();
                if (isAddChildren)
                {
                    SyswareDataObject subSdo = new SyswareDataObject();
                    sdo.name = result.DataName;
                    sdo.children.Add(transFormWeightArithmeticToDataObject(-1, result.ExportDataToWeightSort().lstWeightData)[0]);
                }
                else
                {
                    sdo.name = "重量设计结果";
                    SyswareDataObject subSdo = new SyswareDataObject();
                    subSdo.name     = result.DataName;
                    subSdo.children = transFormWeightArithmeticToDataObject(-1, result.ExportDataToWeightSort().lstWeightData);
                    sdo.children.Add(subSdo);
                }
                XmlDocument myXmlDoc = saveSyswareDataObjectToXML(null, null, sdo);
                path = System.IO.Path.GetTempPath() + System.IO.Path.GetRandomFileName() + ".xml";
                //将xml文件保存到临时路径下
                myXmlDoc.Save(path);
            }
            catch
            {
                // XLog.Write("无法保存重量设计XML." + e.Message);

                return(null);
            }

            return(path);
        }
Beispiel #2
0
        /// <summary>
        /// 确认按钮单击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (this.weightResultTree.SelectedNode == null)
            {
                return;
            }
            int i = Convert.ToInt16(this.weightResultTree.SelectedNode.ToolTipText);

            if (flag == 0)
            {
                WeightArithmetic wa = mainForm.designProjectData.lstWeightArithmetic[i];
                ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(wa.ExportDataToWeightSort(), 1);
            }
            else if (flag == 1)
            {
                WeightAdjustmentResultData ward = mainForm.designProjectData.lstAdjustmentResultData[i];
                ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(ward.weightAdjustData, 1);
            }
            else if (flag == 2)
            {
                WeightSortData wsd = WeightSortData.clsStringToWeightSortData(lstTypeWeight[i].MainSystem_Name);
                ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(wsd, 1);
            }
            else if (flag == 3)
            {
                WeightSortData wsd = WeightSortData.clsStringToWeightSortData(lstWeightDesign[i].MainSystem_Name);
                ((WeightAssessmentForm)this.Owner).saveWeightDataGridView(wsd, 1);
            }
            this.Close();
        }