/// <summary>
        /// 获取页面验证信息
        /// </summary>
        /// <returns></returns>
        private string GetPageVerification()
        {
            string strErroInfo = string.Empty;

            //参数名称
            if (txtParameterName.Text == string.Empty)
            {
                strErroInfo = "请输入参数名称";
                return(strErroInfo);
            }
            else
            {
                if (txtParameterName.Text.Contains(" "))
                {
                    strErroInfo = "参数名称不能包含空格";
                    return(strErroInfo);
                }
                if (Verification.IsCheckString(txtParameterName.Text))
                {
                    strErroInfo = "请检查参数名称输入非法字符";
                    return(strErroInfo);
                }
            }

            //单位
            if (cmbUnit.Text == string.Empty)
            {
                strErroInfo = "请输入参数单位";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckString(cmbUnit.Text))
                {
                    strErroInfo = "请检查参数单位输入非法字符";
                    return(strErroInfo);
                }
            }

            if (cmbParameterType.Text == string.Empty)
            {
                strErroInfo = "请选择参数类型";
                return(strErroInfo);
            }

            if (txtParameterRemark.Text != string.Empty)
            {
                if (Verification.IsCheckRemarkString(txtParameterRemark.Text))
                {
                    strErroInfo = "参数备注含有非法字符";
                    return(strErroInfo);
                }
            }

            return(strErroInfo);
        }
        /// <summary>
        /// 页面验证
        /// </summary>
        /// <returns></returns>
        private string PageVerification()
        {
            string strErroInfo = string.Empty;

            if (txtProjectName.Text == string.Empty)
            {
                strErroInfo = "请输入工程名称";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckString(txtProjectName.Text))
                {
                    strErroInfo = "工程名称不能输入非法字符";
                    return(strErroInfo);
                }
            }

            if (txtCreator.Text == string.Empty)
            {
                strErroInfo = "请输入创建者";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckString(txtCreator.Text))
                {
                    strErroInfo = "创建者不能输入非法字符";
                    return(strErroInfo);
                }
            }

            if (txtRemark.Text != string.Empty)
            {
                if (Verification.IsCheckRemarkString(txtRemark.Text))
                {
                    strErroInfo = "备注不能输入非法字符";
                    return(strErroInfo);
                }
            }

            return(strErroInfo);
        }
        private string PageVerificationInfo()
        {
            string strErroInfo = string.Empty;

            if (txtPtName.Text == string.Empty)
            {
                strErroInfo = "请输入坐标点名称";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckString(txtPtName.Text))
                {
                    strErroInfo = "坐标点名称不能输入非法字符";
                    return(strErroInfo);
                }
            }

            return(strErroInfo);
        }
        private void btnCompute_Click(object sender, EventArgs e)
        {
            if (!bEditProject)
            {
                txtWeightEstName.Text = txtWeightEstName.Text.Trim();
                if (txtWeightEstName.Text.Length == 0)
                {
                    MessageBox.Show("设计数据名称不能为空!");
                    return;
                }

                if (Verification.IsCheckString(txtWeightEstName.Text))
                {
                    MessageBox.Show("设计数据名称含有非法字符");
                    return;
                }

                curWa.DataName = txtWeightEstName.Text;
            }

            for (int i = 0; i < curWa.FormulaList.Count; ++i)
            {
                CExpression expr = curExprList[2 * i];
                foreach (WeightParameter wp in curWa.FormulaList[i].XFormula.ParaList)
                {
                    expr.SetVariableValue(wp.ParaName, wp.ParaValue);
                }
                curWa.FormulaList[i].XFormula.Value = expr.Run();

                expr = curExprList[2 * i + 1];
                foreach (WeightParameter wp in curWa.FormulaList[i].YFormula.ParaList)
                {
                    expr.SetVariableValue(wp.ParaName, wp.ParaValue);
                }
                curWa.FormulaList[i].YFormula.Value = expr.Run();
            }

            // curWa.WriteArithmeticFile("test.xml", true);

            if (mainForm.designProjectData == null)
            {
                CoreDesignProject coreForm = new CoreDesignProject(mainForm, "new");
                coreForm.ShowDialog();
            }

            if (mainForm.designProjectData.lstCoreEnvelopeDesign == null)
            {
                mainForm.designProjectData.lstCoreEnvelopeDesign = new List <Model.CoreEnvelopeArithmetic>();
            }


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

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

            foreach (NodeFormula ndformula in curWa.FormulaList)
            {
                for (int i = 0; i < 2; ++i)
                {
                    WeightFormula          formula  = ndformula[i];
                    List <WeightParameter> ParaList = new List <WeightParameter>();
                    foreach (WeightParameter para in formula.ParaList)
                    {
                        WeightParameter tempWp = null;
                        if (!wpDict.ContainsKey(para))
                        {
                            tempWp = new WeightParameter(para);
                            wpDict.Add(para, tempWp);
                        }
                        else
                        {
                            tempWp = wpDict[para];
                        }
                        ParaList.Add(tempWp);
                    }
                    formula.ParaList = ParaList;
                }
            }
            if (!bEditProject)
            {
                mainForm.designProjectData.lstCoreEnvelopeDesign.Add(curWa);
                mainForm.BindProjectTreeData(mainForm.designProjectData);
                mainForm.SetCoreEnvelopeDesignTab(curWa, mainForm.designProjectData.lstCoreEnvelopeDesign.Count - 1);
                XLog.Write("设计数据\"" + txtWeightEstName.Text + "\"计算完成!");
            }
            else
            {
                //设置页面数据
                mainForm.SetCoreEnvelopeDesignResult(curWa);
                XLog.Write("设计数据\"" + txtWeightEstName.Text + "\"重新计算完成!");
            }

            DialogResult = DialogResult.OK;
            Close();
        }
        /// <summary>
        /// 页面验证
        /// </summary>
        /// <returns></returns>
        private string PageVerification()
        {
            string strErroInfo = string.Empty;

            if (txtDesignDataName.Text == string.Empty)
            {
                strErroInfo = "请输入设计数据名称";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckString(txtDesignDataName.Text))
                {
                    strErroInfo = "设计数据名称不能输入非法字符";
                    return(strErroInfo);
                }
            }

            if (txtDesignDataSumlieter.Text == string.Empty)
            {
                strErroInfo = "请输入设计数据提交者";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckString(txtDesignDataSumlieter.Text))
                {
                    strErroInfo = "设计数据提交者不能输入非法字符";
                    return(strErroInfo);
                }
            }

            if (txtHelicopterName.Text == string.Empty)
            {
                strErroInfo = "请输入直升机名称";
                return(strErroInfo);
            }
            else
            {
                if (Verification.IsCheckSignleString(txtHelicopterName.Text))
                {
                    strErroInfo = "直升机名称不能输入非法字符";
                    return(strErroInfo);
                }
            }

            if (txtDesignTakingWeight.Text != string.Empty)
            {
                if (Verification.IsDoubleNumer(txtDesignTakingWeight.Text) == false)
                {
                    strErroInfo = "设计起飞重量格式错误";
                    return(strErroInfo);
                }
            }

            if (txtDagtaRemark.Text != string.Empty)
            {
                if (Verification.IsCheckRemarkString(txtDagtaRemark.Text))
                {
                    strErroInfo = "数据备注不能输入非法字符";
                    return(strErroInfo);
                }
            }

            return(strErroInfo);
        }
