public ActionResult AddBatchCards(ReceiveAndShipCardModel WebPageData) { String ErrorCode = ""; String BadCard = ""; String AgentUserName = (String)Session["AgentUserName"]; if (AgentUserName == null) { AgentUserName = User.Identity.Name; } if (AgentUserName.Length == 0) { AgentUserName = User.Identity.Name; } try { if (!VerifyNotDuplicateCard(WebPageData.BatchCards, out BadCard)) { ModelState.AddModelError("BatchCards", "Card " + BadCard + " is a duplicate"); } if (ModelState.IsValid) { // Attempt to add the card String CardBatch = WebPageData.BatchCards; String MultiStoreCode = WebPageData.MultiStoreCode; if (WebPageData.BatchCards != null) { ErrorCode = CardServiceInstance.AddAndShipBatch(WebPageData.MerchantName, CardBatch); } if (ErrorCode == "APP ") { ModelState.AddModelError("", "Card(s) Received into Inventory"); } else { ModelState.AddModelError("", "Failed to add the cards: " + Utility.ConvertErrorCodes(ErrorCode)); } } } catch (Exception Ex) { ModelState.AddModelError("", Common.StandardExceptionErrorMessage(Ex)); } // rebuild the merchant list WebPageData.MerchantList = MerchantServiceInstance.GetMerchantsForSelect( AgentUserName, Roles.IsUserInRole(AgentUserName, "Agent")); return(View(WebPageData)); }
public ActionResult AddBatchCards() { String AgentUserName = (String)Session["AgentUserName"]; if (AgentUserName == null) { AgentUserName = User.Identity.Name; } if (AgentUserName.Length == 0) { AgentUserName = User.Identity.Name; } ReceiveAndShipCardModel ToShow = new ReceiveAndShipCardModel(); ToShow.MerchantList = MerchantServiceInstance.GetMerchantsForSelect( AgentUserName, Roles.IsUserInRole(AgentUserName, "Agent")); return(View(ToShow)); }