protected void btnCheckout_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtVoluntarilyTime.Text.Trim())) { txtVoluntarilyTime.Focus(); MessageBox.Show(this, "执行时间不能为空"); return; } else if (string.IsNullOrEmpty(TextBoxValidateDate.Text.Trim())) { TextBoxValidateDate.Focus(); MessageBox.Show(this, "首次执行日期不能为空"); return; } else if (string.IsNullOrEmpty(TextBoxFileFormatName.Text.Trim())) { TextBoxFileFormatName.Focus(); MessageBox.Show(this, "格式化文件名称不能为空"); return; } //else if (gridviewVariable.Rows.Count <= 0) //{ // TxtFormatVariable.Focus(); // MessageBox.Show(this, "请添加格式名称变量!"); // return; //} else { Config model = new Config(); string voltime = TextBoxValidateDate.Text.Trim() + " " + txtVoluntarilyTime.Text.Trim(); model.VoluntarilyTime = Convert.ToDateTime(voltime); model.FileFormatName = TextBoxFileFormatName.Text.Trim(); model.BecomeValidateDate = Convert.ToDateTime(TextBoxValidateDate.Text.Trim()); model.NextVoluntarilyTime = DateTime.Now; List <ConfigFileFormatNameParm> parm = new List <ConfigFileFormatNameParm>(); foreach (GridViewRow row in gridviewVariable.Rows) { ConfigFileFormatNameParm para = new ConfigFileFormatNameParm(); para.Name = row.Cells[2].Text.Trim(); para.VariableType = row.Cells[3].Text.Trim(); para.DataSource = row.Cells[4].Text.Trim(); para.Connector = row.Cells[5].Text.Trim(); parm.Add(para); } DAL_Execute bll = new DAL_Execute(); txtCheckFileName.Text = bll.GetFileFormatName(parm, model); } }
protected void btnVariable_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TextBoxFileFormatName.Text.Trim())) { TextBoxFileFormatName.Focus(); MessageBox.Show(this, "格式化文件名称不能为空"); return; } if (string.IsNullOrEmpty(TxtFormatVariable.Text.Trim())) { TxtFormatVariable.Focus(); MessageBox.Show(this, "格式化文件变量名称不能为空"); return; } else { if (!TextBoxFileFormatName.Text.Trim().Contains(TxtFormatVariable.Text.Trim())) { TxtFormatVariable.Focus(); MessageBox.Show(this, "格式化文件变量名称不存在"); return; } } string varstr = TxtFormatVariable.Text.Trim(); int leg = TxtFormatVariable.Text.Length; foreach (GridViewRow row in gridviewVariable.Rows) { string rowtext = row.Cells[2].Text.Trim(); if (varstr == rowtext) { TxtFormatVariable.Focus(); MessageBox.Show(this, "已包含同名的格式化文件变量名称"); return; } else { int rowleg = row.Cells[2].Text.Trim().Length; if (leg >= rowleg) { TxtFormatVariable.Focus(); MessageBox.Show(this, "格式化文件变量名称遵循字符串长度递减规则"); return; } } } AddRowGridviewVariable(); lblVariable.Visible = true; }