예제 #6
0
        private void btnSaveNode_Click(object sender, EventArgs e)
        {
            string strChildName = txtNodeName.Text;

            if (strChildName == string.Empty)
            {
                MessageBox.Show("请输入节点名称!");
                return;
            }
            else
            {
                if (Verification.IsCheckString(strChildName))
                {
                    MessageBox.Show("节点名称含有非法字符!");
                    return;
                }
            }

            if (txtRemark.Text != string.Empty)
            {
                if (Verification.IsCheckRemarkString(txtRemark.Text))
                {
                    MessageBox.Show("节点备注含有非法字符!");
                    return;
                }
            }

            if (strOperType == "new")
            {
                TreeNode childNode = new TreeNode();
                childNode.Name        = strChildName;
                childNode.Text        = strChildName;
                childNode.ToolTipText = txtRemark.Text;

                if (selNode == null)
                {
                    if (treeViewWeightStructure.Nodes.Count == 0)
                    {
                        treeViewWeightStructure.Nodes.Add(childNode);
                        btnAddNode.Text = "添加子节点(&N)";
                        treeViewWeightStructure.SelectedNode = childNode;
                        selNode = childNode;
                    }
                    else
                    {
                        MessageBox.Show("请选择添加节点的位置!");
                        return;
                    }
                }
                else
                {
                    selNode.Nodes.Add(childNode);
                    selNode.Expand();

                    treeViewWeightStructure.SelectedNode = childNode.Parent;
                    selNode = childNode.Parent;

                    txtNodeName.Text = selNode.Text;
                    txtRemark.Text   = selNode.ToolTipText;
                }
            }
            //编辑
            if (strOperType == "edit")
            {
                selNode.Name        = txtNodeName.Text;
                selNode.Text        = txtNodeName.Text;
                selNode.ToolTipText = txtRemark.Text;
            }

            strOperType = "confirm";
            SettingControls();
        }
