protected void save_Click(object sender, EventArgs e) { //表头 T_Account item = new T_Account(); item.AccountName = txt_account_name.Text.Trim(); if (string.IsNullOrEmpty(item.AccountName)) { Label1.Text = "账户名不能为空"; return; } item.AccountId = txt_account_id.Text.Trim(); if (string.IsNullOrEmpty(item.AccountId)) { Label1.Text = "账号不能为空"; return; } item.OpeningBank = txt_opening_bank.Text.Trim(); if (string.IsNullOrEmpty(item.OpeningBank)) { Label1.Text = "开户行不能为空"; return; } item.CurrencyID = Int32.Parse(ddl_currency.SelectedValue); string amount = txt_amount.Text.Trim(); if (string.IsNullOrEmpty(amount)) { item.Amount = 0; } else { item.Amount = Decimal.Parse(amount); } try { AccountAdapter aa = new AccountAdapter(); if (string.IsNullOrEmpty(HiddenField1.Value)) { aa.insertAccount(item); } else { aa.update(item); } clean(); GridView1.SelectedIndex = -1; show(); Label1.Text = "哟,小伙子,不错,被你录入成功了"; } catch (Exception ex) { Label1.Text = ex.Message; } }
private void ddlAccount() { AccountAdapter aa = new AccountAdapter(); DataSet ds = aa.getAccounts(); ddl_account.DataTextField = "account_id"; ddl_account.DataValueField = "account_id"; ddl_account.DataSource = ds; ddl_account.DataBind(); }
public static void Withdraw(Account account, decimal amount, ModelStateDictionary ModelState) { try { AccountAdapter accountAdapter = new AccountAdapter(account); accountAdapter.Withdraw(amount); } catch (BusinessRulesException e) { ModelState.AddModelError(nameof(amount), e.errMsg); return; } }
protected override async Task RegisterAccount(Account account, CancellationToken cancellationToken) { var table = GetTable("Accounts"); // Force a failure scenario that isn't await table.DeleteAsync().ConfigureAwait(false); var adapter = new AccountAdapter(account); var operation = TableOperation.Insert(adapter); // This will fail to insert because the table does not exist await table.ExecuteAsync(operation).ConfigureAwait(false); }
public static IServiceCollection CreateSingletonForEachAdapter(this IServiceCollection services, string postgresConfig) { accountAdapter = new AccountAdapter(postgresConfig); contractAdapter = new ContractAdapter(postgresConfig); deviceAdapter = new DeviceAdapter(postgresConfig); subscriberAdapter = new SubscriberAdapter(postgresConfig); return(services? .AddSingleton(accountAdapter) .AddSingleton(contractAdapter) .AddSingleton(deviceAdapter) .AddSingleton(subscriberAdapter)); }
/// <summary> /// 檢查帳號是否已經存在 /// </summary> /// <param name="email">信箱</param> /// <returns></returns> public bool CheckAccountExist(string email) { var user = new AccountAdapter().GetAccountInfo(email); if (user != null) { return(true); } else { return(false); } }
// GET: Account public ActionResult Index() { var daoResponse1 = AccountAdapter.GetAllUsers(); var daoResponse2 = AccountAdapter.GetAllCategories(); if (daoResponse1.Success) { var vm = new IndexViewModel(); vm.Import(daoResponse1.Items, daoResponse2.Items); return(View(vm)); } return(RedirectToAction("Index", "Home")); }
protected override async Task RegisterAccount(Account account, CancellationToken cancellationToken) { var existingAccount = new Account { Id = _expectedId, Provider = account.Provider, Subject = account.Subject }; var adapter = new AccountAdapter(existingAccount); // Ensure the entity exists to test the conflict logic await InsertEntity("Accounts", adapter, cancellationToken).ConfigureAwait(false); await base.RegisterAccount(account, cancellationToken).ConfigureAwait(false); }
public async Task <IActionResult> RegisterAsync([FromBody] RegisterModel registerModel) { var account = AccountAdapter.RegisterModelToModel(registerModel); if (account == null || !ModelState.IsValid) { throw new CustomException("Errors.INVALID_REGISTRATION_DATA", "Errors.INVALID_REGISTRATION_DATA_MSG"); } try { if (registerModel.PhoneNumber != null) { var formatedPhoneNumber = PhoneNumbers.PhoneNumberHelpers.GetFormatedPhoneNumber(registerModel.PhoneNumber); account.PhoneNumber = formatedPhoneNumber; } //standardize phone number } catch (NumberParseException) { throw new CustomException("Errors.INVALID_PHONE_NUMBER", "Errors.INVALID_PHONE_NUMBER_MSG"); } account.AccountPermissions = new List <Models.AccountPermission>() { new Models.AccountPermission { PermissionId = "MEMBER" } }; string password = account.Password; account = await _accountService.CreateAsync(account, account.Password); //publish a jobseeker account is created message to rabbit mq bus await _rawRabbitBus.PublishAsync(new AccountCreatedForEmail { Id = account.AccountId, Password = password, Birthday = registerModel.Birthday, Position = registerModel.Position, PhoneNumber = account.PhoneNumber, FirstName = registerModel.FirstName, LastName = registerModel.LastName, Email = registerModel.Email, LoginUrl = CommonContants.LoginUrl }); //string smsContent = $"Verification code at JobHop: {account.VerificationCodes.First().VerifyCode}"; ////send SMS using eSMS.vn //var response = await _esmsService.SendSMS(account.PhoneNumber, smsContent, 4); var viewModel = AccountAdapter.ToViewModel(account); return(new JsonResult(viewModel)); }
private static void InitTransactions(IServiceProvider serviceProvider) { var context = new MainContext(serviceProvider.GetRequiredService <DbContextOptions <MainContext> >()); // Initial Deposit string comment = "Initial deposit"; List <Account> accounts = context.Accounts.ToListAsync().Result; AccountAdapter accountAdapter = new AccountAdapter(accounts[0]); accountAdapter.Deposit(100, comment); accountAdapter = new AccountAdapter(accounts[1]); accountAdapter.Deposit(500, comment); accountAdapter = new AccountAdapter(accounts[2]); accountAdapter.Deposit(500.95m, comment); accountAdapter = new AccountAdapter(accounts[3]); accountAdapter.Deposit(1000, comment); context.SaveChanges(); }
public override void OnViewCreated(View view, Bundle savedInstanceState) { ((IActionBarContainer)Activity).SetTitle(Resource.String.app_name); ((IEmptyView)Activity).SetEmptyText(Resource.String.msg_no_account); ((IEmptyView)Activity).SetEmptyImage(Resource.Drawable.ic_person_add_black_48dp); _tipShown = ((IPreferenceContainer)Activity).GetBoolean(PreferenceKeyTipIsShown, false); _recyclerView = view.FindViewById <RecyclerView>(Resource.Id.fragment_recyclerview_view); _adapter = ((IInstagramAccounts)Activity).CreateAccountAdapter(this); _recyclerView.SetAdapter(_adapter); _taskAwaiter = new TaskAwaiter((IFragmentContainer)Activity); _taskAwaiter.TaskDone += TaskAwaiter_TaskDone; _taskAwaiter.Error += TaskAwaiter_Error; _taskAwaiter.AwaitTask(((IInstagramAccounts)Activity).InitializeIfNeededAsync()); }
private void ddlOpeningBankBind() { AccountAdapter aa = new AccountAdapter(); DataSet ds = aa.getSettlementListForDDL(); DataRow dr = ds.Tables[0].NewRow(); dr["opening_bank"] = "请选择"; dr["account_name"] = "请选择"; ds.Tables[0].Rows.InsertAt(dr, 0); ddl_opening_bank.DataTextField = "opening_bank"; ddl_opening_bank.DataValueField = "opening_bank"; ddl_opening_bank.DataSource = ds; ddl_opening_bank.DataBind(); DropDownList2.DataTextField = "opening_bank"; DropDownList2.DataValueField = "opening_bank"; DropDownList2.DataSource = ds; DropDownList2.DataBind(); }
/// <summary> /// 登入 /// </summary> /// <param name="email">信箱</param> /// <param name="password">密碼</param> /// <returns></returns> public Tuple <bool, string> Login(string email, string password, out User account) { account = new AccountAdapter().GetAccountInfo(email); if (account == null) { return(new Tuple <bool, string>(false, "帳號不存在")); } else if (HttpUtility.UrlEncode(password) != account.Password) { return(new Tuple <bool, string>(false, "密碼錯誤")); } //else if (account.Level < 0) //{ // return new Tuple<bool, string>(false, "帳號無法使用"); //} else { return(new Tuple <bool, string>(true, string.Empty)); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { string account_id = e.CommandArgument.ToString(); AccountAdapter aa = new AccountAdapter(); try { aa.delete(account_id); GridView1.SelectedIndex = -1; show(); clean(); Label1.Text = "删除成功"; } catch (Exception ex) { Label1.Text = ex.Message; } } }
private void AccountsFragment_Create(object sender, OnCreateEventArgs e) { Title = GetString(Resource.String.app_name); EmptyText = GetString(Resource.String.msg_no_account); // TODO: set ErrorText SetEmptyImage(Resource.Drawable.ic_person_add_black_48dp); var accounts = ((IInstagramHost)Activity).Accounts; _adapter = new AccountAdapter(accounts, this); Adapter = _adapter; if (accounts.IsStateRestored) { ViewMode = RecyclerViewMode.Data; } else { DoTask(accounts.RestoreStateAsync(), _adapter.NotifyDataSetChanged); } }
protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { ddl_opening_bank.SelectedValue = DropDownList2.SelectedValue; ddl_currency.SelectedValue = "1000"; DropDownList1.SelectedValue = "1"; AccountAdapter aa = new AccountAdapter(); DataSet ds = aa.getAccountInfoByBankAndCurrency(ddl_opening_bank.SelectedValue, 1000); if (ds.Tables[0].Rows.Count > 0) { txt_account_id.Text = ds.Tables[0].Rows[0]["account_id"].ToString(); txt_account_name.Text = ds.Tables[0].Rows[0]["account_name"].ToString(); txt_amount.Text = ds.Tables[0].Rows[0]["amount"].ToString(); } ds = aa.getAccountInfoByBankAndCurrency(ddl_opening_bank.SelectedValue, 1); if (ds.Tables[0].Rows.Count > 0) { TextBox2.Text = ds.Tables[0].Rows[0]["account_id"].ToString(); TextBox3.Text = ds.Tables[0].Rows[0]["account_name"].ToString(); TextBox4.Text = ds.Tables[0].Rows[0]["amount"].ToString(); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { var view = inflater.Inflate(Resource.Layout.AccountFragment, null); _accountDebitListView = view.FindViewById<ListView>(Resource.Id.accountDebitListView); _accountCreditListView = view.FindViewById<ListView>(Resource.Id.accountCreditListView); _accountDebitListView.ItemClick += _accountSelected; _accountCreditListView.ItemClick += _accountSelected; _debit = new List<Account>(); _credit = new List<Account>(); _debitAdapter = new AccountAdapter(Activity, _debit); _creditAdapter = new AccountAdapter(Activity, _credit); _accountDebitListView.Adapter = _debitAdapter; _accountCreditListView.Adapter = _creditAdapter; return view; }
public static async Task <int> GetId(IResolverContext context, [Parent] Account account, [Service] AccountAdapter data) => account.Id = account.Id == default ? await context.BatchDataLoader <long, int>("getAccountsIds", data.GetIds).LoadAsync(account.Id) : account.Id;
public static async Task <long> GetСontractNumber(IResolverContext context, [Parent] Account account, [Service] AccountAdapter data) => account.Id != default ? await context.BatchDataLoader <int, long>("getContractNumsByIds", data.GetContractNumsByIds).LoadAsync(account.Id) : await context.BatchDataLoader <long, long>("getContractNumsByNums", data.GetContractNumsByNums).LoadAsync(account.Number);
public static async Task <IEnumerable <SubscriberDevice> > GetDevices(IResolverContext context, [Parent] Account account, [Service] AccountAdapter data) => account.Devices = (account.Id != default
public static async Task <DateTime> GetCreationDate(IResolverContext context, [Parent] Account account, [Service] AccountAdapter data) => account.Id != default ? await context.BatchDataLoader <int, DateTime>("getAccountsDatesByIds", data.GetDatesByIds).LoadAsync(account.Id) : await context.BatchDataLoader <long, DateTime>("GetAccountsDatesByNums", data.GetDatesByNums).LoadAsync(account.Number);
public static async Task <decimal> GetBalance(IResolverContext context, [Parent] Account account, [Service] AccountAdapter data) => account.Id != default ? await context.BatchDataLoader <int, decimal>("getBalancesByIds", data.GetBalancesByIds).LoadAsync(account.Id) : await context.BatchDataLoader <long, decimal>("getBalancesByNums", data.GetBalancesByNums).LoadAsync(account.Number);
public static async Task <long> GetNumber(IResolverContext context, [Parent] Account account, [Service] AccountAdapter data) => account.Number = account.Number == default ? await context.BatchDataLoader <int, long>("getAccountsNumbers", data.GetNumbersByIds).LoadAsync(account.Id) : account.Number;
protected void save_Click(object sender, EventArgs e) { T_SettlementLog log = new T_SettlementLog(); decimal out_amount = Decimal.Parse(TextBox5.Text.Trim()); decimal in_amount = Decimal.Parse(TextBox6.Text.Trim()); decimal exchange_rate = Decimal.Parse(txt_exchange_rate.Text.Trim()); log.InSettlementAmount = in_amount; log.OutSettlementAmount = out_amount; log.ExchangeRate = exchange_rate; List <T_Account> lists = new List <T_Account>(); T_Account list = new T_Account(); list.AccountId = txt_account_id.Text.Trim(); list.OpeningBank = ddl_opening_bank.SelectedValue; list.AccountName = txt_account_name.Text.Trim(); list.Amount = Decimal.Parse(txt_amount.Text.Trim()) - out_amount; list.CurrencyID = Int32.Parse(ddl_currency.SelectedValue); log.OutAccountId = list.AccountId; log.OutOpeningBank = list.OpeningBank; log.OutAccountName = list.AccountName; log.OutAmount = Decimal.Parse(txt_amount.Text.Trim()); log.OutCurrencyid = list.CurrencyID; lists.Add(list); list = new T_Account(); list.AccountId = TextBox2.Text.Trim(); list.OpeningBank = DropDownList2.SelectedValue; list.AccountName = TextBox3.Text.Trim(); list.Amount = Decimal.Parse(TextBox4.Text.Trim()) + in_amount; list.CurrencyID = Int32.Parse(DropDownList1.SelectedValue); log.InAccountId = list.AccountId; log.InOpeningBank = list.OpeningBank; log.InAccountName = list.AccountName; log.InAmount = Decimal.Parse(TextBox4.Text.Trim()); log.InCurrencyid = list.CurrencyID; lists.Add(list); log.OperateTime = DateTime.Now; log.Operater = UserInfoAdapter.CurrentUser.Name; try { AccountAdapter aa = new AccountAdapter(); aa.updateLists(lists); aa.log(log); show(); clean(); Label1.Text = "结汇成功"; } catch (Exception ex) { Label1.Text = ex.Message; return; } }
internal AccountContract(AccountAdapter adapter) { _adapter = adapter; }
internal AccountContract() { _adapter = new AccountAdapter(); }
public static bool IsAccountExist(string username, string password, out Account result, bool findDeletedToo = false) { return(AccountAdapter.IsExists(username, password, out result, findDeletedToo)); }
private async Task GenerateToken(HttpContext context) { var username = context.Request.Form["username"].ToString(); var password = context.Request.Form["password"].ToString(); var _accountService = (IAccountService)context.RequestServices.GetService(typeof(IAccountService)); var _verifyService = (IVerificationService)context.RequestServices.GetService(typeof(IVerificationService)); //var _rawRabbitClient = (IBusClient)context.RequestServices.GetService(typeof(IBusClient)); //if username is not an email if (username != null && !username.Contains("@")) { //the username user provide is not an email context.Response.ContentType = "application/json"; context.Response.StatusCode = 400; await context.Response.WriteAsync(JsonConvert.SerializeObject(new { Code = "Errors.INCORRECT_LOGIN", Custom = "Errors.INVALID_EMAIL_ADDRESS", Message = "Errors.INCORRECT_LOGIN_MSG" }, Formatting.Indented)); return; } var identity = await _accountService.CheckAsync(username, password); //response if account null or inactive if (identity == null || identity.Status == UserStatus.InActive || (!username.Contains("@"))) { context.Response.ContentType = "application/json"; context.Response.StatusCode = 400; var code = "INCORRECT_LOGIN"; var message = "INCORRECT_LOGIN_MSG"; if (identity != null && identity.Status == UserStatus.InActive) { code = "ACCOUNT_INACTIVE"; message = "ACCOUNT_INACTIVE_MSG"; } await context.Response.WriteAsync(JsonConvert.SerializeObject(new { Code = code, Message = message }, Formatting.Indented)); return; } //if (identity.AccountType == AccountType.Jobseeker && !identity.PhoneNumberVerified) //{ // context.Response.ContentType = "application/json"; // context.Response.StatusCode = 400; // //1 account has only 1 verification => get first // var verification = (await _verifyService.GetVerificationsOfAccount(identity.Id)).FirstOrDefault(); // //account is locked because exceeded limit of retried or resend times // if (verification.Retry >= VerificationService.MAX_RETRY || verification.Resend > VerificationService.MAX_RESEND) // { // await context.Response.WriteAsync(JsonConvert.SerializeObject(new // { // Code = Errors.VERIFICATION_LOCKED, // Message = Errors.VERIFICATION_LOCKED_MSG // }, Formatting.Indented)); // } // else //wait for verification // { // await context.Response.WriteAsync(JsonConvert.SerializeObject(new // { // Code = Errors.WAIT_FOR_VERIFICATION, // Message = Errors.WAIT_FOR_VERIFICATION_MSG // }, Formatting.Indented)); // } // return; //} //add banana reward for first login in day //if (identity.AccountType == AccountType.Jobseeker) //{ // var tracker = await _accountService.AddTracker(new LoginTracker { Account = identity, LoginAt = DateTime.Now }); // if (tracker != null) // { // await _rawRabbitClient.PublishAsync(new AccountLoggedIn { AccountId = identity.Id, LoginAt = tracker.LoginAt }); // } //} var permissions = await _accountService.GetPermissionsOfAccountAsync(identity.AccountId); var now = DateTime.Now; var encodedJwt = TokenProviderMiddleware.GenerateAccessToken(_options, now, identity.UserName, identity.AccountId.ToString(), permissions.ToArray()); var response = new SignInResponseModel { AccessToken = encodedJwt, Expires = now.AddSeconds((int)_options.Expiration.TotalSeconds), Account = AccountAdapter.ToViewModel(identity) }; // Serialize and return the response context.Response.ContentType = "application/json"; await context.Response.WriteAsync(JsonConvert.SerializeObject(response, new JsonSerializerSettings { Formatting = Formatting.Indented })); }
/// <summary> /// BuildCustomerAccountStatement - Populates customerAccountProfile.Statements /// and customerAccountProfile.TotalCurrentBalance /// </summary> /// <param name="accountNumber9">9 digit account number</param> /// <param name="accountNumber">full account number</param> /// <param name="customerAccountProfile">Customer account profile object</param> /// <returns><void></returns> private void BuildCustomerAccountStatement(string accountNumber9, CustomerAccountNumber accountNumber, CustomerAccountProfile customerAccountProfile) { //Get Statements CurrentAmount, EnrolledInEasyPay, EnrolledInStopPaperBill Account account = new Account(); //get a data access obj to coxprod_commerce //DalBillNotification dalBillNotification = new DalBillNotification(); //// setup adapter and fill account object. AccountAdapter adapter = new AccountAdapter(accountNumber, _userName, _siteId, _siteCode); adapter.Fill(account); double totalCurrentBalance = 0.00; double monthlyRecurringRevenue = 0.0; if (account.Statements != null && account.Statements.Count > 0) { customerAccountProfile.Statements = new List <Cox.BusinessObjects.CustomerAccount.Statement>(); for (int j = 0; j < account.Statements.Count; j++) { bool enrolledInStopPaperBill = false; //bool enrolledInEmailBillReminder = false; if (account.Statements[j].BillingOption == eBillingOption.StopPaper) { enrolledInStopPaperBill = true; } if (account.Statements[j].BillingOption == eBillingOption.WebStopPaper) { enrolledInStopPaperBill = true; } //enrolledInEmailBillReminder = dalBillNotification.GetEnrolledInEmailBillReminder(accountNumber9, _siteId, account.Statements[j].AccountNumber16.Substring(4, 4), account.Statements[j].StatementCode); // Call GetMonthlyServiceAmount DalCustomerAccount dalCustomerAccount = new DalCustomerAccount(); CustomerAccountProfileSchema.CustomerMonthlyServiceAmountDataTable customerMonthlyServiceAmountDT = dalCustomerAccount.GetMonthlyServiceAmount(_siteId, accountNumber9); if (customerMonthlyServiceAmountDT != null && customerMonthlyServiceAmountDT.Rows.Count > 0) { customerAccountProfile.TotalMonthlyRecurringRevenue = customerMonthlyServiceAmountDT[0].Total_Monthly_SVC_Amount; for (int i = 0; i < customerMonthlyServiceAmountDT.Count; ++i) { int statementCode = 0; int statementCodeDT = 0; statementCode = int.Parse(account.Statements[j].StatementCode); statementCodeDT = int.Parse(customerMonthlyServiceAmountDT[i].Statement_Code); if (statementCode == statementCodeDT) { monthlyRecurringRevenue = customerMonthlyServiceAmountDT[i].StatementCD_Monthly_SVC_Amount; } } } //[05-02-2009] Start Changes for reflecting AR amounts for Q-Matic //customerAccountProfile.Statements.Add(new Cox.BusinessObjects.CustomerAccount.Statement(account.Statements[j].StatementCode, account.Statements[j].AccountNumber16, monthlyRecurringRevenue, account.Statements[j].CurrentBalance, account.Statements[j].EasyPayFlag, enrolledInStopPaperBill, enrolledInEmailBillReminder)); customerAccountProfile.Statements.Add(new Cox.BusinessObjects.CustomerAccount.Statement(account.Statements[j].StatementCode, account.Statements[j].AccountNumber16, monthlyRecurringRevenue, account.Statements[j].CurrentBalance, account.Statements[j].EasyPayFlag, enrolledInStopPaperBill, account.Statements[j].AR1To30Amount, account.Statements[j].AR31To60Amount, account.Statements[j].AR61To90Amount, account.Statements[j].AR91To120Amount)); //[05-02-2009] Start Changes for reflecting AR amounts for Q-Matic totalCurrentBalance += account.Statements[j].CurrentBalance; } customerAccountProfile.TotalCurrentBalance = totalCurrentBalance; } //[23-02-2009] Start Changes for improving performance of CustomerAccount service AccountActivity accountActivity = new AccountActivity(_userName, _siteId); accountActivity.SetAllowOnlineOrderingFlag(ref account); if (account.AllowOnlineOrdering) { customerAccountProfile.OnlineOrderDelinquentBalance = false; } else { customerAccountProfile.OnlineOrderDelinquentBalance = true; } if (account.OnlineOrderingOptOut != 0) { customerAccountProfile.OnlineOrderBlock = true; } else { customerAccountProfile.OnlineOrderBlock = false; } //[23-02-2009] End Changes for improving performance of CustomerAccount service }