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 reportFile = "c:/clasp32/data" + "/test.xlsm"; string sourceFile = "c:/clasp32/data" + "/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) if (File.Exists(testFile)) { //SysVar.dtOld = SysVar.dtNow; DataProcess dp = new DataProcess(reportFile, sourceFile, testFile, dataFile); rtn = dp.uploadInfo(0, ""); } else { rtn = false; // XtraMessageBox.Show("测试数据没有生成,请重新测试,如果还是不成功请联系管理员!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); LogHelper.WriteLog("测试数据没有生成,请重新测试,如果还是不成功请联系管理员!"); } return(rtn); }
private void simpleButton3_Click(object sender, EventArgs e) { Identity.i_address = null; Identity.i_birth_day = null; Identity.i_code = null; Identity.i_name = null; Identity.i_sex = null; OrderList ol = new OrderList(); if (getICCard()) { //if (true) { DataProcess dp = new DataProcess(); string name = Identity.i_code; string msg = dp.getInfoByID(name); if (msg.Length == 0) { XtraMessageBox.Show("验证身份证时出错,请重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (msg == "-1") { XtraMessageBox.Show("没有未使用的订单!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (msg == "-2") { XtraMessageBox.Show("未找到联系人!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (msg == "-3") { XtraMessageBox.Show("未查询到诊疗师信息或者未绑定门店!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { ol = getOrder(msg); List <OrderData> olist = ol.datas; OrderSelect osFrm = new OrderSelect(olist); if (osFrm.ShowDialog() == DialogResult.OK) { txtCode.Text = osFrm.verifyCode; txtBirthDay.Text = Identity.i_birth_day; txtName.Text = Identity.i_name; txtSex.Text = Identity.i_sex; //txtBirthPlace.Text = getPlace("北京市市辖区朝阳区"); txtBirthPlace.Text = getPlace(Identity.i_address); osFrm.Close(); } } } }
private void testUpload() { //string reportFile = System.Windows.Forms.Application.StartupPath + "/report.xlsm"; //string sourceFile = System.Windows.Forms.Application.StartupPath + "/clarity.xls"; Patient.w_code = txtCode.Text.Trim(); string reportFile = "c:/clasp32/data" + "/test.xlsm"; string sourceFile = "c:/clasp32/data" + "/clarity.xls"; string dataFile = System.Windows.Forms.Application.StartupPath + "/data.xml"; string testFile = ConfigurationManager.AppSettings["sourceAddress"]; DataProcess dp = new DataProcess(reportFile, sourceFile, testFile, dataFile); string infoStr = dp.GetInfoData(txtCode.Text.Trim()); StreamWriter strmsave = new StreamWriter("E:\\InfoTestTxt.txt", false, System.Text.Encoding.Default); strmsave.Write(infoStr); strmsave.Close(); }
private bool ValidateInfo() { bool rtn = true; if (this.txtCode.Text.Length == 0) { XtraMessageBox.Show("请输入校验码", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); rtn = false; } 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.validCode(this.txtCode.Text.Trim()); if (msg.Length > 0) { XtraMessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); rtn = false; } return(rtn); }
private void checkSheet() { if (this.txtCode.Text.Length == 0) { XtraMessageBox.Show("请输入校验码", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } DataProcess dp = new DataProcess(); string result = dp.getResult(this.txtCode.Text.ToString().Trim()); if (result == "-1") { XtraMessageBox.Show("校验码不存在", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (result == "-2") { XtraMessageBox.Show("没有自检信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { FrmCheckSheet cs = new FrmCheckSheet(result); cs.Show(); } }
private int SourceProcess(FileInfo file) { string filename = file.Name; string[] fileDetail = filename.Split('.'); string verifyCode = ""; if (fileDetail.Length == 2) { verifyCode = fileDetail[0]; string fileType = fileDetail[1]; //文件有问题,删除文件 if (fileType != "bak") { File.Delete(file.FullName); return(-1); } DataProcess dpN = new DataProcess(); string msg = dpN.validCode(verifyCode); //校验码有问题,删除文件 if (msg.Length > 0) { if (msg != "验证时出错") { File.Delete(file.FullName); } return(-1); } } else { File.Delete(file.FullName); return(-1); //文件有问题 } //开始处理文件 string testFile = System.Windows.Forms.Application.StartupPath + "/WaitedSource/clarity.xls"; if (File.Exists(testFile)) { File.Delete(testFile); } string tempSource = file.FullName; copyStream(testFile, tempSource); string reportFile = "c:/clasp32/data" + "/test.xlsm"; string sourceFile = "c:/clasp32/data" + "/clarity.xls"; string dataFile = System.Windows.Forms.Application.StartupPath + "/data.xml"; DataProcess dp = new DataProcess(reportFile, sourceFile, testFile, dataFile); bool rtn = dp.uploadInfo(1, verifyCode); if (File.Exists(testFile)) { File.Delete(testFile); } if (rtn) { File.Delete(file.FullName); return(1); //成功 } else { return(0); //失败 } }