コード例 #1
0
        /// <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);
        }
コード例 #2
0
        /// <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 void btnConfirm_Click(object sender, EventArgs e)
        {
            //System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex("[\\*\\\\/:?<>|\"]");

            if (txtName.Text == string.Empty)
            {
                MessageBox.Show("算法名称不能为空!");
                return;
            }
            else
            {
                if (Verification.IsCheckSignleString(txtName.Text))
                {
                    MessageBox.Show("算法名称包含非法字符!");
                    txtName.Focus();
                    return;
                }
            }

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

            //更新节点
            waData.FormulaList.Clear();
            foreach (TreeNode node in treeViewWeightSortNode.Nodes[0].Nodes)
            {
                waData.FormulaList.Add((NodeFormula)node.Tag);
            }

            List <WeightParameter> templistpara = waData.GetParaList();
            bool bParaPrompt = false;

            foreach (WeightParameter wp in templistpara)
            {
                //if (wp.ParaType == 10 && wp.ParaUnit.Length == 0 && wp.ParaRemark.Length == 0)
                if (wp.ParaType == 10)
                {
                    bParaPrompt = true;
                    break;
                }
            }

            if (bParaPrompt)
            {
                if (MessageBox.Show("算法中含有未定义参数(临时参数)!\r\n保存算法前是否对这些参数进行设定?", "参数定义", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    List <WeightParameter> listparaforset = new List <WeightParameter>();
                    foreach (WeightParameter wp in templistpara)
                    {
                        // if (wp.ParaType == 10 && wp.ParaUnit.Length == 0 && wp.ParaRemark.Length == 0)
                        if (wp.ParaType == 10)
                        {
                            listparaforset.Add(wp);
                        }
                    }
                    TempWeightParaSet form = new TempWeightParaSet(listparaforset);
                    form.ShowDialog();
                }
            }

            bool bprompt = (strType == "edit") ? false : true;

            waData.Name           = txtName.Text;
            waData.CreateTime     = dateTimePickerCreateTime.Text;
            waData.LastModifyTime = dateTimePickerLastModifyTime.Text;
            waData.Remark         = txtRemark.Text;

            if (WriteArithmeticFile(waData, bprompt) == false)
            {
                return;
            }

            strCoreEnvelopeArithmeticFileName = waData.Name;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #4
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (txtName.Text == string.Empty)
            {
                MessageBox.Show("算法名称不能为空!");
                return;
            }
            else
            {
                if (Verification.IsCheckSignleString(txtName.Text))
                {
                    MessageBox.Show("算法名称包含非法字符!");
                    txtName.Focus();
                    return;
                }
            }

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

            List <WeightParameter> templistpara = waData.GetParaList();
            bool bParaPrompt = false;

            foreach (WeightParameter wp in templistpara)
            {
                //if (wp.ParaType == 10 && wp.ParaUnit.Length == 0 && wp.ParaRemark.Length == 0)
                if (wp.ParaType == 10)
                {
                    bParaPrompt = true;
                    break;
                }
            }

            if (bParaPrompt)
            {
                if (MessageBox.Show("算法中含有未定义参数(临时参数)!\r\n保存算法前是否对这些参数进行设定?", "参数定义", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    List <WeightParameter> listparaforset = new List <WeightParameter>();
                    foreach (WeightParameter wp in templistpara)
                    {
                        //if (wp.ParaType == 10 && wp.ParaUnit.Length == 0 && wp.ParaRemark.Length == 0)
                        if (wp.ParaType == 10)
                        {
                            listparaforset.Add(wp);
                        }
                    }
                    TempWeightParaSet form = new TempWeightParaSet(listparaforset);
                    form.ShowDialog();
                }
            }

            bool bprompt = (strType == "edit") ? false : true;

            waData.SortName       = comboBoxWeightSort.Text;
            waData.Name           = txtName.Text;
            waData.CreateTime     = dateTimePickerCreateTime.Text;
            waData.LastModifyTime = dateTimePickerLastModifyTime.Text;
            waData.Remark         = txtRemark.Text;

            if (WriteArithmeticFile(waData, bprompt) == false)
            {
                return;
            }

            strWeightSortName           = waData.SortName;
            strWeightArithmeticFileName = waData.Name;

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #5
0
        /// <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();
        }