예제 #7
0
        /// <summary>
        /// 确定事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            string strSortName = txtWeightSortName.Text.Trim();

            if (strSortName.Length == 0)
            {
                MessageBox.Show("重量分类名称为空!");
                return;
            }
            else
            {
                if (Verification.IsCheckString(strSortName))
                {
                    MessageBox.Show("重量分类名称含有非法字符!");
                    return;
                }
            }

            if (treeViewWeightStructure.Nodes.Count == 0)
            {
                MessageBox.Show("重量分类必须有根节点!");
                return;
            }

            WeightSortData ws = null;

            if (strType == "edit" || strType == "readOnlyEdit")
            {
                foreach (WeightSortData tempwsd in WeightSortManageForm.GetListWeightSortData())
                {
                    if (tempwsd.sortName == strSortName)
                    {
                        ws = tempwsd;
                        ws.lstWeightData.Clear();
                    }
                }
                if (ws == null)
                {
                    MessageBox.Show("未知错误!");
                    return;
                }
            }
            else
            {
                ws = new WeightSortData();
            }
            ws.sortName = strSortName;

            int nNodeID = -1;

            for (int k = 0; k < treeViewWeightStructure.Nodes.Count; k++)
            {
                TreeNode          subnode       = treeViewWeightStructure.Nodes[k];
                List <WeightData> lstWeightData = ws.lstWeightData;

                //添加根节点
                WeightData rootWeightData = new WeightData();
                rootWeightData.nID        = ++nNodeID;
                rootWeightData.weightName = subnode.Text;
                rootWeightData.strRemark  = subnode.ToolTipText;
                rootWeightData.nParentID  = -1;

                lstWeightData.Add(rootWeightData);

                WriteTreeDataToList(subnode, ref lstWeightData, ref nNodeID);
            }

            if (WeightSortManageForm.SaveHccFile(ws, strType != "edit" && strType != "readOnlyEdit"))
            {
                if (strType == "edit" || strType == "readOnlyEdit")
                {
                    XLog.Write("编辑重量分类成功");
                }
                else
                {
                    if (strType == "new")
                    {
                        XLog.Write("新建重量分类成功");
                    }
                    if (strType == "JYNew")
                    {
                        XLog.Write("基于新建重量分类成功");
                    }
                    WeightSortManageForm.GetListWeightSortData().Add(ws);
                }
                DialogResult = DialogResult.OK;
                this.Close();
            }
        }