public ViewResult Transfer(Guid bankAccountId) { FindBankAccountResponse response = _bankService.GetBankAccountBy(bankAccountId); BankAccountView accView = response.BankAccount; return(View(accView)); }
private void DisplaySelectedAccount() { if (ddlBankAccounts.SelectedValue.ToString() != "") { ApplicationBankAccountService service = new ApplicationBankAccountService(); FindBankAccountResponse response = service.GetBankAccountBy(new Guid(ddlBankAccounts.SelectedValue.ToString())); BankAccountView accView = response.BankAccount; this.lblAccountNo.Text = accView.Balance.ToString(); this.lblBalance.Text = accView.Balance.ToString(); this.lblCustomerRef.Text = accView.CustomerRef; rptTransactions.DataSource = accView.Transactions; rptTransactions.DataBind(); FindAllBankAccountResponse allAccountsResponse = service.GetAllBankAccounts(); ddlBankAccountsToTransferTo.Items.Clear(); foreach (BankAccountView acc in allAccountsResponse.BankAccountView) { if (acc.AccountNo.ToString() != ddlBankAccounts.SelectedValue.ToString()) { ddlBankAccountsToTransferTo.Items.Add(new ListItem(acc.CustomerRef, acc.AccountNo.ToString())); } } } }
public void LoadItem(int id) { DataAccess da = new DataAccess(); Item = da.BankAccountView(id); edtAccountNumber.Text = Item.BankAccount; edtBank.SelectedValue = Item.BankID; edtDescription.Text = Item.Description; }
// загрузка данных выбранного расчетного счета, вызывается из обработчика SelectionChanged комбобокса Р/С private void LoadBankAccountData() { BankAccountView a = edtBankAccount.SelectedItem as BankAccountView; if (a != null) { edtAccountBankMFO.Text = a.BankMFO; edtAccountBankName.Text = a.BankName; } }
public FindBankAccountResponse GetBankAccountBy(Guid Id) { FindBankAccountResponse bankAccountResponse = new FindBankAccountResponse(); BankAccount acc = _bankRepository.FindBy(Id); BankAccountView bankAccountView = _mapper.Map <BankAccountView>(acc); foreach (Transaction tran in acc.GetTransactions()) { bankAccountView.Transaction.Add(_mapper.Map <TransactionView>(tran)); } bankAccountResponse.BankAccount = bankAccountView; return(bankAccountResponse); }
public IActionResult Account(int id) { if (HttpContext.Session.GetInt32("InSession") != id) { return(RedirectToAction("Index")); } User user = dbContext.Users.FirstOrDefault(u => u.UserId == id); List <Transaction> transactions = dbContext.Transactions.Include(t => t.User).OrderByDescending(t => t.CreatedAt).ToList(); BankAccountView viewModel = new BankAccountView(); viewModel.AllTransactions = transactions; viewModel.CurrentUser = user; return(View("Account", viewModel)); }
public IActionResult Edit(BankAccountView vm) { if (ModelState.IsValid) { BankAccountCreateRequest createAccountRequest = new BankAccountCreateRequest(); createAccountRequest.CustomerName = vm.CustomerRef; _bankService.CreateBankAccount(createAccountRequest); return(RedirectToAction("Index")); } else { //there is something wrong with the data values return(View(vm)); } }
public FindBankAccountResponse GetBankAccountBy(Guid Id) { FindBankAccountResponse bankAccountResponse = new FindBankAccountResponse(); BankAccount acc = _bankRepository.FindBy(Id); BankAccountView bankAccountView = ViewMapper.CreateBankAccountViewFrom(acc); foreach (Transaction tran in acc.Transactions) { bankAccountView.Transactions.Add(ViewMapper.CreateTransactionViewFrom(tran)); } bankAccountResponse.BankAccount = bankAccountView; return(bankAccountResponse); }
public async void View_Bank() { if (selectedBank.BANK_ID != null && selectedBank.BANK_ID != 0) { App.Current.Properties["Action"] = "Edit"; HttpClient client = new HttpClient(); client.BaseAddress = new Uri(GlobalData.gblApiAdress); client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/json")); client.Timeout = new TimeSpan(500000000000); HttpResponseMessage response = client.GetAsync("api/BankAPI/BankEdit?id=" + selectedBank.BANK_ID + "").Result; if (response.IsSuccessStatusCode) { data = JsonConvert.DeserializeObject <BankModel[]>(await response.Content.ReadAsStringAsync()); if (data.Length > 0) { for (int i = 0; i < data.Length; i++) { selectedBank.ADDRESS_1 = data[i].ADDRESS_1; selectedBank.ADDRESS_2 = data[i].ADDRESS_2; selectedBank.BANK_CODE = data[i].BANK_CODE; selectedBank.BANK_ID = data[i].BANK_ID; selectedBank.BANK_NAME = data[i].BANK_NAME; selectedBank.CITY = data[i].CITY; selectedBank.COMPANY_ID = data[i].COMPANY_ID; selectedBank.COUNTRY = data[i].COUNTRY; selectedBank.EMAIL = data[i].EMAIL; selectedBank.FAX_NUMBER = data[i].FAX_NUMBER; selectedBank.IFSC_CODE = data[i].IFSC_CODE; selectedBank.IS_DELETED = data[i].IS_DELETED; selectedBank.MOBILE_NUMBER = data[i].MOBILE_NUMBER; selectedBank.PHONE_NUMBER = data[i].PHONE_NUMBER; selectedBank.PIN_CODE = data[i].PIN_CODE; selectedBank.STATE = data[i].STATE; selectedBank.WEBSITE = data[i].WEBSITE; } App.Current.Properties["BankEdit"] = selectedBank; BankAccountView IA = new BankAccountView(); IA.Show(); } } } else { MessageBox.Show("Select Bank first", "Bank Selection", MessageBoxButton.OK, MessageBoxImage.Error); return; } }
public IActionResult ChangingBalance(BankAccountView newTransaction, int UserId) { User user = dbContext.Users.FirstOrDefault(u => u.UserId == UserId); List <Transaction> transactions = dbContext.Transactions.Include(t => t.User).OrderByDescending(t => t.CreatedAt).ToList(); BankAccountView viewModel = new BankAccountView(); viewModel.CurrentUser = user; viewModel.AllTransactions = transactions; if (ModelState.IsValid) { if (user.Balance + newTransaction.UserTransaction.Amount < 0) { ModelState.AddModelError("UserTransaction.Amount", "Insufficient Funds"); return(View("Account", viewModel)); } user.Balance += newTransaction.UserTransaction.Amount; user.UpdatedAt = DateTime.Now; dbContext.Add(newTransaction.UserTransaction); dbContext.SaveChanges(); return(RedirectToAction("Account", new{ id = UserId })); } return(View("Account", viewModel)); }
public FindBankAccountResponse GetBankAccountBy(Guid id) { // new FindBankAccountResponse object FindBankAccountResponse bankAccountResponse = new FindBankAccountResponse(); // return account from repository BankAccount acc = _bankRepository.Find(id); // that account convert into BankAccountView BankAccountView bankAccountView = ViewMapper.CreateBankAccountViewFrom(acc); // iterate through account GetTransactions() foreach (Transaction tran in acc.GetTransactions()) { // add transactions to BankAccountView bankAccountView.Transactions.Add( ViewMapper.CreateTransactionViewFrom(tran)); } // bankAccoiuntResponse.BankAccount = bankAccountView bankAccountResponse.BankAccount = bankAccountView; return(bankAccountResponse); }
// заполнение Item из полей, сохранение в БД ================= private invoice FormToItem() { da = new DataAccess(); if (Item == null) { Item = new invoice(); } Item.InvoiceDate = edtDate.SelectedDate.HasValue ? edtDate.SelectedDate.Value : DateTime.Now; int AccountID = 0; if (edtAccount.SelectedValue != null) { AccountID = (int)edtAccount.SelectedValue; } Item.AccountUNN = edtAccountUNN.Text; Item.AccountBankName = edtAccountBankName.Text; BankAccountView bav = edtBankAccount.SelectedItem as BankAccountView; if (bav != null) { Item.BankAccountID = bav.id; } Item.AccountAddress = edtAccountAddress.Text; Item.AccountBankMFO = edtAccountBankMFO.Text; Item.InvoiceSum = (double)InvoiceSum; int INum = 0; //if(Item.InvoiceNumber.HasValue) //INum = Item.InvoiceNumber.Value; if (Int32.TryParse(edtNumber.Text, out INum)) { Item.InvoiceNumber = INum; } da.InvoiceEdit(Item, AccountID); return(Item); }
private void Window_Activated(object sender, EventArgs e) { if (Outgo == null) { return; } try { ReportDocument reportDocument = new ReportDocument(); StreamReader reader = new StreamReader(new FileStream(@"Templates\InvoiceReport.xaml", FileMode.Open, FileAccess.Read)); reportDocument.XamlData = reader.ReadToEnd(); reportDocument.XamlImagePath = System.IO.Path.Combine(Environment.CurrentDirectory, @"Templates\"); reader.Close(); ReportData data = new ReportData(); decimal asum = 0; DataAccess da = new DataAccess(); string BCC = da.getBasicCurrencyCode(); //Income.currencyReference.Load(); //string CCC = Income.currency.code; // Таблица ТОВАРЫ В НАКЛАДНОЙ DataTable dt = new DataTable("mtable"); // описываем столбцы таблицы dt.Columns.Add("Num", typeof(int)); dt.Columns.Add("SpareName", typeof(string)); dt.Columns.Add("UnitName", typeof(string)); dt.Columns.Add("Q", typeof(int)); dt.Columns.Add("P", typeof(double)); dt.Columns.Add("VR", typeof(string)); dt.Columns.Add("TS", typeof(double)); // забиваем таблицу данными List <SpareInInvoiceView> LIST2 = da.GetSparesByInvoiceID(InvoiceId); try { string CompanyName = da.getProfileCurrent().CompanyName; for (int i = 0; i < LIST2.Count; i++) { asum += LIST2[i].TotalWithVat.Value; dt.Rows.Add(new object[] { i + 1, (LIST2[i].SpareName + " (" + LIST2[i].SpareCodeShatem + ")"), "шт.", LIST2[i].quantity, LIST2[i].price.Value, LIST2[i].VatRateName, LIST2[i].TotalWithVat }); } } catch (Exception exc) { Marvin.Instance.Log(exc.Message); throw exc; } string str_ts = RSDN.RusCurrency.Str(asum, "BYR"); //string str_vs = RSDN.RusCurrency.Str(vs, "BYR"); // set constant document values //string strDate = Outgo.created_on.Value.GetDateTimeFormats('d')[3]; string strDate = Outgo.InvoiceDate.Value.Day.ToString(); string mnth = ""; switch (Outgo.InvoiceDate.Value.Month) { case 1: mnth = "января"; break; case 2: mnth = "февраля"; break; case 3: mnth = "марта"; break; case 4: mnth = "апреля"; break; case 5: mnth = "мая"; break; case 6: mnth = "июня"; break; case 7: mnth = "июля"; break; case 8: mnth = "августа"; break; case 9: mnth = "сентября"; break; case 10: mnth = "октября"; break; case 11: mnth = "ноября"; break; case 12: mnth = "декабря"; break; } strDate += " " + mnth + " " + Outgo.InvoiceDate.Value.Year + " г."; data.ReportDocumentValues.Add("ReportDate", strDate); // print date is now data.ReportDocumentValues.Add("TTS", asum); settings_profile profile = da.getProfileCurrent(); ProfileBankAccountView ProfileBankAccount = da.getProfileBankAccountCurrent(); string w1 = "не указано"; string w2 = "не указано"; string w3 = "не указано"; if (ProfileBankAccount != null) { w1 = ProfileBankAccount.BankAccount;; w2 = ProfileBankAccount.BankName; w3 = ProfileBankAccount.BankMFO; } //string p1 = profile.CompanyName + ", " + profile.AddressJur + ", УНП " + Regex.Replace(profile.UNN, " +", " "); //p1 = Regex.Replace(p1, " +", " "); // ПРАВИЛЬНЫЕ ПАРАМЕТРЫ invoice inv = Outgo; string q1 = profile.CompanyName + ", " + profile.AddressJur + ", УНН:" + profile.UNN; data.ReportDocumentValues.Add("p1", q1); string q2 = w1; data.ReportDocumentValues.Add("p2", q2); string q3 = w2 + ", МФО:" + w3; data.ReportDocumentValues.Add("p3", q3); string q4 = profile.CompanyName; data.ReportDocumentValues.Add("p4", q4); string q5 = profile.LoadPoint; data.ReportDocumentValues.Add("p5", q5); string q6 = inv.AccountName + ", " + inv.AccountAddress + ", УНН:" + inv.AccountUNN; data.ReportDocumentValues.Add("p6", q6); string BankAccount = "р/с не указан"; if (inv.BankAccountID != null) { BankAccountView ba = da.BankAccountView(inv.BankAccountID.Value); BankAccount = ba.BankAccount; } string q7 = BankAccount + ", " + inv.AccountBankName + ", " + inv.AccountBankMFO; data.ReportDocumentValues.Add("p7", q7); string q8 = inv.AccountName + ", " + inv.AccountAddress; data.ReportDocumentValues.Add("p8", q8); string q9 = inv.AccountAddress; data.ReportDocumentValues.Add("p9", q9); string q0 = str_ts; data.ReportDocumentValues.Add("p0", q0); string q10 = inv.InvoiceNumber.ToString(); data.ReportDocumentValues.Add("p10", q10); string q11 = strDate; data.ReportDocumentValues.Add("p11", q11); // СТАРЫЕ ПАРАМЕТРЫ // Поставщик и его адрес: /* * data.ReportDocumentValues.Add("param1", p1); * * // Номер инвойса * string param2 = Outgo.id.ToString(); * data.ReportDocumentValues.Add("param2", param2); * * // Номер счета: * string param3 = Outgo.AccountBankNum; * data.ReportDocumentValues.Add("param3", param3); * * // дата * string param4 = strDate; * data.ReportDocumentValues.Add("param4", param4); * * // Банк: * string param5 = "########"; * data.ReportDocumentValues.Add("param5", param5); * * // Грузоотправитель: * string param6 = profile.CompanyName; * data.ReportDocumentValues.Add("param6", param6); * * // Ст. отправления: * string param7 = profile.AddressFact; * data.ReportDocumentValues.Add("param7", param7); * * // Плательщик и его адрес: * string param8 = Outgo.AccountName; * data.ReportDocumentValues.Add("param8", param8); * * // Номер счета и банк: * string param9 = Outgo.AccountBankNum + ", " + Outgo.AccountBankName; * data.ReportDocumentValues.Add("param9", param9); * * // Грузополучатель: * string param10 = Outgo.AccountName; * data.ReportDocumentValues.Add("param10", param10); * * // Ст. назначения, число мест, вес: * string param11 = "############"; * data.ReportDocumentValues.Add("param11", param11); */ data.DataTables.Add(dt); DateTime dateTimeStart = DateTime.Now; // start time measure here XpsDocument xps = reportDocument.CreateXpsDocument(data); documentViewer.Document = xps.GetFixedDocumentSequence(); } catch (Exception ex) { Marvin.Instance.Log(ex.Message); // show exception MessageBox.Show(ex.Message + "\r\n\r\n" + ex.GetType() + "\r\n" + ex.StackTrace, ex.GetType().ToString(), MessageBoxButton.OK, MessageBoxImage.Stop); } }