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(); }
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(); }
/// <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); }