Ejemplo n.º 1
0
        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());

            orderType = dp.getTL(this.txtCode.Text.Trim());
            if (msg.Length > 0)
            {
                XtraMessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                rtn = false;
            }
            return(rtn);
        }
Ejemplo n.º 2
0
        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); //失败
            }
        }