private void Create_new_region()
        {
            Report_Log_Instance("Step 02 : Create new region", Level.Root);

            Report_Log_Instance("Step 02.a : Open Region dialog and input information", Level.Level01);
            HomePage.InstancePO.Base_Open_Dialog_By_Searching_Text(SearchMenu.Region);
            using (RegionPage Region = new RegionPage())
            {
                code = Params["code"] + Randoms.NumberF04;
                name = Params["name"] + Randoms.NumberF04;
                var RegionTableObject = Region.RegionTable;
                VerifyHelper.Equal2(0, RegionTableObject.Get_number_rows_has_these_value($"{code},{RegionPage.COL_CODE}" +
                                                                                         $";{name},{ RegionPage.COL_NAME }" +
                                                                                         $";VN,{ RegionPage.COL_COUNTRY }"));
                Region.CodeTextbox.Press_hot_key("Ctrl+A");
                Region.Code    = code;
                Region.Country = Params["country"];
                Region.Name    = name;

                Region.Base_Click_To_Button(PageBase.Button.Add);
                Region.Base_wait_for_loading_page_completely();
                RegionTableObject.Refresh_Data();

                VerifyHelper.Equal2(1, RegionTableObject.Get_number_rows_has_these_value($"{code},{RegionPage.COL_CODE}" +
                                                                                         $";{name},{ RegionPage.COL_NAME }" +
                                                                                         $";VN,{ RegionPage.COL_COUNTRY }"));

                Region.Finish_dialog();
            }
        }
示例#2
0
        /// <summary>
        /// 获取ResultModel消息对象(根据Exception)
        /// </summary>
        public static ResultModel GetResult(Exception ex)
        {
            var result = new ResultModel()
            {
                Code = EnumHelper.GetValue(EnumResultCode.未知异常)
            };

            if (VerifyHelper.IsEmpty(ex))
            {
                return(result);
            }

            DefaultException defEx = ex as DefaultException;

            if (!VerifyHelper.IsEmpty(defEx))
            {
                result.Code    = EnumHelper.GetValue(defEx.Code);
                result.Message = defEx.Message;
                return(result);
            }

            MessageException msgEx = ex as MessageException;

            if (!VerifyHelper.IsEmpty(msgEx))
            {
                result.Code    = EnumHelper.GetValue(msgEx.Code);
                result.Message = msgEx.Message;
                return(result);
            }

            result.Message = ex.Message;
            return(result);
        }
        public ActionResult SMSCode(string account, string t)
        {
            try
            {
                if (!SSOClient.Validate(account, out SysUser user))
                {
                    return(Json(new { Code = 1, Msg = "帐号不存在,请重新输入!" }));
                }

                string code = VerifyHelper.CreateNumber(4);
                SMSService.Send(user.Mobile, code);
                dbContext.SysSmsCode.Add(new SysSmsCode()
                {
                    Id         = Guid.NewGuid(),
                    Mobile     = user.Mobile,
                    CreateTime = DateTime.Now,
                    OverTime   = DateTime.Now.AddMinutes(3),
                    IsVerify   = 0,
                    SmsCode    = code,
                    SmsSign    = t
                });
                dbContext.SaveChanges();
                return(Json(new { Code = 0, Msg = "发送成功!" }));
            }
            catch (Exception ex)
            {
                LogHelper.SaveLog(ex);
                return(Json(new { Code = 1, Msg = "服务器异常,请联系管理员!" }));
            }
        }
        //1. 不支持exception记录(事件中)
        //2. 无法捕捉到500之外的http exception
        //3. controller之外抛出的异常无法处理
        //4. ajax调用出现exception时,会将错误页面内容返回(己处理了)
        public override void OnException(ExceptionContext filterContext)
        {
            //如果异常未处理
            if (!filterContext.ExceptionHandled)
            {
                //异步记录日志
                Log4netHelper.Get(KeyModel.Log.ExceptionName).AsyncWriter(filterContext.Exception.ToString());
                //Log4netHelper.Get(KeyModel.Log.ServiceName).Writer("这里是自定义错误信息");

                //返回操作
                if (VerifyHelper.IsAjax(filterContext.HttpContext))
                {
                    //当结果为json时,设置异常已处理(如有单独的Attribute记录日志,这里不需要设置,如设置的true的话就不会再跑记录日志的attribute)
                    filterContext.ExceptionHandled = true;
                    filterContext.Result           = MvcHelper.ToJsonResult(DoubleXHelper.GetResult(filterContext.Exception));
                }
                else
                {
                    filterContext.ExceptionHandled = true;
                    filterContext.Result           = new RedirectResult(WebHelper.GetErrorUrl(DoubleXHelper.GetResult(filterContext.Exception)));
                }
            }
            else
            {
                base.OnException(filterContext);
            }
        }
