private bool ValidateInfo() { bool rtn = true; if (this.txtName.Text.Length == 0) { XtraMessageBox.Show("请输入姓名", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); rtn = false; } else if (this.txtSex.SelectedIndex < 0) { XtraMessageBox.Show("请选择性别", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); rtn = false; } else if (this.txtBirthDay.Text.Length == 0) { XtraMessageBox.Show("请输入出生日期", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); rtn = false; } else if (this.txtBirthPlace.Text.Length == 0) { XtraMessageBox.Show("请输入出生地", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); rtn = false; } DataProcess dp = new DataProcess(); string msg = dp.validOrder(this.txtName.Text.Trim()); if (msg.Length > 0) { XtraMessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); rtn = false; } return(rtn); }
private bool GetReport() { bool rtn = false; string reportFile = System.Windows.Forms.Application.StartupPath + "/report.xlsm"; string sourceFile = System.Windows.Forms.Application.StartupPath + "/clarity.xls"; string dataFile = System.Windows.Forms.Application.StartupPath + "/data.xml"; string testFile = ConfigurationManager.AppSettings["sourceAddress"]; FileInfo fileInfo = new FileInfo(testFile); SysVar.dtNow = DateTime.Parse(fileInfo.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss")); //有最新文件,开始上传数据 if (DateTime.Compare(SysVar.dtNow, SysVar.dtOld) > 0) { SysVar.dtOld = SysVar.dtNow; DataProcess dp = new DataProcess(reportFile, sourceFile, testFile, dataFile); rtn = dp.uploadInfo(); } else { rtn = false; // XtraMessageBox.Show("测试数据没有生成,请重新测试,如果还是不成功请联系管理员!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); LogHelper.WriteLog("测试数据没有生成,请重新测试,如果还是不成功请联系管理员!"); } return(rtn); }