public static UserModel ToUserModel(this AccountUsers dto, IHashingService hashingService) { return(new UserModel { UserRef = dto.userRef, AccountId = hashingService.HashValue(dto.accountId) }); }
/// <summary> /// Initializes a new instance of the <see cref="AccountService"/> class. /// </summary> public AccountService() { AccountUsers.Add(Guid.NewGuid(), new() { LastName = "Harris" }); AccountUsers.Add(Guid.NewGuid(), new() { LastName = "Jones" }); AccountUsers.Add(Guid.NewGuid(), new() { LastName = "Smith" }); AccountUsersNullable.Add(Guid.NewGuid(), new() { LastName = "Harris" }); AccountUsersNullable.Add(Guid.NewGuid(), new() { LastName = "Jones" }); AccountUsersNullable.Add(Guid.NewGuid(), new() { LastName = "Smith" }); AccountUsersNullable.Add(Guid.NewGuid(), null); }
public async Task <AccountsReadStoreBuilder> WithAccountForAccountOwnerUserId(long accountId) { var account = new AccountUsers { Id = TestData.User.AccountDocumentId, ETag = "00000000-0000-0000-0000-000000000000", userRef = TestData.User.AccountOwnerUserId, accountId = accountId }; var documentCollectionUri = UriFactory.CreateDocumentCollectionUri("SFA.DAS.EmployerIncentives.Web.MockServer", "AccountUsers"); await _documentClient.UpsertDocumentAsync(documentCollectionUri, account); return(this); }
/// <summary> /// 激活用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void toolStripButton3_Click_1(object sender, EventArgs e) { //执行数据 int count = 700; DataTable dt = SqlHelper.ExecuteDataTable("select * from AccountUsers where Id>397"); //直接转list List <AccountUsers> listUsers = ToList <AccountUsers>(dt); for (int i = 0; i < listUsers.Count; i++) { count++; AccountUsers accountUsers = listUsers[i]; accountUsers.Id = count + 1; } string msg; SqlHelper.SqlBulkCopyByDatatable("", ToDataTable(listUsers), out msg); }
/// <summary> /// 注册 /// </summary> /// <returns></returns> private async Task <AccountUsers> Register(AccountUsers user) { //注册一个用户 string cellphone = user.CellPhone; //RegisterSuccessInfo responseRegisterSuccessInfo = new RegisterSuccessInfo { IsSuccess = false }; //发送验证码 并且验证该手机号是否存在 //发送验证码 SmsCodeInfo smsCodeInfo = await this.jymService.GetSmsCodeInfo(new SendVeriCodeRequest { Cellphone = cellphone }); //验证 if (await this.jymService.VerifyCellPhone(new VerifyRequest { Cellphone = cellphone, Code = smsCodeInfo.Code.Split('|')[0], Type = 10 })) { //成功后注册 RegisterInfo info = new RegisterInfo { Token = smsCodeInfo.Token, InviteBy = user.InviteBy, ContractId = "300020150820103000", Password = user.Pwd }; if (await this.jymService.Register(info)) { //认证 string realName = user.RealName; string credentialNo = user.CredentialNo; IdentityAuthenticationResponse registerSuccess = await this.jymService.IdentityAuthentication(new IdentityAuthenticationRequest { Credential = "10", CredentialNo = credentialNo, RealName = realName }, cellphone, user.Pwd); if (registerSuccess.IsSuccess) { user.UserIdentifier = registerSuccess.UserIdentifier; user.IsVerifed = 1; //将数据存入数据库中 bool addSuccess = SqlHelper.ExecuteNoneQuery($"insert into AccountUsers(BankCardNo,CellPhone,CgCellPhone,CredentialNo,InviteBy,InviteFor,IsActivity,IsAuthInvest,IsAuthWithdraw,IsVerifed,Pwd,RealName,RechargeAmount,RechargeNums,RigisterTime,UserIdentifier,UserMac,IsBankAuth)values('{user.BankCardNo}','{user.CellPhone}','{user.CgCellPhone}','{user.CredentialNo}','{user.InviteBy}','{user.InviteFor}',{user.IsActivity},{user.IsAuthInvest},{user.IsAuthWithdraw},{user.IsVerifed},'{user.Pwd}','{user.RealName}',{user.RechargeAmount},{user.RechargeNums},'{user.RigisterTime}','{user.UserIdentifier}','{user.UserMac}',0)") > 0; if (addSuccess) { return(user); } } return(null); } } return(null); }
public object Get(Invoices request) { DateTime startDate, endDate; endDate = request.end_date ?? DateTime.UtcNow; startDate = request.start_date ?? endDate.Date.AddDays(-365); startDate = startDate.Date; endDate = endDate.Date.AddDays(1).AddSeconds(-1); ApiUser hdUser = request.ApiUser; List <Models.Invoice> invoices = null; return(base.RequestContext.ToOptimizedResultUsingCache(base.Cache, string.Format("urn:{0}:{1}{2}", base.Request.GetBasicAuth(), base.Request.PathInfo.Substring(1), (base.Request.QueryString.Count > 0 ? ":" + base.Request.QueryString.ToString() : "")), new System.TimeSpan(0, 0, 0), () => { if ("unbilled" == request.status) { invoices = Models.Invoices.GetInvoicesUnbilled(hdUser.OrganizationId, hdUser.DepartmentId, hdUser.UserId, startDate, endDate, request.project, request.account); } else { invoices = Models.Invoices.GetInvoices(hdUser.OrganizationId, hdUser.DepartmentId, hdUser.UserId, startDate, endDate, request.project, request.account); } if (invoices.Count == 1) { //invoices[0].AddDetails(hdUser.OrganizationId, hdUser.DepartmentId, startDate, endDate, false, request.time_logs, request.travel_logs, request.expenses, request.retainers, request.adjustments); if (request.account.HasValue && request.account != 0 && "unbilled" == request.status) { bigWebApps.bigWebDesk.Data.Invoice.CalculateStartSopDates(hdUser.OrganizationId, hdUser.DepartmentId, out startDate, out endDate, request.account.Value, request.project ?? 0); invoices[0].BeginDate = startDate; invoices[0].EndDate = endDate; } invoices[0].recipients = AccountUsers.GetAccountUsers(hdUser.OrganizationId, hdUser.DepartmentId, invoices[0].AccountId); return invoices; } return request.FilteredResult <Models.Invoice>(invoices); })); }
public async Task <IActionResult> Register([FromBody] RegisterUser rvm) { if (ModelState.IsValid) { AccountUsers user = new AccountUsers() { //UserName = rvm.Email, Email = rvm.Email }; var result = await _userManager.CreateAsync(user, rvm.Password); if (result.Succeeded) { await _context.GetCartForUser(user.Email); Claim emailClaim = new Claim(ClaimTypes.Email, user.Email); List <Claim> claims = new List <Claim> { emailClaim }; await _userManager.AddClaimsAsync(user, claims); await _signInManager.SignInAsync(user, isPersistent : false); if (user.Email == "*****@*****.**" || user.Email.Contains("@admin.com") || user.Email == "*****@*****.**") { await _userManager.AddToRoleAsync(user, ApplicationRoles.MemberAdmin); } _service.Add(user); //return RedirectToAction("Home", "ClientApp"); //return Ok(GenerateJwtToken(rvm.Email, user)); return(Json(GenerateJwtToken(rvm.Email, user))); } } //return View(rvm); return(Json(View(rvm))); }
/// <summary> /// 批量开户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton1_Click(object sender, EventArgs e) { BatchOpenAccount batchOpenAccount = BatchOpenAccount.GetBatchOpenAccount(async nums => await Task.Run(() => { this.lbl_showOpen.Text = "正在批量开户,请耐心等待......."; this.btn_opne.Enabled = false; this.toolStripButton1.Enabled = false; for (int i = 0; i < nums; i++) { this.isFlagByOpenAccount = false; this.secondsOpenAccount = 0; Tuple <string, string> infos = AutoCreateAnyCode.GetUserName1(); AccountUsers user = new AccountUsers { CellPhone = infos.Item2, Pwd = "111111", RealName = infos.Item1, BankCardNo = AutoCreateAnyCode.GetBankCardNo(), CredentialNo = AutoCreateAnyCode.GetCredentialNo(), UserMac = AutoCreateAnyCode.GetMacAddressByNetworkInformation(), CgCellPhone = AutoCreateAnyCode.GetCellPhone(), RigisterTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss") }; if (!this.jymService.CheckCellPhone(user.CellPhone).Result) { continue; } this.btn_opne.Enabled = false; user.RealName = user.RealName == "" ? AutoCreateAnyCode.GetUserName() : user.RealName; user.InviteBy = user.InviteBy == "" ? "22222" : user.InviteBy; user.CgCellPhone = user.CgCellPhone == "" ? AutoCreateAnyCode.GetCellPhone() : user.CgCellPhone; //注册认证 int i1 = i + 1; AccountUsers successAccountUsers = this.Register(user).Result; if (successAccountUsers != null) { //存管开户 bool result = this.bankPageCommon.OpenBankAccount(successAccountUsers, this.webBrowser_OpenAccount, () => { this.lbl_showOpen.Text = $"正在批量开户,请耐心等待....... 已经开户数量{i1}"; this.isFlagByOpenAccount = true; }).Result; } else { this.lbl_showOpen.Text = $"第{i1}个用户开户失败"; } while (!this.isFlagByOpenAccount) { Thread.Sleep(2000); this.secondsOpenAccount += 2000; if (this.secondsOpenAccount >= 35000) { this.lbl_showOpen.Text = $"第{i1}个用户开户失败"; break; } } } this.lbl_showOpen.Text = "批量开户结束"; this.btn_opne.Enabled = true; this.toolStripButton1.Enabled = true; })); batchOpenAccount.ShowDialog(); }
/// <summary> /// 开户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private async void btn_opne_Click(object sender, EventArgs e) { int a = 0; int b = 0; string bankName = this.cb_BankcardNos.Text; if (bankName == "请选择银行卡") { MessageBox.Show("请先选择银行卡"); return; } string bankCardNo = AutoCreateAnyCode.GetBankCardNo(this.dicbankInfo[bankName]); AccountUsers user = new AccountUsers { CellPhone = this.txb_CellPhone.Text.Trim(), InviteBy = this.txb_inviteBy.Text.Trim(), Pwd = this.txb_Pwd.Text.Trim(), RealName = this.txb_UserName.Text.Trim(), BankCardNo = bankCardNo, CredentialNo = AutoCreateAnyCode.GetCredentialNo(), UserMac = AutoCreateAnyCode.GetMacAddressByNetworkInformation(), CgCellPhone = this.txb_BankCardCellPhone.Text.Trim(), RigisterTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss") }; Regex regex = new Regex("^\\d{11}$"); if (!regex.IsMatch(user.CellPhone)) { MessageBox.Show("手机号格式有误"); return; } if (!await this.jymService.CheckCellPhone(user.CellPhone)) { MessageBox.Show("手机号已经使用"); return; } if (string.IsNullOrEmpty(user.Pwd)) { MessageBox.Show("密码不能为空"); return; } this.btn_opne.Enabled = false; this.lbl_showOpen.Text = "正在开户,请耐心等待................"; user.RealName = user.RealName == "" ? AutoCreateAnyCode.GetUserName() : user.RealName; user.InviteBy = user.InviteBy == "" ? "22222" : user.InviteBy; user.CgCellPhone = user.CgCellPhone == "" ? AutoCreateAnyCode.GetCellPhone() : user.CgCellPhone; //注册认证 AccountUsers successAccountUsers = await this.Register(user); if (successAccountUsers != null) { //存管开户 await this.bankPageCommon.OpenBankAccount(successAccountUsers, this.webBrowser_OpenAccount, () => { this.lbl_showOpen.Text = "开户成功"; this.btn_opne.Enabled = true; }); } else { this.lbl_showOpen.Text = "auth系统报错导致开户失败,请找交易系统开发人员"; } }
/// <summary> /// 点击开始注册 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button6_Click(object sender, EventArgs e) { try { this.lbl_msg.Text = string.Empty; this.txb_SuccessNums.Text = "0"; long totalNums = Convert.ToInt64(this.txb_Nums.Text.Trim()); if (totalNums == 0) { MessageBox.Show("请输入注册数量"); return; } this.btn_Submit.Enabled = false; this.lbl_msg.Text = "正在开始注册....."; List <Task> listTasks = new List <Task>(); List <long> listDatas = new List <long>(); for (int i = 1; i <= totalNums; i++) { listDatas.Add(i); } for (int i = 0; i < 3; i++) { Task task = Task.Run(async() => { //执行 while (listDatas.Count > 0) { long data = 0; lock (this.objLock) { if (listDatas.Count > 0) { data = listDatas[0]; listDatas.Remove(data); } } if (data == 0) { continue; } Tuple <string, string> infos = AutoCreateAnyCode.GetUserName1(); AccountUsers user = new AccountUsers { CellPhone = infos.Item2, Pwd = "111111", RealName = infos.Item1, BankCardNo = AutoCreateAnyCode.GetBankCardNo(), CredentialNo = AutoCreateAnyCode.GetCredentialNo(), UserMac = AutoCreateAnyCode.GetMacAddressByNetworkInformation(), CgCellPhone = AutoCreateAnyCode.GetCellPhone(), RigisterTime = DateTime.Now.ToString("yyyyMMdd HH:mm:ss") }; if (!this.jymService.CheckCellPhone(user.CellPhone).Result) { continue; } user.RealName = user.RealName == "" ? AutoCreateAnyCode.GetUserName() : user.RealName; user.InviteBy = user.InviteBy == "" ? "22222" : user.InviteBy; user.CgCellPhone = user.CgCellPhone == "" ? AutoCreateAnyCode.GetCellPhone() : user.CgCellPhone; //注册认证 AccountUsers successAccountUsers = await this.Register(user); if (successAccountUsers != null) { //成功 lock (this.objLock) { this.txb_SuccessNums.Text = (Convert.ToInt64(this.txb_SuccessNums.Text) + 1).ToString(); } } } }); listTasks.Add(task); } Task.WhenAll(listTasks); this.btn_Submit.Enabled = true; } catch (Exception exception) { this.btn_Submit.Enabled = true; this.lbl_msg.Text = exception.Message; } }
/// <summary> /// 开通存管账户 /// </summary> /// <returns></returns> public async Task <bool> OpenBankAccount(AccountUsers user, WebBrowser webBrowser, Action action) { SetWebbrowser.SumitForm(12); webBrowser.ScriptErrorsSuppressed = true; OpenAccountRequest request = new OpenAccountRequest { BankCardNo = user.BankCardNo, BankCardPhone = user.CgCellPhone, BizType = "01", CertNo = user.CredentialNo, RealName = user.RealName, RegisteredCell = user.CellPhone, ReturnUrl = "http://www.baidu.com/", UserId = user.UserIdentifier, ClientType = 900, OrderId = Guid.NewGuid().ToString("N").ToUpper() }; BankSercrityInfo openAcountResponse = await this.jymService.OpenAccountAsync(request); if (openAcountResponse == null) { return(false); } string url = $"http://fsgw.hkmdev.firstpay.com/phoenixFS-fsgw/gateway?data={HttpUtility.UrlEncode(openAcountResponse.Data)}&tm={HttpUtility.UrlEncode(openAcountResponse.Tm)}&merchantId=M20000002130"; //添加一个 //WebBrowser webBrowser = new WebBrowser { Name = "wb" + Guid.NewGuid().ToString("N").ToUpper() }; webBrowser.Navigate(new Uri(url, UriKind.Absolute)); int first = 0; webBrowser.DocumentCompleted += (obj, e) => { //赋值 HtmlDocument htmlDocument = webBrowser.Document; if (first == 0) { if (htmlDocument != null) { try { Thread.Sleep(650); string html1 = htmlDocument.Body?.InnerHtml; string dkfk = html1; //webBrowser.Navigate("jajavascript:window.alert($)"); //webBrowser.Navigate("javascript:$('#payPassword').next().click();$('#confirmPayPassword').next().click();$('#payPassword').val('111111');$('#confirmPayPassword').val('111111');$('#sendSmsCode').click();$('#smsCode').val('123456');$(':submit').click()"); int a = 0; Thread th = new Thread(() => { try { Thread.Sleep(650); string html = htmlDocument.Body?.InnerHtml; HtmlElement setPwd = htmlDocument.GetElementById("payPassword"); //输入密码 HtmlElement parent = setPwd?.Parent?.GetElementsByTagName("button")[0]; parent?.InvokeMember("click"); //获取到键值为1的id HtmlElement key1 = htmlDocument.GetElementById("key11"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); key1?.InvokeMember("click"); HtmlElement confirmSetPwd = htmlDocument.GetElementById("confirmPayPassword"); //确认密码 HtmlElement parent1 = confirmSetPwd?.Parent?.GetElementsByTagName("button")[0]; parent1?.InvokeMember("click"); //获取到键值为1的id HtmlElement key2 = htmlDocument.GetElementById("key11"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); key2?.InvokeMember("click"); List <HtmlElement> listElements = new List <HtmlElement> { htmlDocument.GetElementById("payPassword"), htmlDocument.GetElementById("payPasswordConfirm"), htmlDocument.GetElementById("bankCode"), htmlDocument.GetElementById("bankCardNoInput"), htmlDocument.GetElementById("bankCardPhone"), htmlDocument.GetElementById("smsCode") }; foreach (HtmlElement t in listElements) { t?.SetAttribute("data-status", "true"); } HtmlElementCollection input = htmlDocument.GetElementsByTagName("input"); input[10]?.SetAttribute("data-status", "true"); //var pas = document.getElementById('confirmPayPassword'); pas.nextElementSibling.onclick(); var ke1 = document.getElementById('key11'); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); //undefined //var pas = document.getElementById('payPassword'); pas.nextElementSibling.onclick(); var ke1 = document.getElementById('key11'); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); ke1.onclick(); //$('#payPassword').next().click();$('#confirmPayPassword').next().click();$('#payPassword').val('111111');$('#confirmPayPassword').val('111111');$('#sendSmsCode').click();$('#smsCode').val('123456');$(':submit').click() //webBrowser.Navigate("javascript:$(\'#payPassword\').next().click()"); //webBrowser.Navigate("javascript:$('#payPassword').next().click();$('#confirmPayPassword').next().click();$('#payPassword').val('111111');$('#confirmPayPassword').val('111111');$('#sendSmsCode').click();$('#smsCode').val('123456');"); //$(':submit').click() //setPwd?.SetAttribute("value", "111111"); //htmlDocument.GetElementById("payPasswordConfirm")?.SetAttribute("value", "111111"); htmlDocument.GetElementById("smsCode")?.SetAttribute("value", "123456"); //点击按钮 for (int ii = 0; ii < input.Count; ii++) { if (input[ii].GetAttribute("type").ToLower().Equals("submit")) { input[ii].InvokeMember("click"); } } } catch (Exception exception) { Console.WriteLine(exception); throw; } }) { IsBackground = true }; th.Start(); } catch (Exception ex) { //是失败 } } } first = first + 1; bool?contains = htmlDocument?.Body?.OuterHtml.Contains("成功开通"); if (contains != null && (bool)contains) { action(); } }; return(false); }