示例#5
0
        public IActionResult GetPassWord_Mobile()
        {
            if (!VerifyHelper.Check(RequestEx["VCode_hid"]))
            {
                return(WriteErr("验证码不正确", "/User/Change/GetPassword"));
            }
            M_UserInfo mu     = GetUserByName(RequestEx["TxtUserName"]);
            M_Uinfo    basemu = buser.GetUserBaseByuserid(mu.UserID);

            if (string.IsNullOrEmpty(basemu.Mobile))
            {
                return(WriteErr("用户未设置手机号,无法通过手机号找回"));
            }
            string code   = function.GetRandomString(6, 2);
            string mobile = basemu.Mobile;

            if (mobileBll.CheckMobile(HttpContext, mobile))
            {
                CommonReturn ret = SMS_Helper.SendVCode(mobile, code, SMSConfig.Instance.Tlp_GetBack);
                //添加一条发送手机短信记录
                mobileBll.Insert(new M_Safe_Mobile()
                {
                    Phone = mobile, VCode = code, Source = "GetPassWord_Mobile", UserID = mu.UserID, UserName = mu.UserName, SysRemind = ret.err
                });
            }
            else
            {
                return(WriteErr("短信发送次数超过上限!"));
            }
            UserMobile  = mobile;
            GetPwdUName = mu.UserName;
            GetPwdStep  = "mobile_code";
            return(View("GetPassWord"));
        }
示例#6
0
        /// <summary>
        /// 会员登录
        /// </summary>
        /// <param name="account">会员账号</param>
        /// <param name="password">会员密码</param>
        /// <returns></returns>
        public MemberEntity Login(string account, string password, string clientIp)
        {
            account  = StringHelper.FormatDefault(account);
            password = StringHelper.FormatDefault(password);

            if (VerifyHelper.IsEmpty(account) || VerifyHelper.IsEmpty(password))
            {
                throw new MessageException(EnumResultCode.请输入登录账号或密码);
            }

            var query = Query(x => x.Account.ToLower().Trim() == account ||
                              (x.Email.ToLower().Trim() == account && x.EmailIsVerify) ||
                              (x.Mobile.ToLower().Trim() == account && x.MobileIsVerify));

            if (VerifyHelper.IsEmpty(query))
            {
                throw new MessageException(EnumResultCode.账号错误);
            }
            password = CoreHelper.GetPassword(password);
            var model = query.Where(x => x.Password == password).FirstOrDefault();

            if (VerifyHelper.IsEmpty(model))
            {
                throw new MessageException(EnumResultCode.密码错误);
            }

            //登录
            model.LastLoginDt = DateTime.Now;
            model.LastLoginIP = clientIp;
            Update(model);

            return(model);
        }
示例#7
0
        /// <summary>
        /// 操作步聚:使用账号密码验证码登录系统
        /// </summary>
        /// <param name="model"></param>
        /// <param name="captchaValue"></param>
        private void StepByLogin(QuestSourceModel model, string captchaValue)
        {
            ShowStatusText(string.Format("{0}[登录],正在登录系统", model.Name));

            bool isSuccess = false;

            if (!VerifyHelper.IsEmpty(captchaValue))
            {
                var result = AppHelper.GetLoginResult(model.Account, model.Password, captchaValue, model.Cookies, (res, loginModel) =>
                {
                    SetSourceLoginStatus(model, res, loginModel);
                }, (res, loginModel) =>
                {
                    model.Message = "登录失败";
                    model.IsLogin = false;
                });
            }

            ShowStatusText(string.Format("{0}[登录], {1}", model.Name, isSuccess ? "成功" : "失败"));

            //{
            // "success" : true,
            //  "msg" : "登录成功",
            //  "obj" : {
            //    "returnUrl" : "?UUID=94b3bf6d002f4fe586e122ce93c0299d&name=%E5%B0%B9%E4%BC%8A%E5%A8%9C&mail=1161536884%40qq.com",
            //    "akashaUrl" : "http://order.etest.net.cn/order/mySignUp",
            //    "formData" : null,
            //    "userName" : "尹伊娜"
            //  },
            //  "token" : ""
            // }
        }
