public bool CreateTransaction(AllAccounts account) { var cs = "Host=167.114.144.182;Username=dbaird;Password=N3!lY0ng;Database=dylan"; using var connection = new NpgsqlConnection(cs); connection.Open(); using (var transaction = connection.BeginTransaction()) { var updateCommand = connection.CreateCommand(); updateCommand.Transaction = transaction; updateCommand.CommandText = "INSERT INTO allaccountstransactions (id, date, payee, category, memo, expense, income, balance) VALUES (@id, @date, @payee, @category, @memo, @expense, @income, @balance)"; updateCommand.Parameters.AddWithValue("@date", account.date); updateCommand.Parameters.AddWithValue("@payee", account.payee); updateCommand.Parameters.AddWithValue("@category", account.category); updateCommand.Parameters.AddWithValue("@memo", account.memo); updateCommand.Parameters.AddWithValue("@expense", account.expense); updateCommand.Parameters.AddWithValue("@income", account.income); updateCommand.Parameters.AddWithValue("@balance", account.balance); updateCommand.Parameters.AddWithValue("@id", account.id); updateCommand.ExecuteNonQuery(); transaction.Commit(); } return(true); }
protected override void Add() { base.Add(); var model = _CurrentAccount.Clone(); AllAccounts.Add(model); AllAccountsFirms.Add(model); _CurrentAccount = model; }
public object Any(AllAccounts request) { var ret = new List <Account> { new Account() { Id = 3 } }; return(ret); }
private double GetTotalBalance() { if (IsTransactionView) { return(selectedAccount.CurrentBalance); } return(AllAccounts != null ? AllAccounts.Sum(x => x.CurrentBalance) : 0); }
//get all account , support panigation public static async Task <AllAccounts> getAllAccount(int page, int page_size) { //record của từng trang var skip_row = (page - 1) * page_size; //lấy về api list account var AllAccount = new AllAccounts { lists = await getListAccount(skip_row, page_size), total = await getTotalRecord(), total_page = await getTotalPage(page_size), page_size = page_size, page = page }; return(AllAccount); }
public List <List <string> > GetItems() { List <List <string> > items = new List <List <string> >(); List <string> newitem = new List <string>(); foreach (AccountsModel account in AllAccounts) { newitem = new List <string> { account.Short, account.NameMain, account.SaldoDL.ToString(Vf.LevFormatUI), account.SaldoKL.ToString(Vf.LevFormatUI), account.SaldoDV.ToString(Vf.LevFormatUI), account.SaldoKV.ToString(Vf.LevFormatUI), account.SaldoDK.ToString(Vf.LevFormatUI), account.SaldoKK.ToString(Vf.LevFormatUI) }; items.Add(newitem); } newitem = new List <string> { "-------", "---------", "---------", "---------", "---------", "---------", "---------", "---------" }; items.Add(newitem); newitem = new List <string> { "", "", AllAccounts.Sum(e => e.SaldoDL).ToString(Vf.LevFormatUI), AllAccounts.Sum(e => e.SaldoKL).ToString(Vf.LevFormatUI), AllAccounts.Sum(e => e.SaldoDV).ToString(Vf.LevFormatUI), AllAccounts.Sum(e => e.SaldoKV).ToString(Vf.LevFormatUI), AllAccounts.Sum(e => e.SaldoDK).ToString(Vf.LevFormatUI), AllAccounts.Sum(e => e.SaldoKK).ToString(Vf.LevFormatUI) }; items.Add(newitem); return(items); }
public DesignTimeAccountsViewModel() : base(new CurrentSettingsProvider(new DefaultSettingsProvider()), null, new DesignTimeCommandLocator(), new DesignTimeTranslationUpdater(), new DispatcherWrapper(), null) { AllAccounts.Add(new SmtpAccount { UserName = "******", Server = "SMTP.Server.org" }); AllAccounts.Add(new DropboxAccount { AccountInfo = "Dropbox Account for UserName" }); AllAccounts.Add(new FtpAccount { UserName = "******", Server = "FTP.Server.org" }); AllAccounts.Add(new HttpAccount { UserName = "******", Url = "HTTP.Server.org" }); AllAccounts.Add(new TimeServerAccount { UserName = "******", Url = "TimeServer.org" }); }
private void ActEdit_Click(System.Object sender, System.EventArgs e) { // ----- Edit the selected account. DataRow editRecord; bool editComplete = false; // ----- Ignore if no item is active. if (AllAccounts.SelectedIndex == -1) { return; } editRecord = (DataRow)AllAccounts.SelectedItem; // ----- Keep prompting the user until the data is valid. while (editComplete == false) { // ----- Prompt the user. editRecord.ClearErrors(); if ((new AccountDetail()).EditAccount(ref editRecord, CustomerAccounts) == false) { CustomerAccounts.RejectChanges(); AllAccounts.Refresh(); return; } // ----- The user completed edits to the row. Commit the changes. try { CustomerAccounts.AcceptChanges(); editComplete = true; } catch (Exception ex) { MessageBox.Show("The account could not be changed due to the following error: " + ex.Message); } } // ----- Refresh the item in the display list. AllAccounts.Refresh(); }
public List <AllAccounts> GetAllAccounts() { List <AllAccounts> allAccounts = new List <AllAccounts>(); var cs = "Host=167.114.144.182;Username=dbaird;Password=N3!lY0ng;Database=dylan"; using var connection = new NpgsqlConnection(cs); connection.Open(); using (var transaction = connection.BeginTransaction()) { var selectCommand = connection.CreateCommand(); selectCommand.Transaction = transaction; selectCommand.CommandText = // "SELECT * FROM allaccountstransactions"; "SELECT id, date, payee, category, memo, expense, income, balance FROM allaccountstransactions"; using (var reader = selectCommand.ExecuteReader()) { while (reader.Read()) { var allAccount = new AllAccounts(); allAccount.id = reader.GetInt32(0); allAccount.date = reader.GetDateTime(1); allAccount.payee = reader.GetString(2); allAccount.category = reader.GetString(3); allAccount.memo = reader.GetString(4); allAccount.expense = reader.GetInt32(5); allAccount.income = reader.GetInt32(6); allAccount.balance = reader.GetInt32(7); allAccounts.Add(allAccount); } } transaction.Commit(); } return(allAccounts); }
public AllAccounts GetSpecificAccount(int id) { AllAccounts account = new AllAccounts(); var cs = "Host=167.114.144.182;Username=dbaird;Password=N3!lY0ng;Database=dylan"; using var connection = new NpgsqlConnection(cs); connection.Open(); using (var transaction = connection.BeginTransaction()) { var selectCommand = connection.CreateCommand(); selectCommand.Transaction = transaction; selectCommand.CommandText = "SELECT * FROM allaccountstransactions WHERE id = @id"; // @id will probably work, $id is a syntax error selectCommand.Parameters .AddWithValue("@id", id); // if it's @id above, should it be here as well? I can't test it though because Angular is sending 5 using (var reader = selectCommand.ExecuteReader()) { while (reader.Read()) { account.id = reader.GetInt32(0); account.date = reader.GetDateTime(1); account.payee = reader.GetString(2); account.category = reader.GetString(3); account.memo = reader.GetString(4); account.expense = reader.GetInt32(5); account.income = reader.GetInt32(6); account.balance = reader.GetInt32(7); } } transaction.Commit(); } return(account); }
private void ConflateAllAccounts(PdfCreatorSettings settings) { _accounts = settings?.ApplicationSettings?.Accounts; if (_accounts == null) { return; } AllAccounts.Clear(); _accounts.SmtpAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = _accounts.SmtpAccounts }); _accounts.DropboxAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = _accounts.DropboxAccounts }); _accounts.FtpAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = _accounts.FtpAccounts }); _accounts.HttpAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = _accounts.HttpAccounts }); _accounts.TimeServerAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = _accounts.TimeServerAccounts }); RaisePropertyChanged(nameof(AllAccounts)); }
private void ConflateAllAccounts() { if (Accounts == null) { return; } AllAccounts.Clear(); Accounts.SmtpAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = Accounts.SmtpAccounts }); Accounts.DropboxAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = Accounts.DropboxAccounts }); Accounts.FtpAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = Accounts.FtpAccounts }); Accounts.HttpAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = Accounts.HttpAccounts }); Accounts.TimeServerAccounts.CollectionChanged += RaiseAddAccountsBelowVisibilityChanged; AllAccounts.Add(new CollectionContainer { Collection = Accounts.TimeServerAccounts }); RaisePropertyChanged(nameof(AllAccounts)); }
public ObjectResult CreateTransaction([FromBody] AllAccounts account) { return(new ObjectResult(allAccountsService.CreateTransaction(account))); }
internal string LoadAnaliticDetailsDebit(string accname) { if (!accname.Contains("/")) { int num; if (int.TryParse(accname, out num)) { var model = AllAccounts.FirstOrDefault(e => e.Num == num && e.SubNum == 0); if (model != null) { DAccountsModel = model; return(model.Short); } else { //MainAcc mainAcc = // new MainAcc( // new AccountsModel // { // FirmaId = ConfigTempoSinglenton.GetInstance().CurrentFirma.Id, // TypeAccountEx = 1, // Num = num // }, EditMode.Add, true, "", true); //if (mainAcc.NoAcc) //{ MessageBoxWrapper.Show("Нама такава сметка в сметкопланa"); // ItemsDebit = new ObservableCollection<SaldoItem>(); // DAccountsModel = null; // return ""; //} //mainAcc.ShowDialog(); //if (mainAcc.DialogResult.HasValue && mainAcc.DialogResult.Value) //{ // AllAccounts = new ObservableCollection<AccountsModel>(Context.GetAllAccounts(FirmaId)); // model = AllAccounts.FirstOrDefault(e => e.Num == num && e.SubNum == 0); // if (model != null) // { // DAccountsModel = model; // return model.Short; // } //} //ItemsDebit = new ObservableCollection<SaldoItem>(); //DAccountsModel = null; //return ""; } } ItemsDebit = new ObservableCollection <SaldoItem>(); DAccountsModel = null; return(""); } else { int num, subnum; var ac = accname.Split('/'); if (int.TryParse(ac[0], out num) && int.TryParse(ac[1], out subnum)) { var model = AllAccounts.FirstOrDefault(e => e.Num == num && e.SubNum == subnum); if (model != null) { DAccountsModel = model; return(model.Short); } //MainAcc mainAcc = // new MainAcc( // new AccountsModel // { // FirmaId = ConfigTempoSinglenton.GetInstance().CurrentFirma.Id, // TypeAccountEx = 1, // Num = num, // SubNum = subnum // }, EditMode.Add, false, "", true); //mainAcc.ShowDialog(); //if (mainAcc.DialogResult.HasValue && mainAcc.DialogResult.Value) //{ // AllAccounts = new ObservableCollection<AccountsModel>(Context.GetAllAccounts(FirmaId)); // model = AllAccounts.FirstOrDefault(e => e.Num == num && e.SubNum == subnum); // if (model != null) // { // DAccountsModel = model; // return model.Short; // } //} //ItemsDebit = new ObservableCollection<SaldoItem>(); //DAccountsModel = null; //return ""; } } ItemsDebit = new ObservableCollection <SaldoItem>(); DAccountsModel = null; return(""); }
protected override void Delete() { AllAccounts.Remove(_CurrentAccount); AllAccountsFirms.Remove(_CurrentAccount); _CurrentAccount = AllAccounts.Last(); }