private void apply_Click(object sender, System.Windows.RoutedEventArgs e) { if (formValidator() == false) { return; } else { filename = "umowa_" + DateTime.Now.ToString("ddMMyyyy") + "_" + DateTime.Now.ToString("hhmmss") + ".pdf"; transactions transaction = new transactions(); ts1.budget += Car.price; transaction.balance = ts1.budget; transaction.buyer_address = buyer_address.Text; transaction.buyer_city = buyer_postalcity.Text; transaction.buyer_postalcode = buyer_postalcode.Text; transaction.buyer_idnbr = buyer_idnumber.Text; transaction.car = Car.make + " " + Car.model; transaction.buyer_name = buyer_name.Text; transaction.buyer_surname = buyer_surname.Text; transaction.datetime = (DateTime.Now).ToString(); transaction.price = Car.price; transaction.tr_type = "SPRZEDAZ"; transaction.filename = filename; _db.transactions.Add(transaction); _db.SaveChanges(); generatePDF(); //_db.cars.Remove(Car) Switcher.Switch(new StartView()); } }
public ActionResult Deposit(transactions transaction) { if (ModelState.IsValid) { db.transactions.Add(transaction); int CheckingAccountId = transaction.CheckingAccountId; updatebalance(CheckingAccountId); db.SaveChanges(); return(RedirectToAction("Index", "Home")); } return(View()); }
public async Task <ErrorValue> AcceptBuyTransaction(sell_Offer sellOffer, buy_Offer buyOffer, int?rating) { using (var unitOfWork = _factory.CreateUnitOfWork()) { try { unitOfWork.StartTransaction(); NullProperties(sellOffer, buyOffer); buyOffer = await unitOfWork.BuyOfferRepository.GetById(buyOffer.ID); if (buyOffer.status_id == 3) { return(ErrorValue.TransactionAlreadyFinished); } var soldProduct = await GetSoldProduct(sellOffer, buyOffer, unitOfWork); if (soldProduct == null) { return(ErrorValue.AmountGreaterThanStock); } sellOffer.product = soldProduct; UpdateOffers(sellOffer, buyOffer, unitOfWork); await _ratingUpdater.UpdateRating(buyOffer.buyer_id, unitOfWork, rating); var transaction = new transactions() { buyer_id = buyOffer.buyer_id, seller_id = sellOffer.seller_id, sell_Offer = sellOffer, buy_offer_id = buyOffer.ID, status_id = (int)TransactionState.Finished, transaction_Date = DateTime.Now, Update_Who = sellOffer.seller_id, Update_Date = DateTime.Now, Rating = rating }; unitOfWork.TransactionRepository.Add(transaction); await unitOfWork.Save(); unitOfWork.Commit(); } catch (Exception) { unitOfWork.Rollback(); return(ErrorValue.ServerError); } } return(ErrorValue.NoError); }
public async Task <ErrorValue> AcceptSellTransaction(sell_Offer sellOffer, buy_Offer buyOffer, int?rating) { using (var unitOfWork = _factory.CreateUnitOfWork()) { try { unitOfWork.StartTransaction(); NullProperties(sellOffer, buyOffer); //get actual sellOffer from database sellOffer = await unitOfWork.SellOfferRepository.GetById(sellOffer.ID); if (sellOffer.status_id == 3) { return(ErrorValue.TransactionAlreadyFinished); } buyOffer.product_id = sellOffer.product_id; //set offers to finished UpdateOffers(sellOffer, buyOffer, unitOfWork); //update product stocks var boughtProduct = await GetBoughtProduct(sellOffer, buyOffer, unitOfWork); //change user rating await _ratingUpdater.UpdateRating(sellOffer.seller_id, unitOfWork, rating); var transaction = new transactions() { buyer_id = buyOffer.buyer_id, seller_id = sellOffer.seller_id, buy_Offer = buyOffer, sell_offer_id = sellOffer.ID, status_id = (int)TransactionState.Finished, transaction_Date = DateTime.Now, Update_Who = buyOffer.buyer_id, Update_Date = DateTime.Now, Rating = rating }; unitOfWork.TransactionRepository.Add(transaction); await unitOfWork.Save(); unitOfWork.Commit(); } catch (Exception) { unitOfWork.Rollback(); return(ErrorValue.ServerError); } } return(ErrorValue.NoError); }
public void NewTransaction(int Id_agreement, string Operation_type, int Transaction_amount, DateTime Transaction_date) { PROVIDER_DBDataContext dc = new PROVIDER_DBDataContext(); var Trans = new transactions() { id_agreement = Id_agreement, operation_type = Operation_type, transaction_amount = Transaction_amount, transaction_date = Transaction_date }; dc.transactions.InsertOnSubmit(Trans); // добавление в БД dc.SubmitChanges(); // выполняет соответствующие команды // для внесения изменений базы данных }
public async Task <ErrorValue> Update(transactions entity) { using (var unitOfWork = _factory.CreateUnitOfWork()) { try { unitOfWork.StartTransaction(); unitOfWork.TransactionRepository.Update(entity); await unitOfWork.Save(); unitOfWork.Commit(); } catch (DBConcurrencyException) { unitOfWork.Rollback(); return(ErrorValue.ServerError); } } return(ErrorValue.NoError); }
return(IndexTransactionDetailsMany(transactions, remove));
private void transactionsshow(object sender, RoutedEventArgs e) { var w = new transactions(); userutils.authorizerole(w, new string[] { "superadmin", "admin" }); }
public TransactionWrapper(transactions t) { transaction = t; TransactionDate = t.transaction_Date; }
private void enque(transactions newItem) { tranny.Add(newItem); }
public void request(transactions tranny) { enque(tranny); }