public ActionResult Depositmore(Deposits deposit) { DataBase db = new DataBase(Settings.Default.ConStr); db.Deposit(deposit); return(Redirect("/")); }
public void applyDeposit(HttpRequestMessage request) { string ss = request.Content.ReadAsStringAsync().Result; Deposits ds = JsonConvert.DeserializeObject <Deposits>(ss); userservice.applyDeposit(ds); }
public IActionResult MakeDeposit(MondeyViewModel model) { if (ModelState.IsValid) { Deposits newDeposit = new Deposits { amount = double.Parse(model.amount, System.Globalization.CultureInfo.InvariantCulture), created_at = DateTime.Now, updated_at = DateTime.Now }; Accounts currentAccount = _context.Accounts.SingleOrDefault(account => account.id == (int)HttpContext.Session.GetInt32("CurrentAccount")); currentAccount.Balance += newDeposit.amount; currentAccount.Deposits.Add(newDeposit); Users currentUser = _context.Users.SingleOrDefault(user => user.id == (int)HttpContext.Session.GetInt32("CurrUserId")); currentUser.Deposits.Add(newDeposit); _context.SaveChanges(); return(RedirectToAction("goToDepositPage")); } List <string> errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .Select(z => z[0].ErrorMessage.ToString()) .ToList(); TempData["error_list"] = errors; return(RedirectToAction("goToDepositPage")); }
public void FillTestData(int n) { for (int i = 0; i < n; ++i) { var noImage = new Bitmap(Path.GetFullPath("image.png")); var rnd = new Random(); var dep = new List <Product>(); for (int j = 0; j < 3; ++j) { var weight = rnd.Next(1000, 5000); Product A = new Product() { Name = $"Product{j}", Price = (i + 1) * 10, Type = (j % 2 == 0) ? "золото" : "серебро", Weight = weight, Sample = 999, Image = noImage }; Products.Add(A); dep.Add(A); } Client B = new Client() { Rank = (i % 2 == 0) ? -6 : 7, Name = $"Client{i}", Password = "******", Age = rnd.Next(18, 60), Email = $"Client{i}@gmail.com" }; Clients.Add(B); Deposits.Add(new Deposit(dep, B, DateTime.Now + TimeSpan.FromDays(i), true)); Deposits[i].Name = $"Deposit{i}"; } }
private void btnSave_Click(object sender, EventArgs e) { if (txtName.Text.Trim() != string.Empty || txtAmount.Text.Trim() != string.Empty) { Deposits deposit = new Deposits() { Id = expenseService.GetLastIdDeposits() + 1, Name = txtName.Text.Trim(), Amount = txtAmount.Text.Trim(), DepositedOn = DateTime.Now.ToShortDateString() }; bool result = expenseService.AddNewDeposits(deposit); //save it to database if (result) { dgvResult.DataSource = expenseService.GetDeposits(); dgvResult.Refresh(); txtName.Text = txtAmount.Text = ""; } } else { MessageBox.Show("Please check the Name and Amount", "Alert"); } }
public void UpdateTables(Accounts model, int type, int change) { Transactions updateTransactions = new Transactions(); updateTransactions.TransactionType = type; updateTransactions.AccountID = model.AccountID; db.Transactions.Add(updateTransactions); if (type == 1) { Deposits updateDeposits = new Deposits(); updateDeposits.TransactionID = updateTransactions.TransactionID; updateDeposits.Amount = change; db.Deposits.Add(updateDeposits); } else { Withdrawls updateWithdrawals = new Withdrawls(); updateWithdrawals.TransactionID = updateTransactions.TransactionID; updateWithdrawals.Amount = change; db.Withdrawls.Add(updateWithdrawals); } db.SaveChanges(); }
public ActionResult Deposit(Deposits model) { TransactionService svc = new TransactionService(); var account = svc.MakeDeposit((Accounts)Session["CurrentUser"], (int)model.Amount); return(RedirectToAction("Details", account)); }
public bool AddNewDeposits(Deposits deposit) { using (OleDbCommand oleDbCommand = new OleDbCommand()) { // Set the command object properties oleDbCommand.Connection = new OleDbConnection(this.ExpenseConnection); oleDbCommand.CommandType = CommandType.Text; oleDbCommand.CommandText = "Insert Into" + " [DepositDB$] (Id, Name, Amount, Deposited_On)" + " Values (@id, @name, @amount, @depositon)";// Scripts.sqlInsertExpense; // Add the input parameters to the parameter collection oleDbCommand.Parameters.AddWithValue("@id", deposit.Id); oleDbCommand.Parameters.AddWithValue("@name", deposit.Name); oleDbCommand.Parameters.AddWithValue("@amount", deposit.Amount); oleDbCommand.Parameters.AddWithValue("@depositon", deposit.DepositedOn); // Open the connection, execute the query and close the connection oleDbCommand.Connection.Open(); var rowsAffected = oleDbCommand.ExecuteNonQuery(); oleDbCommand.Connection.Close(); return(rowsAffected > 0); } }
public ActionResult Deposit(Deposits deposit) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); mgr.AddDeposit(deposit); TempData["message"] = "Deposit successfully recorded"; return(RedirectToAction("Index")); }
private void LoadTables() { Sales.Load(); Deposits.Load(); Referents.Load(); Categories.Load(); Articles.Load(); Manufacturers.Load(); }
private float _totalDeposits() { float total = 0.0f; if (Deposits != null) { Deposits.ToList().ForEach(x => total += x.Value); } return(total); }
public void FillTestData(int n) { Random rnd = new Random(); // Clients for (int i = 1; i <= n; ++i) { Clients.Add(new Client { Name = $"Client{i}", Password = "******", Age = rnd.Next(18, 60), Email = $"Client{i}@gmail.com" }); } // Deposits for (int i = 0; i < n - 5; ++i) { var dep = new List <Product>(); for (int j = 0; j < 5; ++j) { var id = rnd.Next(1, 1000); var weight = rnd.Next(1000, 5000); Products.Add(new Product() { Id = id, Name = $"Product{j}", Price = i * 10, Unit = "g", Type = (j % 2 == 0) ? "gold" : "silver", Weight = weight, Sample = 999 }); dep.Add(new Product() { Id = id, Name = $"Product{j}", Price = i * 10, Unit = "g", Type = (j % 2 == 0) ? "gold" : "silver", Weight = weight, Sample = 999 }); } Deposits.Add(new Deposit(dep, Clients[i], DateTime.Now + TimeSpan.FromDays(i))); } // ForSale foreach (var dep in Deposits) { if (dep.DateTime.Day % 2 == 0) { ForSales.Add(new ForSale(dep)); } } }
public async Task <PagedResult <DepositDetails> > BrowseAsync(GetDeposits query) { if (query is null) { return(PagedResult <DepositDetails> .Empty); } var deposits = Deposits.AsQueryable(); if (query.OnlyPending || query.OnlyUnconfirmed || query.OnlyNotRejected || query.EligibleToRefund) { //MongoDB unsupported predicate: (d.Confirmations < d.RequiredConfirmations) - maybe due to uint type? var allDeposits = await deposits.ToListAsync(); var filteredDeposits = allDeposits.AsEnumerable(); if (query.OnlyPending) { filteredDeposits = filteredDeposits.Where(d => !d.Rejected && !d.RefundClaimed && (d.Transaction?.State == TransactionState.Pending || d.ClaimedRefundTransaction?.State == TransactionState.Pending)); } if (query.OnlyUnconfirmed) { filteredDeposits = filteredDeposits.Where(d => d.ConfirmationTimestamp == 0 || d.Confirmations < d.RequiredConfirmations); } if (query.OnlyNotRejected) { filteredDeposits = filteredDeposits.Where(d => !d.Rejected); } if (query.EligibleToRefund) { foreach (var deposit in deposits) { uint consumedUnits = await _depositUnitsCalculator.GetConsumedAsync(deposit); deposit.SetConsumedUnits(consumedUnits); } filteredDeposits = filteredDeposits.Where(d => !d.RefundClaimed && (d.ConsumedUnits < d.Deposit.Units) && (!(d.EarlyRefundTicket is null) || query.CurrentBlockTimestamp >= d.Deposit.ExpiryTime )); } return(filteredDeposits.OrderByDescending(d => d.Timestamp).ToArray().Paginate(query)); } return(await deposits.OrderByDescending(d => d.Timestamp).PaginateAsync(query)); }
public void DateCheck() { for (int i = 0; i < Deposits.Count; ++i) { if (DateTime.Now >= Deposits[i].DateTimeBuyOut) { Warehouse.AddRange(Deposits[i].Products); Deposits[i].Client.Rank--; Deposits.RemoveAt(i); } } IsDirty = true; }
public void ProcessFile(FileStream f, StreamReader sr) { string temp; Iban = sr.ReadLine(); StartTime = DateTime.ParseExact(sr.ReadLine(), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture); EndTime = DateTime.ParseExact(sr.ReadLine(), "yyyy/MM/dd HH:mm:ss", CultureInfo.InvariantCulture); NumberOfDeposits = int.Parse(sr.ReadLine()); for (int i = 0; i < NumberOfDeposits; i++) { temp = sr.ReadLine(); Deposits.Add(new Tuple <int, string>(int.Parse(temp.Split(' ')[0]), temp.Split(' ')[1].Replace(',', '.'))); } }
public ActionResult AddContributor(Contributors contributor, Deposits deposit) { DataBase db = new DataBase(Settings.Default.ConStr); db.AddContributor(contributor); Deposits d = new Deposits { ContributorsId = contributor.Id, Amount = deposit.Amount, Date = contributor.Date }; db.Deposit(d); return(Redirect("/")); }
public async Task <PagedResult <DepositDetails> > BrowseAsync(GetDeposits query) { if (query is null) { return(PagedResult <DepositDetails> .Empty); } var deposits = Deposits.AsQueryable(); if (query.OnlyUnverified) { deposits = deposits.Where(d => d.VerificationTimestamp == 0); } return(await deposits.OrderByDescending(d => d.Timestamp).PaginateAsync(query)); }
public ActionResult New(Contributors contributor, decimal initialDeposit) { var mgr = new SimchaFundManager(Properties.Settings.Default.ConStr); mgr.AddContributor(contributor); var deposit = new Deposits { Amount = initialDeposit, ContributorId = contributor.Id, Date = contributor.Date }; mgr.AddDeposit(deposit); TempData["Message"] = $"New Contributor Created! Id: {contributor.Id}"; return(RedirectToAction("index")); }
private static readonly string conName = "BankDB"; //Имя подключения /// <summary> /// Создает экземпляр класса BankDBContext /// </summary> /// <param name="connection">Строка подключения</param> public BankDbContext(string connection = null) : base(connection == null? conName : connection) { Departaments.Load(); if (Departaments == null || Departaments.Count() == 0) { BaseFill(); } Clients.Load(); Credits.Load(); Deposits.Load(); Logs.Load(); Organisations.Load(); CreditHistories.Load(); }
public void applyDeposit(Deposits ds) { SqlConnection con = new SqlConnection(); try { con.ConnectionString = ConfigurationManager.ConnectionStrings["BankManagmentConn"].ConnectionString; con.Open(); SqlCommand cmd1 = new SqlCommand("insert into deposits(accountno,deposit_amount,duration,approved) values('" + ds.AccountNumber + "','" + ds.DepositAmount + "','" + ds.Duration + "','no')", con); cmd1.ExecuteNonQuery(); } finally { con.Close(); } }
public void applyDeposit(Deposits ds) { MySqlConnection conn = new MySqlConnection("Server=127.0.0.1; Port=3306; Database=mybank; Uid=aeo; Pwd=@300;"); //SqlConnection con = new SqlConnection(); try { //con.ConnectionString = ConfigurationManager.ConnectionStrings["BankManagmentConn"].ConnectionString; conn.Open(); MySqlCommand cmd1 = new MySqlCommand("insert into deposits(accountno,deposit_amount,duration,approved) values('" + ds.AccountNumber + "','" + ds.DepositAmount + "','" + ds.Duration + "','no')", conn); cmd1.ExecuteNonQuery(); } finally { conn.Close(); } }
public IList <Deposits> depositDetails(Int64 accno) { DataSet ds = repo.depositDetails(accno); IList <Deposits> depositlist = new List <Deposits>(); foreach (DataRow row in ds.Tables[0].Rows) { Deposits detail = new Deposits(); detail.AccountNumber = Convert.ToInt64(row["accountno"]); detail.DepositId = Convert.ToInt32(row["deposit_id"]); detail.Approved = Convert.ToString(row["approved"]); detail.DepositTime = Convert.ToDateTime(row["approved_time"]); detail.DepositAmount = Convert.ToInt32(row["deposit_amount"]); detail.Duration = Convert.ToInt32(row["duration"]); depositlist.Add(detail); } return(depositlist); }
public IList <Deposits> GetDeposits() { DataSet ds = repo.GetDeposits(); IList <Deposits> depositsList = new List <Deposits>(); foreach (DataRow row in ds.Tables[0].Rows) { Deposits dep = new Deposits(); dep.DepositId = Convert.ToInt32(row["deposit_id"]); dep.AccountNumber = Convert.ToInt64(row["accountno"]); dep.DepositAmount = Convert.ToInt32(row["deposit_amount"]); dep.Duration = Convert.ToInt32(row["duration"]); dep.DepositTime = row["approved_time"] != DBNull.Value ? (DateTime)row["approved_time"] : (DateTime?)null; dep.Approved = Convert.ToString(row["approved"]); depositsList.Add(dep); } return(depositsList); }
public DepositListDialog(int MID) { InitializeComponent(); InitializeComponent(); data = new Deposits(); data.GetData(MID); if (data.DepositsAddress[0] != 0) { Deposit1.IsEnabled = true; } if (data.DepositsAddress[1] != 0) { Deposit2.IsEnabled = true; } if (data.DepositsAddress[2] != 0) { Deposit3.IsEnabled = true; } }
public bool CreateDeposit(AccountModel account, Nullable <decimal> amount, int transactionId) { var acctService = new AccountService(); using (var context = new Bank_LibraryEntities()) { var newDeposit = new Deposits { Amount = amount, TransactionID = transactionId }; context.Deposits.Add(newDeposit); acctService.DepositToAccount(context, account, amount); return(context.SaveChanges() == 1); } }
private void frmBanking_Load(object sender, EventArgs e) { dgvCustomers.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dgvCustomers.MultiSelect = false; try { withdrawls = new Withdrawls(); deposits = new Deposits(); customers = new Customers(); customers.GetAll(); deposits.GetAll(); withdrawls.GetAll(); Rebind(); } catch (Exception ex) { lblStatus.Text = ex.Message; lblStatus.ForeColor = Color.Red; } }
private void GetDeposits(int index, SqlConnectionStringBuilder connectionStringBuilder, AClient holder, int entity = 0) { var sqlDepositQuery = $@"SELECT * FROM Deposits WHERE HolderId = {index} AND isEntity = {entity}"; using (var connector = new SqlConnector(connectionStringBuilder)) { using (var depositReader = connector.GetData(sqlDepositQuery)) { while (depositReader.Read()) { var deposit = ConvertSqlData.ToDeposit(depositReader, holder); if (deposit != null) { holder.Deposits.Add(deposit); Deposits.Add(deposit); } } } } }
public async Task <PagedResult <DepositDetails> > BrowseAsync(GetDeposits query) { if (query is null) { return(PagedResult <DepositDetails> .Empty); } var deposits = Deposits.AsQueryable(); if (query.OnlyUnconfirmed || query.OnlyNotRejected || query.EligibleToRefund) { //MongoDB unsupported predicate: (d.Confirmations < d.RequiredConfirmations) - maybe due to uint type? var allDeposits = await deposits.ToListAsync(); var filteredDeposits = allDeposits.AsEnumerable(); if (query.OnlyUnconfirmed) { filteredDeposits = filteredDeposits.Where(d => d.ConfirmationTimestamp == 0 || d.Confirmations < d.RequiredConfirmations); } if (query.OnlyNotRejected) { filteredDeposits = filteredDeposits.Where(d => !d.Rejected); } if (query.EligibleToRefund) { filteredDeposits = filteredDeposits.Where(d => !d.RefundClaimed && (!(d.EarlyRefundTicket is null) || query.CurrentBlockTimestamp >= d.Deposit.ExpiryTime )); } return(filteredDeposits.OrderByDescending(d => d.Timestamp).Paginate(query)); } return(await deposits.OrderByDescending(d => d.Timestamp).PaginateAsync(query)); }
public ObservableCollection <Deposit> CreateDeposits(int clientId) { OpenConnection(); SqlCmd.CommandText = @"SELECT * FROM deposits WHERE client_id = @clientId and isconfirm = 1"; SqlCmd.Parameters.Add(new SQLiteParameter("@clientId") { Value = clientId }); SqlCmd.ExecuteNonQuery(); SQLiteDataReader reader; reader = SqlCmd.ExecuteReader(); while (reader.Read()) { Deposit deposit = new Deposit(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetString(3), reader.GetString(4), reader.GetInt32(5), CheckConfirm(reader.GetInt32(6)), Convert.ToDateTime(reader.GetString(7), CultureInfo.CurrentCulture)); Deposits.Add(deposit); } CloseConnection(); Service.CountServiceClient client = new Service.CountServiceClient("NetTcpBinding_ICountService"); foreach (Deposit deposit in Deposits) { double pay = client.CalcDeposit(deposit.Duration, deposit.Number, deposit.DateDeposit); if (pay != 0) { Card card = new Card(1, deposit.CardNumber, "dffdsfwef", 2355, 544, "03.11.2023", "Visa Classic", 0, 2, true); card = card.GetCurrentCard(card); int newCardMoney = card.Money + (int)pay; card.UpdateCardMoney(card, newCardMoney); } } client.Close(); return(Deposits); //Credits.Remove(credit); //DeleteSelectedItem(credit.Id, "credit"); }
public void Standard(DepositOutput output) { Deposits.Add(output); }