/// <summary> /// Asynchronous save of ObservableCollection<AccountList>. /// </summary> public async void SaveAccountList() { if (AccountsList == null) { return; } //remove all empty rows. for (int i = AccountsList.Count - 1; i >= 0; i--) { if (AccountsList[i].IsEmpty) { AccountsList.RemoveAt(i); } } KeyFile key; if (File.Exists(settings.keyLocation)) { //load key from appdata. key = await CryptoTools.LoadStoredKeyFile(settings.keyLocation); } else { //create new keyfile if none created yet in appdata. key = await CryptoTools.CreateStoredKeyFile(settings.keyLocation); } //encrypt accountlist into byte array. byte[] listAsBytes = CryptoTools.EncryptData(key.key, key.IV, AccountsList); //save encrypted accountlist await FileManager.SaveFileAsync(settings.saveFileLocation, listAsBytes, false); }
private void LoadCapex() { if (SelectedYear != 0) { CapexList.Clear(); CapexAccountsList.Clear(); StatusSumList.Clear(); foreach (var capex in FullCapexList.Where(f => f.CapexYear == SelectedYear)) { var capexWithRest = new CapexWithRest(); capexWithRest.Capex = capex; var sum = AccountsList.Where(a => a.AccountsStatusDetailsSets.LastOrDefault().AccountStatus != Statuses.InCancel).Sum(a => a.AccountsCapexInfoSets.Where(c => c.CapexId == capex.Id).Sum(c => c.AccountCapexAmount)); if (capex.CapexAmount == 0) { capexWithRest.Rest = sum; capexWithRest.Pay = 100; } else { capexWithRest.Rest = capex.CapexAmount - sum; capexWithRest.Pay = sum == 0 ? 0 : Convert.ToInt32(sum * 100 / capex.CapexAmount); } capexWithRest.PaySum = sum; CapexList.Add(capexWithRest); } } }
public void NotifyAccountAddition(Account addedAccount) { if (!AccountsList.Contains(addedAccount, new AccountComparer())) { UpdateHelper.Instance.AccountsListAdditionHelper.Add(addedAccount); } }
public void NotifyAccountModification(Account modifiedAccount) { if (AccountsList.Contains(modifiedAccount, new AccountComparer())) { UpdateHelper.Instance.AccountsListModificationHelper.Add(modifiedAccount); } }
public void NotifyAccountRemoval(Account removedAccount) { if (AccountsList.Contains(removedAccount, new AccountComparer())) { UpdateHelper.Instance.AccountsListRemovalHelper.Add(removedAccount); } }
public JsonResult SelectListLedgers() { var headlist = db.LedgerHeads.ToList(); List <HeadList> Head_list = new List <HeadList>(); foreach (var item in headlist) { HeadList hl = new HeadList(); hl.HeadId = item.Id; hl.HeadName = item.Name; var ledger = db.Ledgers.Where(x => x.LedgerGroup.Name != "Cash" && x.LedgerGroup.Name != "Bank" && x.LedgerHeadId == item.Id).ToList(); hl.accountlist = new List <AccountsList>(); foreach (var l_item in ledger) { AccountsList Ledger = new AccountsList(); Ledger.Id = l_item.Id; Ledger.Name = l_item.Name; hl.accountlist.Add(Ledger); } Head_list.Add(hl); } return(Json(Head_list, JsonRequestBehavior.AllowGet)); }
public async Task <AccountsList> UpdateAccountAsync(AccountsList accountsList) { DbContext.accountsLists.Update(accountsList); await DbContext.SaveChangesAsync(); return(accountsList); }
void addAccountList(Accounts obj) { AccountsList.Add(new AccountsDetailVM() { Data = obj }); }
public Schema() : base() { InstanceType = typeof(__Franchis__); Properties.ClearExposed(); Html = Add <__TString__>("Html"); Html.DefaultValue = "/Usama/FranchiseBussines.html"; Html.SetCustomAccessors((_p_) => { return(((__Franchis__)_p_).__bf__Html__); }, (_p_, _v_) => { ((__Franchis__)_p_).__bf__Html__ = (System.String)_v_; }, false); franchise = Add <__FfrSchema__>("franchise", bind: "franchise"); franchise.SetCustomAccessors((_p_) => { return(((__Franchis__)_p_).__bf__franchise__); }, (_p_, _v_) => { ((__Franchis__)_p_).__bf__franchise__ = (__Frfranchis__)_v_; }, false); Save = Add <__TLong__>("Save$"); Save.DefaultValue = 0L; Save.Editable = true; Save.SetCustomAccessors((_p_) => { return(((__Franchis__)_p_).__bf__Save__); }, (_p_, _v_) => { ((__Franchis__)_p_).__bf__Save__ = (System.Int64)_v_; }, false); Save.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.Save() { App = (FranchiseDetailVM)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((FranchiseDetailVM)pup).Handle((Input.Save)input); }); Accounts = Add <__FAcSchema__>("Accounts", bind: "Accounts"); Accounts.SetCustomAccessors((_p_) => { return(((__Franchis__)_p_).__bf__Accounts__); }, (_p_, _v_) => { ((__Franchis__)_p_).__bf__Accounts__ = (__FrAccounts__)_v_; }, false); Registor = Add <__TLong__>("Registor$"); Registor.DefaultValue = 0L; Registor.Editable = true; Registor.SetCustomAccessors((_p_) => { return(((__Franchis__)_p_).__bf__Registor__); }, (_p_, _v_) => { ((__Franchis__)_p_).__bf__Registor__ = (System.Int64)_v_; }, false); Registor.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.Registor() { App = (FranchiseDetailVM)pup, Template = (TLong)prop, Value = value }); }, (Json pup, Starcounter.Input <Int64> input) => { ((FranchiseDetailVM)pup).Handle((Input.Registor)input); }); AccountsList = Add <__TArray__>("AccountsList"); AccountsList.SetCustomAccessors((_p_) => { return(((__Franchis__)_p_).__bf__AccountsList__); }, (_p_, _v_) => { ((__Franchis__)_p_).__bf__AccountsList__ = (__Arr__)_v_; }, false); Address = Add <__TString__>("Address"); Address.DefaultValue = ""; Address.SetCustomAccessors((_p_) => { return(((__Franchis__)_p_).__bf__Address__); }, (_p_, _v_) => { ((__Franchis__)_p_).__bf__Address__ = (System.String)_v_; }, false); }
private Account Increment() { while (SortedAccountsI.Any() && SortedAccountsI.Last().Current == null) { SortedAccountsI.PopBack(); if (!AccountsList.Any()) { throw new InvalidOperationException("accounts list is empty"); } AccountsList.PopBack(); } if (!SortedAccountsI.Any()) { return(null); } else { Account account = SortedAccountsI.Last().Current; SortedAccountsI.Last().Increment(); // If this account has children, queue them up to be iterated next. if (!FlattenAll && account.Accounts.Any()) { PushBack(account); } // Make sure the sorting value gets recalculated for this account account.XData.SortCalc = false; return(account); } }
private void AddAccount(Account account) { DataCollection.ReadFiles(); AccountsList.Add(account); DataCollection.AccountList.Add(account); DataCollection.SaveFiles(); MessageBox.Success("Account has been created."); }
public async Task <AccountsList> AddAccountAsync(AccountsList accountsList) { accountsList.Id = Guid.NewGuid(); DbContext.accountsLists.Add(accountsList); await DbContext.SaveChangesAsync(); var accountToReturn = await GetAccountByIdAsync(accountsList.Id); return(accountToReturn); }
public List <Session> UpdateBalances() { List <Session> sessions = new List <Session>(); try { List <RingGamesGet> tables = GetTable(); } catch { Console.WriteLine("Waiting for server to start"); return(null); } bool gameOn = false; gameOn = AnySeatedPlayers(); if (gameOn) { Console.WriteLine("A game is happening, balance changes will not be recorded."); return(null); } DateTime now = DateTime.Now; AccountsList accountList = GetAccounts(); for (int i = 0; i < accountList.Accounts; i++) { if (accountList.Balance[i] != "100000") { User u = _pokerContext.User.Where(u => u.UserName.Equals(accountList.Player[i])).FirstOrDefault(); Console.WriteLine("Recording session for " + u.RealName); bool success = false; int balance; success = Int32.TryParse(accountList.Balance[i], out balance); if (!success) { Console.WriteLine("Non integer balance found, is the smallest chip size set correctly on the table?"); continue; } int chips = balance - 100000; Session s = new Session(); s.Chips = chips; s.Date = now; s.User = u; //s.Name = accountList.RealName[i]; sessions.Add(s); _pokerContext.Sessions.Add(s); _pokerContext.SaveChanges(); SetPrimaryBalance(accountList.Player[i], 100000); } } return(sessions); }
private void SearchAccount() { if (!string.IsNullOrWhiteSpace(SearchAccountText)) { SearchAccountList = new ObservableCollection <AccountsMainSet>(AccountsList.Where(a => a.AccountNumber.Contains(SearchAccountText))); } else { SearchAccountList.Clear(); } }
/// <summary> /// Deletes the currently selected row from ObservableCollection<AccountList> /// </summary> public void DeleteSelectedRow() { if (AccountsList.Count(s => s.isSelected) > 0) { List <AccountModel> selectedAccounts = AccountsList.Where(s => s.isSelected).ToList(); foreach (AccountModel acct in selectedAccounts) { AccountsList.Remove(acct); } } }
/// <summary> /// Runs the code example. /// </summary> /// <param name="service">An authenticated AdExchangeBuyerService</param> public override void Run(AdExchangeBuyerService service) { AccountsList allAccounts = service.Accounts.List().Execute(); foreach (Account account in allAccounts.Items) { Console.WriteLine("Account id: {0}", account.Id); Console.WriteLine("\tMax. total Qps: {0}", account.MaximumTotalQps); Console.WriteLine("\tCookie matching Nid: {0}", account.CookieMatchingNid); Console.WriteLine("\tCookie Matching Url: {0}", account.CookieMatchingUrl); } }
/// <summary> /// Method to lock and unlock account list. /// </summary> public async void LockUnlockForm() { if (!Locked) { Locked = true; AccountsList.Clear(); } else { Locked = false; await OpenAccountList(); } }
private void CreateNewAccountExecute(object parameter) { Object[] parameters = parameter as Object[]; String username = parameters[0] as String; String password = parameters[1] as String; String firstName = parameters[2] as String; String lastName = parameters[3] as String; object roleRegular = parameters[4]; object roleAdmin = parameters[5]; UserControl CreateNewAccountUserControl = parameters[6] as UserControl; AccountToAdd = new Account(username) { FirstName = firstName, LastName = lastName, Password = password, Role = (bool)roleRegular ? ERole.REGULAR : ERole.ADMIN, }; Account createdAccount = null; try { createdAccount = AccountProxy.CreateNewAccount(AccountToAdd); } catch (Exception e) { logger.Error($"Error while deleting - server side. Message: {e.Message}"); LoggerHelper.Instance.LogMessage($"Error while deleting - server side. Message: {e.Message}", EEventPriority.ERROR, EStringBuilder.CLIENT); } if (createdAccount != null) { AccountsList.Add(createdAccount); logger.Error($"Account successfuly added."); LoggerHelper.Instance.LogMessage($"Account successfuly added.", EEventPriority.ERROR, EStringBuilder.CLIENT); CurrentWindow = Window.GetWindow(CreateNewAccountUserControl); CurrentWindow.Close(); } else { logger.Error($"Error on server or username already exists."); LoggerHelper.Instance.LogMessage($"Error on server or username already exists.", EEventPriority.ERROR, EStringBuilder.CLIENT); CurrentWindow = Window.GetWindow(CreateNewAccountUserControl); CurrentWindow.Close(); } }
public void PushBack(Account account) { AccountsList.Add(new List <Account>()); if (FlattenAll) { PushAll(account, AccountsList.Last()); StableSort(AccountsList.Last()); } else { SortAccounts(account, AccountsList.Last()); } SortedAccountsI.Add(AccountsList.Last().Begin()); }
private void AddAccount() { AddAccountV addAccountV = new AddAccountV(); if (addAccountV.ShowDialog() == true) { if (addAccountV.DataContext != null && (addAccountV.DataContext is AddAccountVM) && (addAccountV.DataContext as AddAccountVM).Account != null) { Account newAccount = (addAccountV.DataContext as AddAccountVM).Account; AccountsList.Add(newAccount); AccountsList = AccountsList.OrderBy(x => x.Server).ThenBy(x => x.CustomName).ThenBy(x => x.Login).ToList(); } } }
private void AccountsUpdateTask() { if (UpdateHelper.Instance.AccountsListAdditionHelper.Count != 0) { foreach (Account a in UpdateHelper.Instance.AccountsListAdditionHelper) { if (!AccountsList.Contains(a, new AccountComparer())) { AccountsList.Add(a); } } } if (UpdateHelper.Instance.AccountsListModificationHelper.Count != 0) { foreach (Account a in UpdateHelper.Instance.AccountsListModificationHelper) { if (AccountsList.Contains(a, new AccountComparer())) { Account foundAccount = AccountsList.FirstOrDefault(ac => ac.Username.Equals(a.Username)); AccountsList.Remove(foundAccount); } } } if (UpdateHelper.Instance.AccountsListRemovalHelper.Count != 0) { foreach (Account a in UpdateHelper.Instance.AccountsListRemovalHelper) { if (AccountsList.Contains(a, new AccountComparer())) { Account foundAccount = AccountsList.FirstOrDefault(ac => ac.Username.Equals(a.Username)); AccountsList.Remove(foundAccount); AccountsList.Add(a); } } } if (++UpdateHelper.Instance.AccountCounter >= UpdateHelper.Instance.Limit - 1) { UpdateHelper.Instance.AccountsListAdditionHelper = new List <Account>(); UpdateHelper.Instance.AccountsListRemovalHelper = new List <Account>(); UpdateHelper.Instance.AccountsListModificationHelper = new List <Account>(); UpdateHelper.Instance.AccountCounter = 0; } }
/// <summary> /// Opens NewAccountDialogViewModel with DialogService, following MVVM pattern. /// </summary> public void NewAccountDialogView() { var viewModel = new NewAccountDialogViewModel(); IDialog result = dialogService.ShowDialog(viewModel); if (result != null) { if (result.ShowDialog().HasValue&& result.Content != null && result.Content.GetType() == typeof(AccountModel)) { AccountsList.Add((AccountModel)result.Content); //because acconutlist is subscribed to onchange event, listener will be notified and saved. } else { //Future location of error notifier for new account dialog view } } }
private void ModifyPersonalAccountExecute(object parameter) { Window window = new Window() { Width = 500, Height = 600, Content = new ModifyAccountViewModel(LoggedInAccount, AccountsList, _accountProxy), }; window.ShowDialog(); LoggedInAccount = AccountsList.FirstOrDefault(a => a.Username.Equals(LoggedInAccount.Username)); Object[] parameters = parameter as Object[]; TextBlock tb = parameters[0] as TextBlock; tb.Text = $"Username: {LoggedInAccount.Username} First name: {LoggedInAccount.FirstName} Last name: {LoggedInAccount.LastName}"; LogText = LoggerHelper.Instance.ClientLogBuilder; }
private void LoadAccountsForStore() { if (ResultStore == null || AccountsList == null) { return; } StoreAccountsList.Clear(); foreach (var account in AccountsList.Where(a => a.AccountsStoreDetailsSets.Any(s => s.AccountStore == ResultStore.StoreNumber))) { var storeAccount = new StoreAccount(); var status = account.AccountsStatusDetailsSets.LastOrDefault(); var capexes = account.AccountsCapexInfoSets; storeAccount.AccountAmount = account.AccountAmount.Value; if (capexes != null) { var i = 1; foreach (var capex in capexes) { if (i == capexes.Count) { storeAccount.AccountCapex += capex.AccountCapexName; } else { storeAccount.AccountCapex += capex.AccountCapexName + ";"; } i++; } } storeAccount.AccountCompany = account.AccountCompany; storeAccount.AccountDate = account.AccountDate; storeAccount.AccountDescription = account.AccountDescription; storeAccount.AccountNumber = account.AccountNumber; storeAccount.AccountStatus = status.AccountStatus; storeAccount.AccountStatusDate = status.AccountStatusDate; StoreAccountsList.Add(storeAccount); } }
private void ModifyAccountExecute(object parameter) { Object[] parameters = parameter as Object[]; Account modifiedAccount = null; try { modifiedAccount = AccountProxy.ModifyAccount(AccountToModify); } catch (Exception e) { logger.Error($"Error while deleting - server side. Message: {e.Message}"); LoggerHelper.Instance.LogMessage($"Error while deleting - server side. Message: {e.Message}", EEventPriority.ERROR, EStringBuilder.CLIENT); } if (modifiedAccount != null) { Account foundAccount = AccountsList.FirstOrDefault(a => a.Username.Equals(modifiedAccount.Username)); AccountsList.Remove(foundAccount); AccountsList.Add(modifiedAccount); logger.Info($"Account successfully modified."); LoggerHelper.Instance.LogMessage($"Account successfully modified.", EEventPriority.INFO, EStringBuilder.CLIENT); UserControl uc = parameters[0] as UserControl; Window window = Window.GetWindow(uc); window.Close(); } else { logger.Error($"Error while deleting - server side."); LoggerHelper.Instance.LogMessage($"Error while deleting - server side.", EEventPriority.ERROR, EStringBuilder.CLIENT); UserControl uc = parameters[0] as UserControl; Window window = Window.GetWindow(uc); window.Close(); } }
private static void Main(string[] args) { // See the README.md for details of these fields. // Retrieved from https://console.developers.google.com String ServiceKeyFilePath = "PATH TO JSON KEY FILE HERE"; // Retrieve credential parameters from the key JSON file. var credentialParameters = NewtonsoftJsonSerializer.Instance .Deserialize <JsonCredentialParameters>(System.IO.File .ReadAllText(ServiceKeyFilePath)); // Create the credentials. ServiceAccountCredential oAuth2Credentials = new ServiceAccountCredential( new ServiceAccountCredential.Initializer( credentialParameters.ClientEmail) { Scopes = new[] { AdExchangeBuyerService.Scope.AdexchangeBuyer } }.FromPrivateKey(credentialParameters.PrivateKey)); // Use the credentials to create a client for the API service. AdExchangeBuyerService buyerService = new AdExchangeBuyerService( new BaseClientService.Initializer { HttpClientInitializer = oAuth2Credentials, ApplicationName = "FirstAPICall" }); // Call the Accounts resource on the service to retrieve a list of // Accounts for the service account AccountsList allAccounts = buyerService.Accounts.List().Execute(); foreach (Account account in allAccounts.Items) { Console.WriteLine("Account id: {0}", account.Id); } Console.ReadLine(); }
/// <summary> /// Open dialog for a new simple account locker file with DialogViewModel and DialogService. /// </summary> public void NewSALFile() { var viewModel = new DialogViewModel(true); IDialog result = dialogService.ShowDialog(viewModel); if (result != null) { if (result.ShowDialog().Value == true) { // Accepted // MessageBox.Show("Accepted " + (string)result.Content); settings.saveFileLocation = (string)result.Content; SaveSettings(); // await OpenAccountList(); AccountsList.Clear(); SaveAccountList(); } else { // MessageBox.Show("False"); } } }
private static void Main(string[] args) { // See the README.md for details of these fields. // Retrieved from https://console.developers.google.com String ServiceAccountEmail = "SERVICE ACCOUNT EMAIL HERE"; String ServiceKeyFilePath = "PATH TO P12 KEYFILE HERE-INCLUDE FILENAME"; String ServiceKeyFilePassword = "******"; // Create a certificate object using the key file. X509Certificate2 certificate = new X509Certificate2(ServiceKeyFilePath, ServiceKeyFilePassword, X509KeyStorageFlags.Exportable); // Use the certificate to create credentials. ServiceAccountCredential oAuth2Credentials = new ServiceAccountCredential( new ServiceAccountCredential.Initializer(ServiceAccountEmail) { Scopes = new[] { AdExchangeBuyerService.Scope.AdexchangeBuyer } }.FromCertificate(certificate)); // Use the credentials to create a client for the API service. AdExchangeBuyerService buyerService = new AdExchangeBuyerService( new BaseClientService.Initializer { HttpClientInitializer = oAuth2Credentials, ApplicationName = "FirstAPICall" }); // Call the Accounts resource on the service to retrieve a list of // Accounts for the service account AccountsList allAccounts = buyerService.Accounts.List().Execute(); foreach (Account account in allAccounts.Items) { Console.WriteLine("Account id: {0}", account.Id); } Console.ReadLine(); }
public void PushBack(Account account) { AccountsList.Add(new List <Account>()); if (FlattenAll) { PushAll(account, AccountsList.Last()); StableSort(AccountsList.Last()); if (Logger.Current.ShowDebug("account.sorted")) { foreach (var acct in AccountsList.Last()) { Logger.Current.Debug("account.sorted", () => String.Format("Account (flat): {0}", acct.FullName)); } } } else { SortAccounts(account, AccountsList.Last()); } SortedAccountsI.Add(AccountsList.Last().Begin()); }
protected override void ClearData() { AccountsList.Clear(); }