Example #1
0
        public ActionResult HistoryList(FormCollection collection)
        {
            var id   = collection["id"];
            var type = collection["type"];

            if (id == null || type == null)
            {
                return(RedirectToAction("Index"));
            }

            RouteValueDictionary RouteValues = new RouteValueDictionary();

            RouteValues.Add("item.CardAccount.CardAccountID", collection["item.CardAccount.CardAccountID"]);
            RouteValues.Add("datepicker-from", collection["datepicker-from"]);
            RouteValues.Add("datepicker-to", collection["datepicker-to"]);
            RouteValues.Add("arbitrary_payments", collection["arbitrary_payments"]);
            RouteValues.Add("ssisp_payments", collection["ssisp_payments"]);
            RouteValues.Add("mobile_payments", collection["mobile_payments"]);
            RouteValues.Add("transfer_payments", collection["transfer_payments"]);

            if (type == PaymentType.Mobile.ToString())
            {
                var mobileTransaction = service.GetMobileTransactionById(Int32.Parse(id));
                var cardAccout        = service.GetCardAccountById(mobileTransaction.CardAccountID);
                var bankAccout        = service.GetBankAccountById(cardAccout.BankAccountID);
                var currency          = service.GetCurrencyById(bankAccout.CurrencyID);

                HistoryPaymentDetails info = new HistoryPaymentDetails();
                info.BackRouteValues = RouteValues;
                info.Dictionary      = new Dictionary <string, string>();
                info.Dictionary.Add("Дата", mobileTransaction.Date.ToString());
                info.Dictionary.Add("Номер карты", CardAccountModule.ConvertCardNumberString(cardAccout.CardNumber));
                info.Dictionary.Add("Оператор", mobileTransaction.MobileProvider);
                info.Dictionary.Add("Номер телефона", mobileTransaction.Phone);
                info.Dictionary.Add("Сумма", mobileTransaction.Amount + " " + currency.ShortName);

                return(View("Details", info));
            }

            if (type == PaymentType.Arbitrary.ToString())
            {
                var transaction = service.GetArbitraryTransactionById(Int32.Parse(id));
                var cardAccout  = service.GetCardAccountById(transaction.CardAccountID);
                var bankAccout  = service.GetBankAccountById(cardAccout.BankAccountID);
                var currency    = service.GetCurrencyById(bankAccout.CurrencyID);

                HistoryPaymentDetails info = new HistoryPaymentDetails();
                info.BackRouteValues = RouteValues;
                info.Dictionary      = new Dictionary <string, string>();
                info.Dictionary.Add("Дата", transaction.Date.ToString());
                info.Dictionary.Add("Номер карты", CardAccountModule.ConvertCardNumberString(cardAccout.CardNumber));
                info.Dictionary.Add("УНП", transaction.UNP);
                info.Dictionary.Add("Номер счета получателя", transaction.RecipientAccount);
                info.Dictionary.Add("Получатель", transaction.Recipient);
                info.Dictionary.Add("Цель", transaction.Target);
                info.Dictionary.Add("Сумма", transaction.Amount + " " + currency.ShortName);

                return(View("Details", info));
            }

            if (type == PaymentType.Transfer.ToString())
            {
                var transaction = service.GetTransferTransactionById(Int32.Parse(id));
                var cardAccout  = service.GetCardAccountById(transaction.CardAccountID);
                var bankAccout  = service.GetBankAccountById(cardAccout.BankAccountID);
                var currency    = service.GetCurrencyById(bankAccout.CurrencyID);

                HistoryPaymentDetails info = new HistoryPaymentDetails();
                info.BackRouteValues = RouteValues;
                info.Dictionary      = new Dictionary <string, string>();
                info.Dictionary.Add("Дата", transaction.Date.ToString());
                info.Dictionary.Add("Номер карты", CardAccountModule.ConvertCardNumberString(cardAccout.CardNumber));
                string targetNumber = service.GetCardAccountById(transaction.TargetCardAccountID).CardNumber;
                info.Dictionary.Add("Номер карты получателя", CardAccountModule.ConvertCardNumberString(targetNumber));
                info.Dictionary.Add("Сумма", transaction.Amount + " " + currency.ShortName);

                return(View("Details", info));
            }

            if (type == PaymentType.SSIS.ToString())
            {
                var transaction = service.GetSSISTransactionById(Int32.Parse(id));
                var cardAccout  = service.GetCardAccountById(transaction.CardAccountID);
                var bankAccout  = service.GetBankAccountById(cardAccout.BankAccountID);
                var currency    = service.GetCurrencyById(bankAccout.CurrencyID);
                var payment     = rep.SSISPayments.GetSingle(transaction.SSISPaymentID);

                HistoryPaymentDetails info = new HistoryPaymentDetails();
                info.BackRouteValues = RouteValues;
                info.Dictionary      = new Dictionary <string, string>();
                info.Dictionary.Add("Дата", transaction.Date.ToString());
                info.Dictionary.Add("Номер карты", CardAccountModule.ConvertCardNumberString(cardAccout.CardNumber));
                info.Dictionary.Add("Имя ЕРИП платежа", payment.Name);
                info.Dictionary.Add(payment.NumberLabel, transaction.Number);
                info.Dictionary.Add("Сумма", transaction.Amount + " " + currency.ShortName);

                return(View("Details", info));
            }

            return(View("Index"));
        }