示例#1
0
        public string validOrder(string orderName)
        {
            string rtn = "";

            if (orderName.IndexOf("_") > 0)
            {
                string[] nameCode = orderName.Split('_');
                if (nameCode.Length == 2)
                {
                    string code = nameCode[1];
                    verifyCode = code;
                    try
                    {
                        string strOrder = webService.isExistOrder(code, CurrentUser.UserName);
                        if (strOrder.Length > 2)
                        {
                            vjList = getValidate(strOrder);
                            if (vjList.name.Length > 0)
                            {
                                return(rtn);
                            }
                            string pType = vjList.peopleType;
                        }
                        else if (strOrder == "-1")
                        {
                            rtn = "验证码不存在,或者被使用,";
                        }
                        else if (strOrder == "-2")
                        {
                            rtn = "门店用户未设置所属门店,";
                        }
                        else if (strOrder == "-3")
                        {
                            rtn = "订单预约门店与使用门店不同,";
                        }
                        else if (strOrder == "-4")
                        {
                            rtn = "订单状态不可用,";
                        }
                    }
                    catch (Exception ex)
                    {
                        rtn = "验证时出错";
                        string er = ex.ToString();
                        LogHelper.WriteLog(ex.ToString());
                    }
                }
                else
                {
                    rtn = "验证码录入有误,";
                }
            }
            else
            {
                rtn = "验证码录入有误,";
            }
            return(rtn);
        }
示例#2
0
        private ValidateJson getValidate(string strJson)
        {
            ValidateJson vj = new ValidateJson();

            try
            {
                vj = JsonConvert.DeserializeObject <ValidateJson>(strJson);
            }
            catch (Exception ex)
            {
                string ss = ex.ToString();
            }
            return(vj);
        }
示例#3
0
        public bool uploadInfo()
        {
            bool   rtn       = false;
            string code      = "";
            bool   isCorrect = false;
            string errormsg  = "";
            string name      = "";

            if (File.Exists(testFile))
            {
                if (File.Exists(sourceFile))
                {
                    File.Delete(sourceFile);
                }
                File.Copy(testFile, sourceFile);
                FileInfo fileInfo = new FileInfo(sourceFile);

                //有最新文件,开始上传数据
                //先检查数据源中的校验码是否正确
                Excel.ApplicationClass excel = new Excel.ApplicationClass();
                //MessageBox.Show(excel.Version);
                excel.Visible = false;
                excel.Workbooks.Open(sourceFile, Type.Missing, Type.Missing, Type.Missing, "halleluja", Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);


                Excel.Worksheet ws = (Excel.Worksheet)excel.Worksheets[2];
                name           = ((Excel.Range)ws.Cells[3, 3]).Text.ToString();
                sourceFileName = name;
                excel.Quit();

                IntPtr t = new IntPtr(excel.Hwnd);
                int    k = 0;
                GetWindowThreadProcessId(t, out k);
                System.Diagnostics.Process p = System.Diagnostics.Process.GetProcessById(k);
                p.Kill();

                if (name.IndexOf("_") > 0)
                {
                    string[] nameCode = name.Split('_');
                    if (nameCode.Length == 2)
                    {
                        code       = nameCode[1];
                        verifyCode = code;
                        try
                        {
                            string strOrder = webService.isExistOrder(code, CurrentUser.UserName);
                            if (strOrder.Length > 2)
                            {
                                vjList = getValidate(strOrder);
                                if (vjList.name.Length > 0)
                                {
                                    isCorrect = true;
                                }
                                string pType = vjList.peopleType;
                                //if (pType == "1")
                                //{
                                //    isAdult = false;
                                //}
                                //else
                                //{
                                //    isAdult = true;
                                //}
                            }
                            else if (strOrder == "-1")
                            {
                                errormsg = "验证码不存在,或者被使用,";
                            }
                            else if (strOrder == "-2")
                            {
                                errormsg = "门店用户未设置所属门店,";
                            }
                            else if (strOrder == "-3")
                            {
                                errormsg = "订单预约门店与使用门店不同,";
                            }
                            else if (strOrder == "-4")
                            {
                                errormsg = "订单状态不可用,";
                            }
                        }
                        catch (Exception ex)
                        {
                            string er = ex.ToString();
                            LogHelper.WriteLog(ex.ToString());
                        }
                    }
                    else
                    {
                        errormsg = "验证码录入有误,";
                    }
                }
                else
                {
                    errormsg = "验证码录入有误,";
                }


                //上传文件到服务器
                //verifyCode = "hahahaha";
                FTPUpLoad();

                //有更新文件,但是文件有问题
                if (!isCorrect)
                {
                    File.Delete(sourceFile);
                    //SetValue("ChangeTime", latestTime);
                    LogHelper.WriteLog(sourceFileName + "-" + errormsg + "文件存在问题,云端处理数据失败!");
                    //XtraMessageBox.Show(sourceFileName + "-" + errormsg + "云端处理数据失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(false);
                }
                //SetValue("ChangeTime", latestTime);
                LogHelper.WriteLog("开始云端处理数据");
                copyTemp();
                //上传数据
                //Thread thdSub = new Thread(new ThreadStart(ThreadFun));
                //thdSub.Start();
                rtn = ThreadFun();
            }
            return(rtn);
        }