示例#1
0
        //[Authorize(Roles = "Admin,Client")]
        public ActionResult Payment(string InvoiceNumber, float NetAmount, short PaymentModeId, string BankName, string ReferenceNumber, string PayerRemarks, string PaymentDate)
        {
            string Result = string.Empty;

            try
            {
                var      userDetail        = generic.GetUserDetail(User.Identity.GetUserId());
                var      userPrimaryDetail = cmsMgr.GetSubscriberWiseClientList(userDetail.SubscriberId).Where(s => s.CorporateId == userDetail.UserId).FirstOrDefault();
                string   strReturnUrl      = Global.WebsiteUrl() + "CMS/Invoice/PaymentConfirmation";
                DateTime?Pdate             = DateTime.Now;
                if (!string.IsNullOrEmpty(PaymentDate))
                {
                    Pdate = DateTime.ParseExact(PaymentDate, "dd-MM-yyyy", CultureInfo.InvariantCulture);
                }

                if (db.PaymentModeMaster.Find(PaymentModeId).PaymentMode.ToUpper() == "ONLINE")
                {
                    Result = generic.PaymentRequest(InvoiceNumber, userDetail.Name, Convert.ToString(NetAmount), userPrimaryDetail.Email, userPrimaryDetail.PhoneNumber, PayerRemarks, strReturnUrl);

                    if (!Result.ToUpper().StartsWith("ERROR"))
                    {
                        bool result = admin.UpdateInvoicePayment(InvoiceNumber, BankName, ReferenceNumber, Pdate, PayerRemarks, PaymentModeId);
                        if (result)
                        {
                            return(Redirect(Url.Content(Global.WebsiteUrl() + "Request.aspx?Id=" + Result)));
                        }
                    }

                    return(RedirectToAction("Payment", "Invoice", new { Area = "CMS", Id = InvoiceNumber, res = Result }));
                }

                bool results = admin.UpdateInvoicePayment(InvoiceNumber, BankName, ReferenceNumber, Pdate, PayerRemarks, PaymentModeId);
                if (results)
                {
                    return(RedirectToAction("PaymentConfirmation", "Invoice", new { Area = "CMS", PMId = PaymentModeId, Id = InvoiceNumber }));
                }
            }
            catch (Exception ex)
            {
                Result = ex.ToString();
            }
            return(RedirectToAction("Payment", "Invoice", new { Area = "CMS", Id = InvoiceNumber, res = Result }));
        }