示例#8
0
        /// <summary>
        /// 页面-支付宝支付跳转
        /// </summary>
        public ActionResult AlipayReturn(RequestModel request)
        {
            //异步记录日志
            Log4netHelper.Get(KeyModel.Log.PayNotification).AsyncWriter(request.JsonString);

            var result = WebHelper.GetResult(request);

            if (result.Code == EnumHelper.GetValue(EnumResultCode.操作成功))
            {
                //支付失败
                string returnSuccess = JsonHelper.GetValue(request.Obj, "is_success");
                string tradStatus    = JsonHelper.GetValue(request.Obj, "trade_status");
                if (!(returnSuccess.ToLower() == "t" && tradStatus.ToLower() == "trade_success"))
                {
                    throw new MessageException(EnumMessageCode.支付失败);
                }
                string  tradeNo          = JsonHelper.GetValue(request.Obj, "out_trade_no");
                decimal moneyValue       = DecimalHelper.Get(JsonHelper.GetValue(request.Obj, "total_fee"));
                string  rechrageRecordId = JsonHelper.GetValue(request.Obj, "trade_no");
                if (VerifyHelper.IsEmpty(tradeNo) || VerifyHelper.IsEmpty(moneyValue))
                {
                    throw new MessageException(EnumMessageCode.信息错误);
                }
                try
                {
                    rechargeRecordService.RechargeSuccess(tradeNo, moneyValue, rechrageRecordId);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return(new RedirectResult(WebHelper.GetMemberUrl("/trade/rechargerecord")));
        }
示例#9
0
        /// <summary>
        /// 页面-支付宝支付通知
        /// </summary>
        public ActionResult AlipayNotify(RequestModel request)
        {
            //支付宝通知日志
            Log4netHelper.Get(KeyModel.Log.PayNotification).AsyncWriter(request.JsonString);

            string tradStatus = JsonHelper.GetValue(request.Obj, "trade_status");

            if (!(tradStatus.ToLower() == "trade_success"))
            {
                return(Content("fail"));
            }

            string  tradeNo          = JsonHelper.GetValue(request.Obj, "out_trade_no");
            decimal moneyValue       = DecimalHelper.Get(JsonHelper.GetValue(request.Obj, "total_fee"));
            string  rechrageRecordId = JsonHelper.GetValue(request.Obj, "trade_no");

            if (VerifyHelper.IsEmpty(tradeNo) || VerifyHelper.IsEmpty(moneyValue))
            {
                throw new MessageException(EnumMessageCode.信息错误);
            }
            try
            {
                rechargeRecordService.RechargeSuccess(tradeNo, moneyValue, rechrageRecordId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Content("success"));
        }
示例#10
0
        /// <summary>
        /// 远程数据同步
        /// </summary>
        private List <DictionaryModel> SyncRemote()
        {
            List <DictionaryModel> source = new List <DictionaryModel>();

            ShowStatusText("正在同步考次(时间)信息..", isConsoleWrite: false);
            var times = SysTimes();

            if (!VerifyHelper.IsEmpty(times))
            {
                source.AddRange(times);
            }

            ShowStatusText("正在同步城区(上海)信息..", isConsoleWrite: false);
            var areas = SyncArea();

            if (!VerifyHelper.IsEmpty(areas))
            {
                source.AddRange(areas);
            }

            ShowStatusText("正在同步考场/科目信息..", isConsoleWrite: false);
            var terminals = SyncOrgAndCategory(areas);

            if (!VerifyHelper.IsEmpty(terminals))
            {
                source.AddRange(terminals);
            }

            ShowStatusText("正在获取考试信息..", isConsoleWrite: false);
            List <DictionaryModel> subjects = new List <DictionaryModel>();
            var packages = SyncPackagesAndSubject(source, out subjects);

            if (!VerifyHelper.IsEmpty(subjects))
            {
                source.AddRange(subjects);
            }
            if (!VerifyHelper.IsEmpty(packages))
            {
                packages.ForEach(x =>
                {
                    source.Add(new DictionaryModel()
                    {
                        Id       = Guid.NewGuid(),
                        Genre    = AppConst.DictionaryPackage,
                        Name     = string.Format("【{0}】{1}/{2}/{3}", x.ExamDate, x.FullName, x.OrgName, x.CategoryName),
                        Value    = string.Format("{0}|{1}", x.CategoryId, x.SubjectId),
                        Relation = JsonHelper.Serialize(x),
                        Parent   = "",
                        Sort     = 0
                    });
                });
            }


            SavePETSPackage(packages);

            SaveDictionarys(source);

            return(source);
        }
示例#11
0
        /// <summary>
        /// 同步地址
        /// </summary>
        private List <DictionaryModel> SyncArea()
        {
            List <DictionaryModel> source = new List <DictionaryModel>();
            var options = new HttpClientOptions();

            options.URL              = AppHelper.UrlAreas;
            options.Method           = "GET";
            options.CookieCollection = CurrentCookies;
            var result = new HttpWebClientUtility().Request(options);

            if (result != null && !VerifyHelper.IsEmpty(result.Content))
            {
                var obj = JsonHelper.Deserialize <JObject>(result.Content);
                if (BoolHelper.Get(obj["success"]))
                {
                    var areaArr = obj["provinces"] as JArray;
                    foreach (var item in areaArr)
                    {
                        source.Add(new DictionaryModel()
                        {
                            Id     = Guid.NewGuid(),
                            Genre  = AppConst.DictionaryArea,
                            Name   = StringHelper.Get(item["name"]),
                            Value  = StringHelper.Get(item["fullId"]),
                            Parent = StringHelper.Get(item["pid"]),
                            Sort   = 0
                        });
                    }
                }
            }
            return(source);
        }
示例#12
0
        /// <summary>
        /// 确认验证码
        /// </summary>
        public HttpResponseMessage ConfirmVerifyCode(RequestModel request)
        {
            var result = WebHelper.GetResult(request);

            if (result.Code == EnumHelper.GetValue(EnumResultCode.操作成功))
            {
                Guid taskId = GuidHelper.Get(JsonHelper.GetValue(request.Obj, "TaskId"));
                if (VerifyHelper.IsEmpty(taskId))
                {
                    throw new MessageException(EnumResultCode.请求错误);
                }

                string receiver = JsonHelper.GetValue(request.Obj, "Receiver");
                string code     = JsonHelper.GetValue(request.Obj, "Code");
                if (VerifyHelper.IsEmpty(receiver))
                {
                    throw new MessageException(EnumMessageCode.请输入验证码接收地址);
                }
                if (VerifyHelper.IsEmpty(code))
                {
                    throw new MessageException(EnumMessageCode.请输入验证码);
                }

                bool isSuccess = notificationService.ConfirmVerifyCode(taskId, receiver, code, request.CurrentContext.VisitId);
                if (!isSuccess)
                {
                    throw new MessageException(EnumMessageCode.验证码错误);
                }
            }
            return(WebApiHelper.ToHttpResponseMessage(result));
        }
 public void EnumFormatter_Formatter_IsCorrectly()
 {
     VerifyHelper.VerifySimpleType <Int8Enum>(Int8Enum.A);
     VerifyHelper.VerifySimpleType <Int8Enum>(Int8Enum.B);
     VerifyHelper.VerifySimpleType <Int64Enum>(Int64Enum.A);
     VerifyHelper.VerifySimpleType <Int64Enum>(Int64Enum.B);
 }
示例#14
0
 //----------------------------------------
 //----上传文件检测,首先多重判断,避免对普通页面的影响,然后再对安全进行检测,如带多个后缀名,则每个都检测
 //public static void CheckUpladFiles()
 //{
 //    HttpRequest Request = HttpContext.Current.Request;
 //    HttpResponse Response = HttpContext.Current.Response;
 //    if (Request.ContentType.ToLower().IndexOf("multipart/form-data") == -1) {  }
 //    if (Request.Files.Count < 1) {  }
 //    string UploadFileExts = SiteConfig.SiteOption.UploadFileExts.ToLower();
 //    for (int i = 0; i < Request.Files.Count; i++)
 //    {
 //        HttpPostedFile file = Request.Files[i];
 //        string fname = Path.GetFileName(file.FileName).ToLower();
 //        if (file.ContentLength < 1 || string.IsNullOrEmpty(fname)) { continue; }
 //        if (fname.IndexOf(".") < 0) { Response.Write("取消上传,原因:文件必须有后缀名,请勿上传可疑文件"); Response.End(); }
 //        string[] filearr = fname.Split('.');//多重后缀名检测,用于处理低版本IIS安全问题(IIS7以上可不需)
 //        for (int o = 1; o < filearr.Length; o++)
 //        {
 //            ZLLog.L(ZLEnum.Log.fileup, "By:Global_CheckUpladFiles,文件名:" + file.FileName);
 //            string fileext = filearr[o].ToString().ToLower();
 //            if (!ExNameCheck(fileext))//;号检测
 //            {
 //                string exname = Path.GetExtension(fname).ToLower().Replace(".", "");
 //                if (!StringHelper.FoundCharInArr(UploadFileExts, exname, "|"))
 //                {
 //                    Response.Write("取消上传,原因:上传的文件不是符合扩展名" + UploadFileExts + "的文件");
 //                    Response.End();
 //                }
 //            }
 //            else
 //            {
 //                Response.Write("取消上传,原因:请勿上传可疑文件!");
 //                Response.End();
 //            }
 //        }
 //    }
 //}
 //----------------------------------------
 /// <summary>
 /// 验证码校验,无论对错,必须清除,避免安全漏洞
 /// </summary>
 /// <returns>通过返回True,未通过False</returns>
 public static bool VCodeCheck(string key, string s)
 {
     return(VerifyHelper.Check(new M_Comp_Verify()
     {
         vtype = 0, sid = key, token = s
     }));
 }
示例#15
0
        public ActionResult GetPassWord_Mobile()
        {
            if (!VerifyHelper.Check(Request.Form["VCode_hid"]))
            {
                function.WriteErrMsg("验证码不正确", "/User/Change/GetPassword"); return(Content(""));
            }
            M_UserInfo mu     = GetUserByName(Request.Form["TxtUserName"]);
            M_Uinfo    basemu = buser.GetUserBaseByuserid(mu.UserID);

            if (string.IsNullOrEmpty(basemu.Mobile))
            {
                function.WriteErrMsg("用户未设置手机号,无法通过手机号找回"); return(Content(""));
            }
            string code    = function.GetRandomString(6, 2);
            string content = "你正在使用找回密码服务,校验码:" + code;
            string mobile  = basemu.Mobile;

            if (mobileBll.CheckMobile(mobile))
            {
                string ret = SendWebSMS.SendMessage(mobile, content);
                //添加一条发送手机短信记录
                mobileBll.Insert(new M_Safe_Mobile()
                {
                    Phone = mobile, VCode = code, Source = "GetPassWord_Mobile", UserID = mu.UserID, UserName = mu.UserName, SysRemind = ret
                });
            }
            else
            {
                function.WriteErrMsg("短信发送次数超过上限!"); return(null);
            }
            UserMobile  = mobile;
            GetPwdUName = mu.UserName;
            GetPwdStep  = "mobile_code";
            return(View("GetPassWord"));
        }
示例#16
0
        /// <summary>
        /// 获取结果(Post方式)
        /// </summary>
        /// <returns></returns>
        public static ResultModel Post(string url, string post, string resultKey = null, string errorKey = null)
        {
            JObject postObj = null;

            if (!VerifyHelper.IsEmpty(post))
            {
                postObj = JsonHelper.Deserialize <JObject>(post);
            }
            if (VerifyHelper.IsNull(postObj))
            {
                postObj = new JObject();
            }

            //公共post参数
            postObj["AppId"]    = DataCenterConfig.GetValue(KeyModel.Config.DataCenter.KeyAppId);
            postObj["ClientId"] = DataCenterConfig.GetValue(KeyModel.Config.DataCenter.KeyClientId);
            postObj["Version"]  = DataCenterConfig.GetValue(KeyModel.Config.DataCenter.KeyVersion);
            postObj["ip"]       = BrowserHelper.GetClientIP();

            var passport = postObj.GetValue("passport", StringComparison.InvariantCultureIgnoreCase);

            if (VerifyHelper.IsNull(passport))
            {
                passport = GetTempUserPassport();
            }
            postObj["passport"] = passport;
            //postObj["culture"] = CommonHelper.GetContext().Culture;
            //postObj["security"] = "1xxxx";
            return(Request(url, JsonHelper.Serialize(postObj), resultKey: resultKey, errorKey: errorKey));
        }
 public void FourDimensionalArrayFormatter_FormatterTypeIsArray2TypeAndFormatterIsCorrectly()
 {
     int[,,,] val = new int[, , , ] {
         { { { 1, 2 }, { 3, 4 } }, { { 5, 6 }, { 7, 9 } } }
     };
     VerifyHelper.VerifyEntityWithArray2(val);
 }
示例#18
0
        /// <summary>
        /// 获取临时用户登录Passport
        /// </summary>
        /// <returns></returns>
        protected static JObject GetTempUser()
        {
            var tempUser = CachingHelper <HttpRuntimeCaching> .Get <JObject>(KeyModel.Cache.DataCenterTempUser);

            if (VerifyHelper.IsEmpty(tempUser))
            {
                var tempUserAccount = StringHelper.Get(DataCenterConfig.GetValue(KeyModel.Config.DataCenter.KeyApiTempUser)).Split('|');
                if (VerifyHelper.IsEmpty(tempUserAccount))
                {
                    throw new DefaultException("数据中心TempUser配置错误");
                }

                var data = new JObject();
                data["AppId"]    = DataCenterConfig.GetValue(KeyModel.Config.DataCenter.KeyAppId);
                data["ClientId"] = DataCenterConfig.GetValue(KeyModel.Config.DataCenter.KeyClientId);
                data["Version"]  = DataCenterConfig.GetValue(KeyModel.Config.DataCenter.KeyVersion);
                data["ip"]       = BrowserHelper.GetClientIP();
                data["Account"]  = tempUserAccount.Length > 0 ? tempUserAccount[0] : "";
                data["Password"] = tempUserAccount.Length > 1 ? tempUserAccount[1] : "";

                var result = Request(DataCenterConfig.GetApiUrl(KeyModel.Config.DataCenter.KeyAccountLogin), JsonHelper.Serialize(data), resultKey: null, errorKey: null);
                if (result.Code == EnumHelper.GetValue(EnumResultCode.操作成功) && !VerifyHelper.IsEmpty(result.Obj))
                {
                    tempUser = result.Obj;
                }
            }
            return(VerifyHelper.IsEmpty(tempUser) ? new JObject() : tempUser);
        }
示例#19
0
        /// <summary>
        /// 操作步聚:获取验证码内容(从聚合API接口)
        /// </summary>
        /// <param name="base64"></param>
        /// <returns></returns>
        private string StepByGetCaptchaCodeByJUHE(QuestSourceModel model, string base64)
        {
            ShowStatusText(string.Format("{0}[登录],自动识别验证码", model.Name));

            string captchaCodeValue = string.Empty;

            if (!VerifyHelper.IsEmpty(base64))
            {
                var options = new HttpClientOptions();
                var client  = new HttpWebClientUtility();
                options.URL         = AppHelper.UrlCaptchaValJuHe;
                options.Method      = "POST";
                options.ContentType = "application/x-www-form-urlencoded";
                options.PostData    = string.Format("key={0}&codeType={1}&base64Str={2}", AppHelper.ValueJuHeKey1, AppHelper.ValueJuHeKey2, CodingHelper.UrlEncoding(base64));
                var result = client.Request(options);
                if (!VerifyHelper.IsEmpty(result.Content))
                {
                    var obj = JsonHelper.Deserialize <JObject>(result.Content);
                    if (obj != null && StringHelper.Get(obj["error_code"]) == "0")
                    {
                        captchaCodeValue = StringHelper.Get(obj["result"]);
                    }
                }
            }

            ShowStatusText(string.Format("{0}[登录],验证码识别 {1}", model.Name, !VerifyHelper.IsEmpty(captchaCodeValue) ? "成功" : "失败"));

            return(captchaCodeValue);
        }
        public void CustomGenericDictTypeImpl_SameDictionaryKeyVakyeTypeCtor_IsEmpty_FormatterMapTypeIsCorrectly()
        {
            var val = new _IGenericDictionaryCustomImpl_SameDictionaryKeyVakyeTypeCtor <int, int>(new Dictionary <int, int>());

            VerifyHelper.VerifyMap1Type(val, BssomSerializerOptions.Default.WithIDictionaryIsSerializeMap1Type(true));
            VerifyHelper.VerifyIDictWithMap2Type <_IGenericDictionaryCustomImpl_SameDictionaryKeyVakyeTypeCtor <int, int>, int, int>(val, BssomSerializerOptions.Default.WithIDictionaryIsSerializeMap1Type(false));
        }
        private void Check_sale_order_is_exist_with_correct_infomation()
        {
            Report_Log_Instance("Step 03 : Check_sale_order_is_exist_with_correct_infomation", Level.Root);
            HomePage.InstancePO.Base_Open_Dialog_By_Searching_Text(SearchMenu.SalesOrder);

            using (var SaleOrder = new SaleOrderPage())
            {
                Report_Log_Instance("Step 03.a : Check order row is exist", Level.Level01);
                SaleOrder.Change_to_find_mode();
                SaleOrder.CustomerFind = CustomerID;
                var OrderedDate = DateTimes.GetDateNow("dd.MM.yy");
                using (var ListOfSalesOrder = new ListOfSalesOrderPage())
                {
                    var valueRow = $"{OrderedDate},{ListOfSalesOrderPage.COL_DATE}" +
                                   $";{NameCustomer},{ListOfSalesOrderPage.COL_CUSTOMER_NAME}" +
                                   $";{RemarkSaleOrderSM},{ListOfSalesOrderPage.COL_REMARKS}";
                    var ResultTable = ListOfSalesOrder.ResultTable;
                    VerifyHelper.AssertEqual(1, ResultTable.Get_number_rows_has_these_value(valueRow));

                    ResultTable.Double_click_row_in_table_by_value(valueRow);
                }

                Report_Log_Instance("Step 03.b : Check information is correct", Level.Level01);
                VerifyHelper.AssertEqual(NameCustomer, SaleOrder.Name);
                VerifyHelper.AssertEqual(RemarkSaleOrderSM, SaleOrder.Remarks);
                VerifyHelper.AssertEqual("P - Pre-Order", SaleOrder.OrderType);

                SaleOrder.Finish_dialog();
            }
        }
        public ActionResult GetVerify(string id)

        {
            var bs = VerifyHelper.Create();

            return(File(bs, "image/png"));
        }
示例#23
0
        /// <summary>
        /// 确认验证码是否正确
        /// </summary>
        /// <param name="taskId">任务Id</param>
        /// <param name="receiver">接收者</param>
        /// <param name="code">验证码</param>
        /// <param name="visitId">访问者ID</param>
        /// <param name="isExpire">是否验证通过立即过期</param>
        /// <returns></returns>
        public bool ConfirmVerifyCode(Guid taskId, string receiver, string code, Guid visitId, bool isExpire = false)
        {
            if (VerifyHelper.IsEmpty(taskId) || VerifyHelper.IsEmpty(receiver) || VerifyHelper.IsEmpty(code) || VerifyHelper.IsEmpty(visitId))
            {
                throw new DefaultException(EnumResultCode.参数错误, "taskId", "receiver", "code", "visitId");
            }

            string key = string.Format(KeyModel.Session.FormatVerifyCode, taskId);

            VerifyCodeModel model = RedisHelper.Get <VerifyCodeModel>(key);

            if (VerifyHelper.IsEmpty(model))
            {
                throw new DefaultException(EnumResultCode.验证码己失效);
            }
            if (model.Code == code && model.Receiver == receiver && model.VisitId == visitId)
            {
                if (isExpire)
                {
                    RedisHelper.Set <VerifyCodeModel>(key, null);
                }
                return(true);
            }

            return(false);
        }
        public void VersionFormatter_IsCorrectly()
        {
            Version sd = new Version(3, 4);

            VerifyHelper.VerifySimpleType(sd);
            VerifyHelper.VerifyTypeNull <Version>();
        }
示例#25
0
        public IActionResult GetPassWord_Email()
        {
            B_MailManage mailBll = new B_MailManage();

            if (!VerifyHelper.Check(RequestEx["VCode_Hid"]))
            {
                return(WriteErr("验证码不正确", "/User/GetPassword"));
            }
            M_UserInfo mu = GetUserByName(RequestEx["TxtUserName"]);

            if (string.IsNullOrEmpty(mu.Email) || mu.Email.Contains("@random"))
            {
                return(WriteErr("用户未设置邮箱,无法通过邮箱找回"));
            }
            //生成Email验证链接
            string seturl = function.GetRandomString(12) + "," + DateTime.Now.ToString();

            mu.seturl = EncryptHelper.AESEncrypt(seturl);
            buser.UpDateUser(mu);
            //Email发送
            string url       = SiteConfig.SiteInfo.SiteUrl + "/User/Change/GetPassWord?key=" + mu.seturl + "&uid=" + mu.UserID;
            string returnurl = "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>";
            string content   = mailBll.SelByType(B_MailManage.MailType.RetrievePWD);

            content = new OrderCommon().TlpDeal(content, GetPwdEmailDt(mu.UserName, SiteConfig.SiteInfo.SiteName, returnurl));
            MailInfo mailInfo = SendMail.GetMailInfo(mu.Email, SiteConfig.SiteInfo.SiteName, SiteConfig.SiteInfo.SiteName + "_找回密码", content);

            SendMail.Send(mailInfo);
            //不需要更新步骤,其从邮箱进入地址栏后再更新
            string emailUrl = B_Plat_Common.GetMailSite(mu.Email);

            return(WriteOK("密码重设请求提交成功,<a href='" + emailUrl + "' target='_blank'>请前往邮箱查收</a>!!"));
        }
        public void UriFormatter_IsCorrectly()
        {
            Uri sd = new Uri("http://www.bssom.com");

            VerifyHelper.VerifySimpleType(sd);
            VerifyHelper.VerifyTypeNull <Uri>();
        }
        private void Delete_expected_region()
        {
            Report_Log_Instance("Step 03 : Delete expected region", Level.Root);

            Report_Log_Instance("Step 03.a : Open Region dialog", Level.Level01);
            HomePage.InstancePO.Base_Open_Dialog_By_Searching_Text(SearchMenu.Region);
            using (RegionPage Region = new RegionPage())
            {
                Report_Log_Instance("Step 03.a : Delete expected region", Level.Level02);
                var RegionTableObject = Region.RegionTable;
                RegionTableObject.Remove_row_in_table_by_pair_value($"{code},{RegionPage.COL_CODE}");

                using (var SystemMessage = new SystemMessagePage())
                {
                    SystemMessage.Accept_system_message();
                    SystemMessage.Base_wait_for_loading_page_completely();
                }

                var expectedMessage = "Operation completed successfully  [Message 200-48]";
                var actualMessage   = HomePage.InstancePO.MessageFooter.Get_attribute_title();
                VerifyHelper.AssertEqual(expectedMessage, actualMessage);

                RegionTableObject.Refresh_Data();
                VerifyHelper.AssertEqual(0, RegionTableObject.Get_number_rows_has_these_value($"{code},{RegionPage.COL_CODE}" +
                                                                                              $";{name},{ RegionPage.COL_NAME }" +
                                                                                              $";VN,{ RegionPage.COL_COUNTRY }"));
            }
        }
        public void DataTableFormatter_IsCorrectly()
        {
            DataTable dt = RandomHelper.RandomValue <DataTable>();

            VerifyHelper.VerifySpecific(dt);
            VerifyHelper.VerifyTypeNull <DataTable>();
        }
示例#29
0
        /// <summary>
        /// 职员登录
        /// </summary>
        /// <param name="account">职员账号</param>
        /// <param name="password">职员密码</param>
        /// <returns></returns>
        public EmployeeEntity Login(string account, string password)
        {
            account  = StringHelper.FormatDefault(account);
            password = StringHelper.FormatDefault(password);

            if (VerifyHelper.IsEmpty(account) || VerifyHelper.IsEmpty(password))
            {
                throw new MessageException(EnumResultCode.请输入登录账号或密码);
            }

            var query = Query(x => x.Account.ToLower().Trim() == account);

            if (VerifyHelper.IsEmpty(query))
            {
                throw new MessageException(EnumResultCode.账号错误);
            }
            password = CoreHelper.GetPassword(password);
            var model = query.Where(x => x.Password == password).FirstOrDefault();

            if (VerifyHelper.IsEmpty(model))
            {
                throw new MessageException(EnumResultCode.密码错误);
            }

            //登录+1
            model.LoginCount = model.LoginCount + 1;
            Update(model);

            return(model);
        }
示例#30
0
        private static void VerifyFileWithHelper(string certDir, string checkFilePath)
        {
            Console.WriteLine("Check file (with helper): {0}", checkFilePath);
            bool status = VerifyHelper.VerifyFile(certDir + "Defter.CoreSigning.cer", checkFilePath);

            Console.WriteLine("File valid: {0}", status);
        }