public ActionResult GiftCardSale() { GiftCardSaleModel WebData = new GiftCardSaleModel(); WebData.MerchantID = GetFromMerchantIDCookie(); if (WebData.MerchantID == null) { return(RedirectToAction("MerchantLogOn", "Account")); } WebData.ClerkID = GetFromClerkIDCookie(); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.Now); Response.Cache.SetNoStore(); TempData.Keep("ReturnAddress"); return(View(WebData)); }
public ActionResult GiftCardSale(GiftCardSaleModel WebData) { TempData.Keep("ReturnAddress"); try { if (ModelState.IsValid) { ReceiptInformation RecInfo = TransactionServiceInstance.SellGiftCard( WebData.MerchantID, WebData.ClerkID, 'W', "", WebData.TerminalID, WebData.LocalTime, WebData.CardSwipe, Convert.ToDecimal(WebData.Amount), "", WebData.SalesDescription); if (RecInfo.ResponseCode == 'A') { Receipt Recpt = TransactionServiceInstance.FormatGiftReceipt(RecInfo); // set return address for the receipt page //Session.PushReturnAddress(new ReturnAddress("GiftCardSale")); TempData["Receipt"] = Recpt; return(RedirectToAction("Receipt")); } else { // need locale based lookup of error codes ModelState.AddModelError("", "Error on Sale: " + Utility.ConvertErrorCodes(RecInfo.ErrorCode)); Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form); } } } catch (Exception Ex) { ModelState.AddModelError("", Common.StandardExceptionHandler(Ex, "Sale", Request.Form)); Log.BadData(Request.UserHostAddress, Request.Url.ToString(), Request.Form); } // If we got this far, something failed, redisplay form return(View(WebData)); }