public List <AccountProxy> GetAllAccounts() { using (var db = new DatabaseEntities()) { return(AccountProxy.GetAccountProxyList(db.Accounts.ToList())); } }
public List <AccountProxy> GetAccountListByTaskId(int taskId) { using (var db = new DatabaseEntities()) { return(AccountProxy.GetAccountProxyList(db.AccountsTasks.Include(ap => ap.Account1).Where(ap => ap.Task == taskId).Select(ap => ap.Account1).ToList())); } }
public void InsertBankAccount() { //Create and Insert var account = GetTestBankAccount(); var accountProxy = new AccountProxy(); var response = accountProxy.InsertAccount(account); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.InsertedEntityId, 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.AreEqual(acct.DataObject.Name, account.Name, "Names not equal"); Assert.AreEqual(acct.DataObject.AccountType, account.AccountType, "Account types not equal"); Assert.AreEqual(acct.DataObject.DefaultTaxCode, account.DefaultTaxCode, "Tax codes not equal"); Assert.AreEqual(acct.DataObject.LedgerCode, account.LedgerCode, "Ledger codes not equal"); Assert.AreEqual(acct.DataObject.Currency, account.Currency, "Currencis not equal"); Assert.AreEqual(acct.DataObject.IsBankAccount, account.IsBankAccount, "IsBankAccount not equal"); Assert.AreEqual(acct.DataObject.IncludeInForecaster, account.IncludeInForecaster, "Include in Forecaster not equal"); Assert.AreEqual(acct.DataObject.BSB, account.BSB, "BSBs not equal"); Assert.AreEqual(acct.DataObject.Number, account.Number, "Account numbers not equal"); Assert.AreEqual(acct.DataObject.BankAccountName, account.BankAccountName, "Bank account names not equal"); Assert.AreEqual(acct.DataObject.BankFileCreationEnabled, account.BankFileCreationEnabled, "BankFileCreationEnabled not equal"); Assert.AreEqual(acct.DataObject.BankCode, account.BankCode, "Bank codes not equal"); Assert.AreEqual(acct.DataObject.UserNumber, account.UserNumber, "User numbers not equal"); Assert.AreEqual(acct.DataObject.MerchantFeeAccountId, account.MerchantFeeAccountId, "Merchant accounts not equal"); Assert.AreEqual(acct.DataObject.IncludePendingTransactions, account.IncludePendingTransactions, "IncludePendingTransactions not equal"); }
static void Main(string[] args) { AccountProxy a = new AccountProxy("NEW10001", 1500, "NEW ACCOUNT"); a.Deposit(500); Console.ReadLine(); }
public void InsertBankAccount() { //Create and Insert var account = _accountHelper.GetTestBankAccount(); var accountProxy = new AccountProxy(); var response = accountProxy.InsertAccount(account); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); Assert.True(response.DataObject.InsertedEntityId > 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.Equal(account.Name, acct.DataObject.Name); Assert.Equal(account.AccountType, acct.DataObject.AccountType); Assert.Equal(account.DefaultTaxCode, acct.DataObject.DefaultTaxCode); Assert.Equal(account.LedgerCode, acct.DataObject.LedgerCode); Assert.Equal(account.Currency, acct.DataObject.Currency); Assert.Equal(account.IsBankAccount, acct.DataObject.IsBankAccount); Assert.Equal(account.IncludeInForecaster, acct.DataObject.IncludeInForecaster); Assert.Equal(account.BSB, acct.DataObject.BSB); Assert.Equal(account.Number, acct.DataObject.Number); Assert.Equal(account.BankAccountName, acct.DataObject.BankAccountName); Assert.Equal(account.BankFileCreationEnabled, acct.DataObject.BankFileCreationEnabled); Assert.Equal(account.BankCode, acct.DataObject.BankCode); Assert.Equal(account.UserNumber, acct.DataObject.UserNumber); Assert.Equal(account.MerchantFeeAccountId, acct.DataObject.MerchantFeeAccountId); Assert.Equal(account.IncludePendingTransactions, acct.DataObject.IncludePendingTransactions); }
// 使用者認證 Authentication public static UserAccount GetAccount(string email, string password) { // 檢查登入者身分 string jsonResult = AccountProxy.GetUserAccount(email, password); UserAccount account = null; var jobjAcct = JObject.Parse(jsonResult); try { // 若無效身分則送出登入異常 switch (jobjAcct["ACCOUNT_TYPE"].ToString()) { case "KKdayAccount": account = jobjAcct["ACCOUNT"].ToObject <KKdayAccount>(); break; case "B2dAccount": account = jobjAcct["ACCOUNT"].ToObject <B2dAccount>(); break; default: throw new Exception("Invalid User Login"); } } catch { throw new Exception("Invalid User Login"); }; return(account); }
public void InsertAccountWithHeader() { //Create and Insert var headerAccount = _accountHelper.GetTestHeaderAccount(); var accountProxy = new AccountProxy(); var headerInsertResponse = accountProxy.InsertAccount(headerAccount); Assert.NotNull(headerInsertResponse); Assert.True(headerInsertResponse.IsSuccessfull, "Reponse has not been successful"); Assert.True(headerInsertResponse.DataObject.InsertedEntityId > 0, "Zero accounts returned"); var headerAccountId = headerInsertResponse.DataObject.InsertedEntityId; var account = _accountHelper.GetTestAccount(); account.HeaderAccountId = headerAccountId; var response = accountProxy.InsertAccount(account); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); Assert.True(response.DataObject.InsertedEntityId > 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.Equal(account.Name, acct.DataObject.Name); Assert.Equal(account.AccountType, acct.DataObject.AccountType); Assert.Equal(account.DefaultTaxCode, acct.DataObject.DefaultTaxCode); Assert.Equal(account.LedgerCode, acct.DataObject.LedgerCode); Assert.Equal(account.Currency, acct.DataObject.Currency); Assert.Equal(account.IsBankAccount, acct.DataObject.IsBankAccount); Assert.Equal(false, acct.DataObject.IncludeInForecaster); Assert.Equal(headerAccountId, acct.DataObject.HeaderAccountId); }
public dynamic ValidatedCaldavUser(string loginName, string token) { //判断这个人是否在北森数据库 var user = AccountProxy.GetAssociatedUsersByLoginName(loginName); if (user == null) { return(null); } var userGuid = RedisCacheHelper.Get <string>(user.TenantId, MakeUserGuidKey(loginName)); if (userGuid == null) { return(null); } if (SecurityHelper.GetMd5($"{user.TenantId}_{user.UserId}_Schedule_{userGuid}") == token) { //校验通过,去获取数据 return("获取到北森的数据了!!!"); } return(null); }
static void Main(string[] args) { AccountProxy a = new AccountProxy("SBI10205", "Rohan", 30000); a.Deposit(1000); Console.Read(); }
public List <AccountProxy> GetAccountListByProjectId(int projectId) { using (var db = new DatabaseEntities()) { return(AccountProxy.GetAccountProxyList(db.AccountsProjects.Include(ap => ap.Account1).Where(ap => ap.Project == projectId).Select(ap => ap.Account1).ToList())); } }
public void UpdateHeaderAccount() { //Create and Insert var account = GetTestHeaderAccount(); var accountProxy = new AccountProxy(); var response = accountProxy.InsertAccount(account); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.InsertedEntityId, 0, "Zero accounts returned"); var accountId = response.DataObject.InsertedEntityId; //Get account again and verify inserted fields. var insertedAcctFromDb = accountProxy.GetAccount(accountId); var newName = string.Format("TestAccount_{0}", Guid.NewGuid()); account.Name = newName; account.LastUpdatedId = insertedAcctFromDb.DataObject.LastUpdatedId; var updateResponse = accountProxy.UpdateAccount(response.DataObject.InsertedEntityId, account); Assert.IsNotNull(updateResponse, "Reponse is null"); Assert.IsTrue(updateResponse.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify inserted fields. var updatedAcctFromDb = accountProxy.GetAccount(accountId); Assert.IsNotNull(updatedAcctFromDb, "Reponse is null"); Assert.IsTrue(updatedAcctFromDb.IsSuccessfull, "Reponse has not been successful"); Assert.AreEqual(updatedAcctFromDb.DataObject.Name, newName); }
private static int GetAccount(string accountType) { var accountsProxy = new AccountsProxy(); var accountsResponse = accountsProxy.GetAccounts(isActive: true, accountType: accountType); if (accountsResponse.DataObject.Accounts.Count == 0) { var account = new AccountDetail { Name = string.Format("TestAccount_{0}", Guid.NewGuid()), AccountType = "Asset", IsActive = true, DefaultTaxCode = "G1", LedgerCode = "AA", Currency = "AUD", IsBankAccount = false }; var accountProxy = new AccountProxy(); var accountResponse = accountProxy.InsertAccount(account); if (accountResponse.IsSuccessfull) { _inventoryAccountId = accountResponse.DataObject.InsertedEntityId; } return(_inventoryAccountId); } else { return(accountsResponse.DataObject.Accounts.First().Id.Value); } }
public void UpdateBankAccountBankFileCreationNotEnabled() { var accountProxy = new AccountProxy(); //Get account, change fields then update. var acct = accountProxy.GetAccount(_bankAcctId); var newBankName = string.Format("UpdatedBankName_{0}", Guid.NewGuid()); acct.DataObject.BankAccountName = newBankName; acct.DataObject.BankFileCreationEnabled = false; acct.DataObject.BankCode = null; acct.DataObject.UserNumber = null; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_bankAcctId); Assert.IsNotNull(acct, "Account in null"); Assert.AreEqual(acct.DataObject.BankAccountName, newBankName, "Bank account names not equal"); Assert.AreEqual(acct.DataObject.BankFileCreationEnabled, false, "BankFileCreationEnabled not equal"); //Bank code and user number should not have changed because BankFileCreationEnabled was false. Assert.IsNull(acct.DataObject.BankCode, "Bank code not null"); Assert.IsNull(acct.DataObject.UserNumber, "User number not null"); }
// TODO: Implement lazy load pattern so each instance creation doesn't create every object instance for no reason")] public TMDbClient(ITMDbSettings settings) : base(settings.BaseUrl) { if (settings.ApiKey.IsNullOrEmpty()) { throw new ArgumentNullException(nameof(settings.ApiKey)); } Settings = settings; Account = new AccountProxy(this); Authentication = new AuthenticationProxy(this); Certifications = new CertificationsProxy(this); Changes = new ChangesProxy(this); Collections = new CollectionsProxy(this); Configuration = new ConfigurationProxy(this); Credits = new CreditsProxy(this); Discover = new DiscoverProxy(this); Exports = new ExportsProxy(this); Find = new FindProxy(this); Genres = new GenresProxy(this); GuestSessions = new GuestSessionsProxy(this); Keywords = new KeywordsProxy(this); Lists = new ListsProxy(this); Movies = new MoviesProxy(this); Network = new NetworkProxy(this); People = new PeopleProxy(this); Reviews = new ReviewsProxy(this); Search = new SearchProxy(this); Trending = new TrendingProxy(this); TVEpisodeGroups = new TVEpisodeGroupsProxy(this); TVEpisodes = new TVEpisodesProxy(this); TV = new TVProxy(this); TVSeasons = new TVSeasonsProxy(this); }
public void UpdateBankAccountBankFileCreationEnabled() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_bankAcctId); var newBankName = string.Format("UpdatedBankName_{0}", Guid.NewGuid()); acct.DataObject.BankAccountName = newBankName; acct.DataObject.BankFileCreationEnabled = true; acct.DataObject.BankCode = "AAA"; acct.DataObject.UserNumber = "222"; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_bankAcctId); Assert.IsNotNull(acct, "Account in null"); Assert.AreEqual(acct.DataObject.BankAccountName, newBankName, "Bank account names not equal"); Assert.AreEqual(acct.DataObject.BankFileCreationEnabled, true, "BankFileCreationEnabled not equal"); Assert.AreEqual(acct.DataObject.BankCode, "AAA", "Bank codes not equal"); Assert.AreEqual(acct.DataObject.UserNumber, "222", "User numbers not equal"); //Reset Bank Code and Customer Number for other tests. acct.DataObject.BankFileCreationEnabled = true; acct.DataObject.BankCode = "TBA"; acct.DataObject.UserNumber = "111"; accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); }
public void InsertAccountWithHeader() { //Create and Insert var headerAccount = GetTestHeaderAccount(); var accountProxy = new AccountProxy(); var headerInsertResponse = accountProxy.InsertAccount(headerAccount); Assert.IsNotNull(headerInsertResponse, "Reponse is null"); Assert.IsTrue(headerInsertResponse.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(headerInsertResponse.DataObject.InsertedEntityId, 0, "Zero accounts returned"); var headerAccountId = headerInsertResponse.DataObject.InsertedEntityId; var account = GetTestAccount(); account.HeaderAccountId = headerAccountId; var response = accountProxy.InsertAccount(account); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.Greater(response.DataObject.InsertedEntityId, 0, "Zero accounts returned"); //Get account again and verify inserted fields. var acct = accountProxy.GetAccount(response.DataObject.InsertedEntityId); Assert.AreEqual(acct.DataObject.Name, account.Name, "Names not equal"); Assert.AreEqual(acct.DataObject.AccountType, account.AccountType, "Account types not equal"); Assert.AreEqual(acct.DataObject.DefaultTaxCode, account.DefaultTaxCode, "Tax codes not equal"); Assert.AreEqual(acct.DataObject.LedgerCode, account.LedgerCode, "Leadge codes not equal"); Assert.AreEqual(acct.DataObject.Currency, account.Currency, "Currencies not equal"); Assert.AreEqual(acct.DataObject.IsBankAccount, account.IsBankAccount, "IsBankAccount not equal"); Assert.AreEqual(acct.DataObject.IncludeInForecaster, false, "IncludeInForecaster should be false for non bank accounts"); Assert.AreEqual(acct.DataObject.HeaderAccountId, headerAccountId); }
private static void SetupBankAccounts() { var accountProxy = new AccountProxy(); var result1 = accountProxy.InsertAccount(new AccountDetail() { AccountType = Constants.AccountType.Asset, BSB = "111-111", Number = "12345-6789", Name = "TestBank " + System.Guid.NewGuid().ToString(), BankAccountName = "TestBank " + System.Guid.NewGuid().ToString(), IsBankAccount = true, Currency = "AUD", }); _bankAccount01Id = result1.DataObject.InsertedEntityId; var result2 = accountProxy.InsertAccount(new AccountDetail() { AccountType = Constants.AccountType.Asset, BSB = "222-222", Number = "2345-6789", Name = "TestBank " + System.Guid.NewGuid().ToString(), BankAccountName = "TestBank " + System.Guid.NewGuid().ToString(), IsBankAccount = true, Currency = "AUD", }); _bankAccount02Id = result1.DataObject.InsertedEntityId; }
public AccountProxy SignUp(AccountProxy account) { try { using (var db = new DatabaseEntities()) { if (db.Accounts.Count() != 0) { if (db.Accounts.Any(a => a.Login == account.Login)) { return(null); } } var acc = db.Accounts.Add(new Account() { Login = account.Login, Password = account.Password, Email = account.Email, FullName = account.FullName, Status = (int)AccountStatus.Online }); db.SaveChanges(); return((AccountProxy)acc); } } catch (Exception err) { throw err; } }
public void UpdateBankAccountBankFileCreationEnabled() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_accountHelper.BankAcctId); var newBankName = string.Format("UpdatedBankName_{0}", Guid.NewGuid()); acct.DataObject.BankAccountName = newBankName; acct.DataObject.BankFileCreationEnabled = true; acct.DataObject.BankCode = "AAA"; acct.DataObject.UserNumber = "222"; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_accountHelper.BankAcctId); Assert.NotNull(acct); Assert.Equal(newBankName, acct.DataObject.BankAccountName); Assert.Equal(true, acct.DataObject.BankFileCreationEnabled); Assert.Equal("AAA", acct.DataObject.BankCode); Assert.Equal("222", acct.DataObject.UserNumber); //Reset Bank Code and Customer Number for other tests. acct.DataObject.BankFileCreationEnabled = true; acct.DataObject.BankCode = "TBA"; acct.DataObject.UserNumber = "111"; accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), acct.DataObject); }
public LoginMediator(object viewComponent) : base(NAME, viewComponent) { loginview = GameObjectUtility.SafeGetComponent <LoginView>(ViewComponent as GameObject); UIEventTriggerListener.Get(loginview.loginBtn.gameObject).onClick += Login; UIEventTriggerListener.Get(loginview.registerBtn.gameObject).onClick += Register; accProxy = Facade.RetrieveProxy(AccountProxy.NAME) as AccountProxy; }
private static void UpdateForUser([CanBeNull] TwitterUser user, DateTime?timestamp) { if (user == null || timestamp == null) { return; } AccountProxy.UpdateUserInfoAsync(user, timestamp.Value); }
public void GetBankAccount() { var accountsProxy = new AccountProxy(); var response = accountsProxy.GetAccount(_bankAcctId); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); Assert.IsTrue(Convert.ToBoolean(response.DataObject.IsBankAccount), "Account returned is not a bank account"); }
public void GetNonBankAccount() { var accountsProxy = new AccountProxy(); var response = accountsProxy.GetAccount(_accountHelper.NonBankAcctId); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); Assert.False(Convert.ToBoolean(response.DataObject.IsBankAccount), "Account returned is a bank account"); }
public void UpdateBankAccount() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_accountHelper.BankAccountToBeUpdated); var newName = string.Format("UpdatedAccount_{0}", Guid.NewGuid()); var newBankAccountName = string.Format("Update Bank Account_{0}", Guid.NewGuid()); var updatedAccount = new AccountDetail { Name = newName, AccountType = "Equity", IsActive = false, IsBankAccount = true, LastUpdatedId = acct.DataObject.LastUpdatedId, DefaultTaxCode = null, Currency = "AUD", LedgerCode = "BB", IncludeInForecaster = false, BSB = "020202", Number = "22222222", BankAccountName = newBankAccountName, BankFileCreationEnabled = true, BankCode = "B", UserNumber = "333", MerchantFeeAccountId = _accountHelper.BankAcctId, IncludePendingTransactions = false }; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), updatedAccount); Assert.NotNull(response); Assert.True(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_accountHelper.BankAccountToBeUpdated); Assert.NotNull(acct); Assert.Equal(newName, acct.DataObject.Name); Assert.Equal("Equity", acct.DataObject.AccountType); Assert.Equal(false, acct.DataObject.IsActive); Assert.Null(acct.DataObject.DefaultTaxCode); Assert.Equal("AUD", acct.DataObject.Currency); Assert.Equal("BB", acct.DataObject.LedgerCode); Assert.Equal(false, acct.DataObject.IncludeInForecaster); Assert.Equal("020202", acct.DataObject.BSB); Assert.Equal("22222222", acct.DataObject.Number); Assert.Equal(newBankAccountName, acct.DataObject.BankAccountName); Assert.Equal(true, acct.DataObject.BankFileCreationEnabled); Assert.Equal("B", acct.DataObject.BankCode); Assert.Equal("333", acct.DataObject.UserNumber); Assert.Equal(_accountHelper.BankAcctId, acct.DataObject.MerchantFeeAccountId); Assert.Equal(false, acct.DataObject.IncludePendingTransactions); }
public void UpdateBankAccount() { var accountProxy = new AccountProxy(); //Get account, change name then update. var acct = accountProxy.GetAccount(_bankAccountToBeUpdated); var newName = string.Format("UpdatedAccount_{0}", Guid.NewGuid()); var newBankAccountName = string.Format("Update Bank Account_{0}", Guid.NewGuid()); var updatedAccount = new AccountDetail { Name = newName, AccountType = "Equity", IsActive = false, IsBankAccount = true, LastUpdatedId = acct.DataObject.LastUpdatedId, DefaultTaxCode = null, Currency = "AUD", LedgerCode = "BB", IncludeInForecaster = false, BSB = "020202", Number = "22222222", BankAccountName = newBankAccountName, BankFileCreationEnabled = true, BankCode = "B", UserNumber = "333", MerchantFeeAccountId = _bankAcctId, IncludePendingTransactions = false }; var response = accountProxy.UpdateAccount(Convert.ToInt32(acct.DataObject.Id), updatedAccount); Assert.IsNotNull(response, "Reponse is null"); Assert.IsTrue(response.IsSuccessfull, "Reponse has not been successful"); //Get account again and verify change. acct = accountProxy.GetAccount(_bankAccountToBeUpdated); Assert.IsNotNull(acct, "Account in null"); Assert.AreEqual(acct.DataObject.Name, newName, "Names not equal"); Assert.AreEqual(acct.DataObject.AccountType, "Equity", "Account types not equal"); Assert.AreEqual(acct.DataObject.IsActive, false, "IsAcive not equal"); Assert.IsNull(acct.DataObject.DefaultTaxCode, "Default should be null"); Assert.AreEqual(acct.DataObject.Currency, "AUD", "Currencies not equal"); Assert.AreEqual(acct.DataObject.LedgerCode, "BB", "Ledger codes not equal"); Assert.AreEqual(acct.DataObject.IncludeInForecaster, false, "Include in Forecaster not equal"); Assert.AreEqual(acct.DataObject.BSB, "020202", "BSBs not equal"); Assert.AreEqual(acct.DataObject.Number, "22222222", "Account Numbers not equal"); Assert.AreEqual(acct.DataObject.BankAccountName, newBankAccountName, "Bank account names not equal"); Assert.AreEqual(acct.DataObject.BankFileCreationEnabled, true, "BankFileCreationEnabled not equal"); Assert.AreEqual(acct.DataObject.BankCode, "B", "Bank codes not equal"); Assert.AreEqual(acct.DataObject.UserNumber, "333", "User numbers not equal"); Assert.AreEqual(acct.DataObject.MerchantFeeAccountId, _bankAcctId, "Merchant accounts not equal"); Assert.AreEqual(acct.DataObject.IncludePendingTransactions, false, "IncludePendingTransactions not equal"); }
private async void Next() { var proxy = new AccountProxy(); var result = await proxy.Register(model.Name, model.Email, model.Password, model.IsSeller); if (result.Succeeded) { await navigationService.NavigateAsync("Login"); } }
static void Main(string[] args) { Account account = new Account(30, "My Account", 300); IAccountService accountProxy = new AccountProxy(new AccountBankBImplService()); accountProxy.showBalance(account); account = accountProxy.depositMoney(account, 50); account = accountProxy.withdrawals(account, 20); accountProxy.showBalance(account); }
private async void SynchronizeDb() { var accounts = (await AccountProxy.GetAccountsAsync().ConfigureAwait(false)).ToArray(); var registered = _accountCache.Keys.ToArray(); var news = registered.Except(accounts).ToArray(); var olds = accounts.Except(registered).ToArray(); await Task.Run(() => Task.WaitAll( olds.Select(AccountProxy.RemoveAccountAsync) .Concat(news.Select(AccountProxy.AddAccountAsync)) .ToArray())).ConfigureAwait(false); }
public void UpdateAccount(AccountProxy account) { using (var db = new DatabaseEntities()) { var acc = db.Accounts.FirstOrDefault(a => a.Id == account.Id); acc.Password = account.Password; acc.FullName = account.FullName; acc.Email = account.Email; db.SaveChanges(); } }
private async void UpdateLocation() { var proxy = new AccountProxy(); var location = await DeviceHelper.GetLocation(); var result = await proxy.UpdateProfile(latitude : location?.Latitude, longitude : location?.Longitude); if (!result.Succeeded) { await pageDialogService.DisplayAlertAsync("Error", result.Response.ToString(), "Ok"); } }