public static UserInfo Create( string firstName, string lastName, Role role, UserSettingInfo userSetting) { return(new UserInfo { IsActive = true, Role = role, FirstName = firstName, LastName = lastName, UserSettingInfo = userSetting, CreatedAt = DateTime.UtcNow }); }
public async Task <UserInfo> Register(RegisterInfo registerInfo) { var user = await _context.Users.FirstOrDefaultAsync(x => x.UserSettingInfo.Login == registerInfo.Login); if (user != null) { throw new UserAlreadyExistException(); } PasswordHelper.CreatePasswordHash(registerInfo.Password, out var hash, out var salt); var settingInfo = new UserSettingInfo() { Login = registerInfo.Login, PasswordHash = hash, PasswordSalt = salt, }; var newUser = UserInfo.Create( registerInfo.FirstName, registerInfo.LastName, Domain.Enums.Role.User, settingInfo); using var transaction = _context.BeginTransaction(); try { var entity = _context.Users.Add(newUser); await _context.SaveChangesAsync(); await transaction.CommitAsync(); return(entity.Entity); } catch (Exception e) { await transaction.RollbackAsync(); throw e; } }
public int PayRateConfig(UserSettingInfo info) { SqlParameter[] parameters = { new SqlParameter("@userId", SqlDbType.Int, 4), new SqlParameter("@special", SqlDbType.TinyInt, 1), new SqlParameter("@payrate", SqlDbType.Int, 4) }; parameters[0].Value = info.userid; parameters[1].Value = info.special; parameters[2].Value = info.payrate; object ds = DataBase.ExecuteScalar(CommandType.StoredProcedure, "proc_usersetting_payrate_config", parameters); if (ds == null || ds == DBNull.Value) { return(0); } return(Convert.ToInt32(ds)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void iBtnSubmit1_Click(object sender, EventArgs e) { KeyValuePair <string, string> pair; string vCode = GetPostValue("txtvcode"); ; string errMsg = WebUtility.CheckValiDateCode(vCode); if (!string.IsNullOrEmpty(errMsg)) { pair = new KeyValuePair <string, string>("mobilecode", errMsg); ShowError(pair); return; } //用户类型 int userclassid = 0; string username = GetPostValue("newusername").Trim(); string password1 = GetPostValue("password1").Trim(); string password2 = GetPostValue("password2").Trim(); string mobile = GetPostValue("newemail").Trim(); string sitename = GetPostValue("newsitename").Trim(); string siteurl = GetPostValue("newsiteurl").Trim(); string email = GetPostValue("J_mobile").Trim(); string idcard = string.Empty; string fullname = GetPostValue("newfullname").Trim(); string qq = GetPostValue("newqq").Trim(); string question = string.Empty; string answer = string.Empty; string fBank = GetPostValue("fBank").Trim(); string fAccountName = GetPostValue("fAccountName").Trim(); string fAccount = GetPostValue("fAccount").Trim(); string fProvince = GetPostValue("fProvince").Trim(); string fCity = GetPostValue("fCity").Trim(); string fSubBranch = GetPostValue("fSubBranch").Trim(); #region check if (string.IsNullOrEmpty(username)) { errMsg = "用户名不能为空!"; } else if (!Regex.IsMatch(username, UserNameRegex)) { errMsg = "用户名格式不正确!"; } else if (Factory.Exists(username)) { errMsg = "用户名已注册!"; } if (!string.IsNullOrEmpty(errMsg)) { pair = new KeyValuePair <string, string>("Span1", errMsg); ShowError(pair); return; } if (string.IsNullOrEmpty(errMsg)) { if (string.IsNullOrEmpty(password1)) { errMsg = "密码不能为空!"; } else if (password1.Length < 6 || password1.Length > 32) { errMsg = "密码长度不正确!"; } else if (!password1.Equals(password2)) { errMsg = "密码与重复密码输入不一致!"; } } if (!string.IsNullOrEmpty(errMsg)) { pair = new KeyValuePair <string, string>("Span2", errMsg); ShowError(pair); return; } if (string.IsNullOrEmpty(errMsg)) { if (string.IsNullOrEmpty(email)) { errMsg = "安全邮箱不能为空!"; } else if (!Regex.IsMatch(email, EmailRegex)) { errMsg = "安全邮箱格式不正确"; } else if (Factory.EmailExists(email) != 999) { errMsg = "安全邮箱已注册"; } } if (!string.IsNullOrEmpty(errMsg)) { pair = new KeyValuePair <string, string>("J_mobile_info", errMsg); ShowError(pair); return; } if (string.IsNullOrEmpty(errMsg)) { if (string.IsNullOrEmpty(fullname)) { errMsg = "真实姓名不能不空!"; } else if (!Regex.IsMatch(fullname, ChineseRegex)) { errMsg = "真实姓名格式不正确"; } } if (!string.IsNullOrEmpty(errMsg)) { pair = new KeyValuePair <string, string>("contact_name", errMsg); ShowError(pair); return; } if (string.IsNullOrEmpty(errMsg)) { if (string.IsNullOrEmpty(qq)) { errMsg = "联系QQ不能不空!"; } else if (!Regex.IsMatch(qq, QQRegex)) { errMsg = "QQ格式不正确"; } } if (!string.IsNullOrEmpty(errMsg)) { pair = new KeyValuePair <string, string>("Span5", errMsg); ShowError(pair); return; } #endregion var userinfo = new UserInfo { UserName = username, Password = Cryptography.MD5(password1), Email = email, QQ = qq, Tel = mobile, SiteName = sitename, SiteUrl = siteurl, IdCard = idcard, CPSDrate = RegisterSettings.DefaultCPSDrate, PMode = 1, PayeeBank = fBank, LinkMan = fullname, full_name = fullname, Status = RegisterSettings.RequiredAudit ? 1 : 2, LastLoginIp = ServerVariables.TrueIP, LastLoginTime = DateTime.Now, RegTime = DateTime.Now, Settles = 0, IsEmailPass = 1 }; userinfo.UserLevel = RegisterSettings.DefaultUserLevel; //提现方案 userinfo.MaxDayToCashTimes = SettleSettings.DefaultScheme; //默认结算模式 0:T+0 1:T+1 //默认扣量比例 userinfo.CPSDrate = RegisterSettings.DefaultCPSDrate; userinfo.AgentId = 0; userinfo.APIAccount = 0; userinfo.APIKey = viviapi.BLL.User.Factory.GenerateAPIKey(); //WebUtility.GenerateAPIKey(); userinfo.question = question; userinfo.answer = answer; userinfo.classid = userclassid; if (this.SalesmanId > 0) { userinfo.manageId = SalesmanId; } userinfo.cardversion = RegisterSettings.DefaultCardVersion; string area = ""; string province = ""; string city = ""; WebUtility.GetAreaInfo(out area, out province, out city); userinfo.province = province; userinfo.city = city; userinfo.Desc = area; int userId = Factory.Add(userinfo); if (userId > 0) { var config = new UserSettingInfo { userid = userId, RiskWarning = (byte)(TransactionSettings.RiskWarning ? 1 : 0) }; viviapi.BLL.User.UserSetting.Instance.Insert(config); //UserPayBankAppInfo model = new UserPayBankAppInfo(); //model.pmode = 1; //model.payeeBank = fBank; //model.bankProvince = fProvince; //model.bankCity = fCity; //model.bankAddress = fSubBranch; //model.account = fAccount; //model.payeeName = fAccountName; //model.AddTime = DateTime.Now; //model.userid = userId; //model.status = AcctChangeEnum.审核成功; //int infoId = BLL.User.UserPayBankApp.Add(model); //if (infoId > 0) //{ // model.id = infoId; // model.status = AcctChangeEnum.审核成功; // model.SureTime = DateTime.Now; // model.SureUser = 0; // BLL.User.UserPayBankApp.Check(model); //} if (AgentId > 0) { #region var promUser = new Promoter { PID = AgentId, Prices = 0.5M, RegId = userId, PromTime = DateTime.Now, PromStatus = 1 }; viviapi.BLL.Promotion.Factory.Insert(promUser); #endregion } //if (RegisterSettings.ActivationByEmail) //{ // errMsg = SendMail(username, userId, email); // AlertAndRedirect2(errMsg, "/login.aspx"); //} //else //{ if (userinfo.Status == 2) { AlertAndRedirect2("注册成功,无须审核请登陆后直接使用", "/login.aspx"); } else { AlertAndRedirect2("注册成功,请等待管理员审核", "/Login.aspx"); } //} } else { pair = new KeyValuePair <string, string>("Span7", "注册失败"); ShowError(pair); } }
protected void Page_Load(object sender, EventArgs e) { Guid userId = WebUserAuth.UserId.Value; UserBLL bll = new UserBLL(); UserSettingBLL uBll = new UserSettingBLL(); SetModel = new WebSettingBLL().GetWebSettingInfo("5E08DFE3-6CED-4E71-8CF9-2A2E3BAC9036"); if (userId != null && userId != Guid.Empty) { var rInfo = new UserRiskEvaluationBLL().GetAssassTimeThisYear(userId, TdConfig.ApplicationName); if (rInfo == null) { Response.Redirect("/Member/safety/pre_invest.aspx", true); } AviMoney = bll.GetUserAviMoney(userId); userModel = bll.GetUserBasicInfoModelById(userId); userSetting = uBll.GetUserSettingInfo(userId); if (userSetting == null) { userSetting = new UserSettingInfo(); userSetting.IsTenderNeedPayPassword = false; } //假如数据还不同步过来,设置未身份证验证 if (userModel == null) { userModel = new UserBasicInfoInfo(); userModel.IsValidateIdentity = false; AviMoney = 0; } } else { Response.Redirect("/user/Login.aspx?ReturnUrl=" + Request.RawUrl, true); } Tool.CookieHelper.WriteCookie("InvestUrl", HttpContext.Current.Request.RawUrl, 30); var projectIdStr = Tool.WEBRequest.GetQueryString("projectid");// Request.QueryString["projectid"]; if (!string.IsNullOrEmpty(projectIdStr)) { projectId = Guid.Parse(projectIdStr); //model = new WeProductBLL().GetWeProductInfo(projectId); string isOpenMobileCode = "false"; var webSet = new WebSettingBLL().GetWebSettingInfo("C7FC6726-A36D-4035-A36C-957D43F5EF96"); if (webSet == null) { webSet = new WebSettingInfo(); } if (webSet.Param1Value == "1") { isOpenMobileCode = "true"; } if (IsZQZR(projectId) && !TuanDai.PortalSystem.Redis.mRedis.GetZqzrInvestCodePass(projectId, userId) && isOpenMobileCode == "true") { IsShowMobileCode = true; } } else { Response.Redirect("/pages/invest/invest_list.aspx"); } investType = Tool.WEBRequest.GetQueryString("investType"); //Request.QueryString["investType"]; var payMoneyStr = Tool.WEBRequest.GetQueryString("payMoney"); //Request.QueryString["payMoney"]; if (!string.IsNullOrEmpty(payMoneyStr) && payMoneyStr != "NaN") { PayMoney = decimal.Parse(payMoneyStr); } else { Response.Redirect("/pages/invest/invest_list.aspx"); } ProfitMoney = Tool.WEBRequest.GetQueryString("profitMoney"); //Request.QueryString["profitMoney"]; var unitStr = Tool.WEBRequest.GetQueryString("unit"); //Request.QueryString["unit"]; if (!string.IsNullOrEmpty(unitStr)) { unit = int.Parse(unitStr); } else { Response.Redirect("/pages/invest/invest_list.aspx"); } var repeatInvestTypeStr = Tool.WEBRequest.GetQueryString("repeatInvestType"); //Request.QueryString["repeatInvestType"]; if (!string.IsNullOrEmpty(repeatInvestTypeStr)) { RepeatInvestType = int.Parse(repeatInvestTypeStr); } if (Tool.WEBRequest.GetQueryString("PrizeId") != "") { PrizeId = WEBRequest.GetGuid("PrizeId"); } PrizeName = WEBRequest.GetQueryString("PrizeName"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { var userInfo = viviapi.BLL.User.Factory.GetModel(this.UserId); if (userInfo == null) { ShowMessageBox("商户不存在"); return; } var amtInfo = AmtInfo; if (amtInfo == null) { amtInfo = new UserSettingInfo { userid = UserId, special = (byte)(this.ckb_isopen.Checked ? 1 : 0) }; } else { amtInfo.userid = UserId; amtInfo.special = (byte)(this.ckb_isopen.Checked ? 1 : 0); } amtInfo.payrate = 0; if (amtInfo.special == 1) { #region check value string strErr = string.Empty; if (!viviLib.Text.Validate.IsNumber(txtp100.Text)) { strErr += "p100格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp101.Text)) { strErr += "p101格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp102.Text)) { strErr += "p102格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp103.Text)) { strErr += "p103格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp104.Text)) { strErr += "p104格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp105.Text)) { strErr += "p105格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp106.Text)) { strErr += "p106格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp107.Text)) { strErr += "p107格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp108.Text)) { strErr += "p108格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp109.Text)) { strErr += "p109格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp110.Text)) { strErr += "p110格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp111.Text)) { strErr += "p111格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp112.Text)) { strErr += "p112格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp113.Text)) { strErr += "p113格式错误!\n"; } //if (!viviLib.Text.Validate.IsNumber(txtp114.Text)) //{ // strErr += "p114格式错误!\n"; //} //if (!viviLib.Text.Validate.IsNumber(txtp115.Text)) //{ // strErr += "p115格式错误!\n"; //} //if (!viviLib.Text.Validate.IsNumber(txtp116.Text)) //{ // strErr += "p116格式错误!\n"; //} if (!viviLib.Text.Validate.IsNumber(txtp117.Text)) { strErr += "p117格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp118.Text)) { strErr += "p118格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp119.Text)) { strErr += "p119格式错误!\n"; } //if (!viviLib.Text.Validate.IsNumber(txtp200.Text)) //{ // strErr += "p200格式错误!\n"; //} //if (!viviLib.Text.Validate.IsNumber(txtp201.Text)) //{ // strErr += "p201格式错误!\n"; //} //if (!viviLib.Text.Validate.IsNumber(txtp202.Text)) //{ // strErr += "p202格式错误!\n"; //} if (!viviLib.Text.Validate.IsNumber(txtp203.Text)) { strErr += "p203格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp204.Text)) { strErr += "p204格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp205.Text)) { strErr += "p205格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp207.Text)) { strErr += "p207格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp208.Text)) { strErr += "p208格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp209.Text)) { strErr += "p209格式错误!\n"; } if (!viviLib.Text.Validate.IsNumber(txtp300.Text)) { strErr += "p300格式错误!\n"; } #endregion if (strErr != "") { ShowMessageBox(strErr); return; } #region decimal p100 = decimal.Parse(this.txtp100.Text) / 100; decimal p101 = decimal.Parse(this.txtp101.Text) / 100; decimal p102 = decimal.Parse(this.txtp102.Text) / 100; decimal p103 = decimal.Parse(this.txtp103.Text) / 100; decimal p104 = decimal.Parse(this.txtp104.Text) / 100; decimal p105 = decimal.Parse(this.txtp105.Text) / 100; decimal p106 = decimal.Parse(this.txtp106.Text) / 100; decimal p107 = decimal.Parse(this.txtp107.Text) / 100; decimal p108 = decimal.Parse(this.txtp108.Text) / 100; decimal p109 = decimal.Parse(this.txtp109.Text) / 100; decimal p110 = decimal.Parse(this.txtp110.Text) / 100; decimal p111 = decimal.Parse(this.txtp111.Text) / 100; decimal p112 = decimal.Parse(this.txtp112.Text) / 100; decimal p113 = decimal.Parse(this.txtp113.Text) / 100; //decimal p114 = decimal.Parse(this.txtp114.Text) / 100; //decimal p115 = decimal.Parse(this.txtp115.Text) / 100; //decimal p116 = decimal.Parse(this.txtp116.Text) / 100; decimal p117 = decimal.Parse(this.txtp117.Text) / 100; decimal p118 = decimal.Parse(this.txtp118.Text) / 100; decimal p119 = decimal.Parse(this.txtp119.Text) / 100; decimal p200 = decimal.Parse(this.txtp200.Text) / 100; //decimal p201 = decimal.Parse(this.txtp201.Text) / 100; //decimal p202 = decimal.Parse(this.txtp202.Text) / 100; decimal p203 = decimal.Parse(this.txtp203.Text) / 100; decimal p204 = decimal.Parse(this.txtp204.Text) / 100; decimal p205 = decimal.Parse(this.txtp205.Text) / 100; // decimal p206 = decimal.Parse(this.txtp206.Text) / 100; decimal p207 = decimal.Parse(this.txtp207.Text) / 100; decimal p208 = decimal.Parse(this.txtp208.Text) / 100; decimal p209 = decimal.Parse(this.txtp209.Text) / 100; decimal p210 = decimal.Parse(this.txtp210.Text) / 100; decimal p300 = decimal.Parse(this.txtp300.Text) / 100; //decimal p100 = decimal.Parse(this.txtp100.Text) / 100; //decimal p101 = decimal.Parse(this.txtp101.Text) / 100; //decimal p102 = decimal.Parse(this.txtp102.Text) / 100; //decimal p103 = decimal.Parse(this.txtp103.Text) / 100; //decimal p104 = decimal.Parse(this.txtp104.Text) / 100; //decimal p105 = decimal.Parse(this.txtp105.Text) / 100; //decimal p106 = decimal.Parse(this.txtp106.Text) / 100; //decimal p107 = decimal.Parse(this.txtp107.Text) / 100; //decimal p108 = decimal.Parse(this.txtp108.Text) / 100; //decimal p109 = decimal.Parse(this.txtp109.Text) / 100; //decimal p110 = decimal.Parse(this.txtp110.Text) / 100; //decimal p111 = decimal.Parse(this.txtp111.Text) / 100; //decimal p112 = decimal.Parse(this.txtp112.Text) / 100; //decimal p113 = decimal.Parse(this.txtp113.Text) / 100; ////decimal p114 = decimal.Parse(this.txtp114.Text) / 100; ////decimal p115 = decimal.Parse(this.txtp115.Text) / 100; ////decimal p116 = decimal.Parse(this.txtp116.Text) / 100; //decimal p117 = decimal.Parse(this.txtp117.Text) / 100; //decimal p118 = decimal.Parse(this.txtp118.Text) / 100; //decimal p119 = decimal.Parse(this.txtp119.Text) / 100; ////decimal p200 = decimal.Parse(this.txtp200.Text) / 100; ////decimal p201 = decimal.Parse(this.txtp201.Text) / 100; ////decimal p202 = decimal.Parse(this.txtp202.Text) / 100; //decimal p203 = decimal.Parse(this.txtp203.Text) / 100; //decimal p204 = decimal.Parse(this.txtp204.Text) / 100; //decimal p205 = decimal.Parse(this.txtp205.Text) / 100; //decimal p206 = decimal.Parse(this.txtp206.Text) / 100; //decimal p207 = decimal.Parse(this.txtp207.Text) / 100; //decimal p208 = decimal.Parse(this.txtp208.Text) / 100; //decimal p209 = decimal.Parse(this.txtp209.Text) / 100; //decimal p210 = decimal.Parse(this.txtp210.Text) / 100; //decimal p300 = decimal.Parse(this.txtp300.Text) / 100; #endregion #region var rateInfo = new viviapi.Model.Finance.PayRate { rateType = 2, billId = UserId, billame = userInfo.UserName, p100 = p100, p101 = p101, p102 = p102, p103 = p103, p104 = p104, p105 = p105, p106 = p106, p107 = p107, p108 = p108, p109 = p109, p110 = p110, p111 = p111, p112 = p112, p113 = p113, //p114 = p114, //p115 = p115, //p116 = p116, p117 = p117, p118 = p118, p119 = p119, p200 = p200, //p201 = p201, //p202 = p202, p203 = p203, p204 = p204, p205 = p205, // p206 = p206, p207 = p207, p208 = p208, p209 = p209, p210 = p210, p300 = p300 }; if (MuserPayRate != null) { rateInfo.id = MuserPayRate.id; } int id = viviapi.BLL.Finance.PayRate.Instance.Insert(rateInfo); if (id <= 0) { ShowMessageBox("保存失败"); return; } #endregion amtInfo.payrate = id; } bool result = viviapi.BLL.User.UserSetting.Instance.PayRateConfig(amtInfo); if (result) { ShowMessageBox("操作成功"); } else { ShowMessageBox("操作失败"); } }
/// <summary> /// 提交发标请求. /// </summary> public void Submit() { PrintJson("-1", "触屏版不支持发资产标,请前往PC或APP"); return; //将用户提交的请求信息转换成视图模型. var model = WXInvest.ConvertTo <ProjectViewModel>(HttpContext.Current.Request, HttpMethod.POST); if (model.Unit > 1000) { this.PrintJson("-1", "最小单位不能大于1000"); } if (model.InterestRate.HasValue) { int totalLength = model.InterestRate.ToString().Length; //总长度 int floatLength = totalLength - 1 - Math.Floor(model.InterestRate.Value).ToString().Length; //小数位数 int dataLength = int.Parse(new WebSettingBLL().GetWebSettingInfo("3F902315-6986-44FF-9F00-9D420C07FCDA").Param1Value); //数据库配置位数 if (floatLength > dataLength) { this.PrintJson("-1", "利率的小数位数不能超过" + dataLength + "位"); } } if (model.Repayment != 1 && model.Repayment != 2) { this.PrintJson("-1", "还款方式不对"); } string PayPwd = Tool.Encryption.MD5(Context.Request["PayPwd"]); decimal rate = decimal.Parse(Context.Request["rate"]); //校验用户信息. var userId = WebUserAuth.UserId.Value; var userbll = new UserBLL(); var user = userbll.GetUserBasicInfoModelById(userId); if (user == null) { this.PrintJson("-2", "用户不存在"); } if (string.IsNullOrEmpty(user.PayPwd) || user.PayPwd == user.Pwd) { this.PrintJson("-4", "请先到安全中心设置交易密码"); } //DB.UserSetting usersetting = db.UserSettings.FirstOrDefault(p=>p.UserId==userId); //modify by ShellBen 2015-12-26 UserSettingDAL usDal = new UserSettingDAL(); UserSettingInfo usersetting = usDal.GetUserSettingInfo(userId); if (usersetting != null) { if (usersetting.PayPwdErrorDate.HasValue) { DateTime date1 = Convert.ToDateTime(usersetting.PayPwdErrorDate.Value.ToString("yyyy/MM/dd")); DateTime date2 = Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd")); if (date1 == date2 && usersetting.PayPwdErrorCount >= 5) { this.PrintJson("-5", "交易密码已错误5次,请24小时后再进行此操作"); } if (date1 != date2 && usersetting.PayPwdErrorCount > 1) { usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; } } } else { //usersetting = new DB.UserSetting(); usersetting = new UserSettingInfo(); usersetting.Id = Guid.NewGuid(); usersetting.UserId = userId; usersetting.IsTenderNeedPayPassword = false; usersetting.IsAllowChangePwd = true; usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; //db.UserSettings.AddObject(usersetting); //db.SaveChanges(); usDal.AddUserSettingInfo(usersetting); } if (user.PayPwd != PayPwd) { //记录登录错误次数 if (usersetting.PayPwdErrorCount == null) { usersetting.PayPwdErrorCount = 0; } usersetting.PayPwdErrorCount += 1; usersetting.PayPwdErrorDate = DateTime.Now; //db.SaveChanges(); usDal.UpdateUserSettingInfo(usersetting); if (usersetting.PayPwdErrorCount >= 5) { this.PrintJson("-6", "今日交易密码已错误5次,请24小时后再进行此操作!"); } else { this.PrintJson("-7", "交易密码错误,今日还有" + (5 - usersetting.PayPwdErrorCount) + "次机会,错误5次将锁定24小时!"); } return; } else { //清除错误记录 usersetting.PayPwdErrorCount = 0; usersetting.PayPwdErrorDate = null; //db.SaveChanges(); usDal.UpdateUserSettingInfo(usersetting); } //校验项目信息. var result = WXInvest.CheckProjectInfo(model, user); if (!result.Success) { this.PrintJson(result.Code.ToString(), result.Message); } //生成项目流水号. var handler = new NoHandler(); var projectNo = handler.ProjectNo(); if (projectNo == "0") { this.PrintJson("-3", "项目流水号生成出错"); } //保存项目信息. var setting = result.GetParameter <WebSettingInfo>("Setting"); result = result + WXInvest.SaveProject(model, user, setting, projectNo, rate); if (!result.Success) { this.PrintJson(result.Code.ToString(), result.Message); } this.PrintJson("1", "提交成功"); }