public ActionResult ConfirmSSIS(SSISPaymentModel paymentInfo, FormCollection collcetion) { if (paymentInfo.CardAccountID == 0) { return(RedirectToAction("Index")); } if (paymentInfo.ToOwnPayments) { OwnPaymentsModule.AddSSISyOwnPayment(paymentInfo, rep, WebSecurity.CurrentUserId); } SSISTransaction t = new SSISTransaction(); t.Amount = paymentInfo.Amount; t.CardAccountID = paymentInfo.CardAccountID; t.CustomerID = WebSecurity.CurrentUserId; t.Date = Time.GetTime(); t.Number = paymentInfo.Number; t.SSISPaymentID = paymentInfo.SSISPaymentID; t.Type = PaymentType.SSIS; bool success = service.CreateSSISTransaction(t); if (success) { return(View("Message", (object)"Платеж успешно завершен")); } else { return(View("Message", (object)"Что то пошло не так. Попробуйте еще раз")); } }
public void RemoveSSISTransaction(SSISTransaction SSISTransaction) { using (Repositories rep = new Repositories()) { rep.SSISTransactions.Remove(SSISTransaction); rep.SaveChanges(); } }
public void AddSSISTransaction(SSISTransaction SSISTransaction) { using (Repositories rep = new Repositories()) { rep.SSISTransactions.Add(SSISTransaction); rep.SaveChanges(); } }
public bool CreateSSISTransaction(SSISTransaction SSISTransaction) { try { using (Repositories rep = new Repositories()) { CardAccount card = rep.CardAccounts.GetSingle(SSISTransaction.CardAccountID); BankAccount acc = rep.BankAccounts.GetSingle(card.BankAccountID); BankAccount bank = rep.BankAccounts.GetAll(a => a.AcountNumber == "1111111111111111").FirstOrDefault(); if (acc.CurrencyID != 1) { return(false); } if (SSISTransaction.Amount > acc.Balance) { return(false); } if (card.IsLocked) { return(false); } if (card.ExpiredDate < Time.GetTime()) { return(false); } SSISTransaction.Date = Time.GetTime(); acc.Balance -= SSISTransaction.Amount; bank.Balance += SSISTransaction.Amount; rep.BankAccounts.Update(acc); rep.BankAccounts.Update(bank); rep.SSISTransactions.Add(SSISTransaction); rep.SaveChanges(); } } catch (Exception ex) { return(false); } return(true); }