public ActionResult Index(ManagePricing_IndexViewModel managePricing_IndexViewModel) { if (User.Identity.IsAuthenticated) { if (isAdminUser()) { DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(); PricingDataTable = PricingDataSet.Tables[0]; if (PricingDataTable != null) { managePricing_IndexViewModel.PricingDataTable = PricingDataTable; } return(View(managePricing_IndexViewModel)); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult DeletePricingDetails(string ProductPricingId) { if (User.Identity.IsAuthenticated) { if (isAdminUser()) { StringBuilder ErrorMessages = new StringBuilder(); StringBuilder SuccessMessages = new StringBuilder(); try { PricingData pricingData = new PricingData(); if (!string.IsNullOrEmpty(ProductPricingId)) { pricingData.ProductPricingId = ProductPricingId; bool InsertResult = false; InsertResult = PricingDetailsProxy.CUDPricingDetails(pricingData, "Delete"); DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(); PricingDataTable = PricingDataSet.Tables[0]; managePricing_IndexViewModel.PricingDataTable = PricingDataTable; if (InsertResult == false) { ErrorMessages.Append(CUDConstants.DeleteError); } else { SuccessMessages.Append(CUDConstants.DeleteSuccess); } } else { ErrorMessages.Append(CUDConstants.DeleteError); } } catch (Exception e) { ErrorMessages.Append(CUDConstants.DeleteError); } if (!String.IsNullOrEmpty(SuccessMessages.ToString())) { managePricing_IndexViewModel.SuccessMessage = SuccessMessages.ToString(); } if (!String.IsNullOrEmpty(ErrorMessages.ToString())) { managePricing_IndexViewModel.ErrorMessage = ErrorMessages.ToString(); } return(PartialView("PricingDataTable", managePricing_IndexViewModel)); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult Index() { string controllerName = GetControllerNameByItsRole(); if (User.Identity.IsAuthenticated) { if (!isAdminUser()) { return(RedirectToAction("Index", controllerName)); } else { return(RedirectToAction("Index", "ManagePricing")); } } else { managePricing_IndexViewModel = new ManagePricing_IndexViewModel(); DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(); PricingDataTable = PricingDataSet.Tables[0]; PricingDataTable = DataTablePhotoMapping(PricingDataTable); if (PricingDataTable != null) { managePricing_IndexViewModel.PricingDataTable = PricingDataTable; } return(View(managePricing_IndexViewModel)); } }
public ActionResult UpdateCartItem(string ProductPricingId, string CartItemQuantity) { if (isValidUser()) { StringBuilder ErrorMessages = new StringBuilder(); StringBuilder SuccessMessages = new StringBuilder(); try { bool UpdateResult = false; CartData cartData = new CartData(); cartData.ProductPricingId = ProductPricingId; cartData.Quantity = int.Parse(CartItemQuantity); cartData.UserId = User.Identity.GetUserId(); UpdateResult = CartDetailsProxy.CUDCartValue(cartData, "Insert/Update"); if (UpdateResult) { SuccessMessages.Append(CUDConstants.UpdateCartSuccess); } else { ErrorMessages.Append(CUDConstants.UpdateCartError); } managePricing_IndexViewModel = new ManagePricing_IndexViewModel(); DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(); PricingDataTable = PricingDataSet.Tables[0]; if (PricingDataTable != null) { managePricing_IndexViewModel.PricingDataTable = PricingDataTable; } managePricing_IndexViewModel.UserId = User.Identity.GetUserId(); } catch (Exception e) { ErrorMessages.Append(CUDConstants.UpdateCartError); } if (!String.IsNullOrEmpty(SuccessMessages.ToString())) { managePricing_IndexViewModel.SuccessMessage = SuccessMessages.ToString(); } if (!String.IsNullOrEmpty(ErrorMessages.ToString())) { managePricing_IndexViewModel.ErrorMessage = ErrorMessages.ToString(); } return(PartialView("ChampionsPricingGrid", managePricing_IndexViewModel)); } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult UpdatePricingDetails(PricingData pricingData) { if (User.Identity.IsAuthenticated) { if (isAdminUser()) { StringBuilder ErrorMessages = new StringBuilder(); StringBuilder SuccessMessages = new StringBuilder(); try { bool UpdateResult = false; UpdateResult = PricingDetailsProxy.CUDPricingDetails(pricingData, "Update"); DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(); PricingDataTable = PricingDataSet.Tables[0]; PricingDataTable = DataTablePhotoMapping(PricingDataTable); managePricing_IndexViewModel.PricingDataTable = PricingDataTable; if (UpdateResult == false) { ErrorMessages.Append(CUDConstants.UpdateError); } else { SuccessMessages.Append(CUDConstants.UpdateSuccess); } } catch (Exception e) { ErrorMessages.Append(CUDConstants.UpdateError); } if (!String.IsNullOrEmpty(SuccessMessages.ToString())) { managePricing_IndexViewModel.SuccessMessage = SuccessMessages.ToString(); } if (!String.IsNullOrEmpty(ErrorMessages.ToString())) { managePricing_IndexViewModel.ErrorMessage = ErrorMessages.ToString(); } return(PartialView("PricingDataTable", managePricing_IndexViewModel)); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult Index() { if (User.Identity.IsAuthenticated) { if (isValidUser()) { managePricing_IndexViewModel = new ManagePricing_IndexViewModel(); DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); DataSet CumulativeCartDataSet = new DataSet(); DataTable CumulativeCartDataTable = new DataTable(); string UserId = User.Identity.GetUserId(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(UserId); PricingDataTable = PricingDataSet.Tables[0]; CumulativeCartDataSet = PricingDetailsProxy.FetchCumulativeCartDetails(UserId); CumulativeCartDataTable = CumulativeCartDataSet.Tables[0]; foreach (DataRow row in CumulativeCartDataTable.Rows) { managePricing_IndexViewModel.TotalItems = row["TotalItems"].ToString(); managePricing_IndexViewModel.TotalBuyValue = row["TotalSellValue"].ToString(); } PricingDataTable = DataTablePhotoMapping(PricingDataTable); if (PricingDataTable != null) { managePricing_IndexViewModel.PricingDataTable = PricingDataTable; } return(View(managePricing_IndexViewModel)); } else { return(RedirectToAction("Index", "Home")); } } else { return(RedirectToAction("Index", "Home")); } }
public ActionResult UpdateCartItem(string ProductPricingId, string CartItemQuantity) { if (isValidUser()) { StringBuilder ErrorMessages = new StringBuilder(); StringBuilder SuccessMessages = new StringBuilder(); try { bool UpdateResult = false; CartData cartData = new CartData(); cartData.ProductPricingId = ProductPricingId; cartData.Quantity = int.Parse(CartItemQuantity); cartData.UserId = User.Identity.GetUserId(); UpdateResult = CartDetailsProxy.CUDCartValue(cartData, "Insert/Update"); if (UpdateResult) { SuccessMessages.Append(CUDConstants.UpdateCartSuccess); } else { ErrorMessages.Append(CUDConstants.UpdateCartError); } managePricing_IndexViewModel = new ManagePricing_IndexViewModel(); DataSet PricingDataSet = new DataSet(); DataTable PricingDataTable = new DataTable(); string UserId = User.Identity.GetUserId(); PricingDataSet = PricingDetailsProxy.FetchPricingDetails(UserId); PricingDataTable = PricingDataSet.Tables[0]; #region CumulativeCartData DataSet CumulativeCartDataSet = new DataSet(); DataTable CumulativeCartDataTable = new DataTable(); CumulativeCartDataSet = PricingDetailsProxy.FetchCumulativeCartDetails(UserId); CumulativeCartDataTable = CumulativeCartDataSet.Tables[0]; foreach (DataRow row in CumulativeCartDataTable.Rows) { managePricing_IndexViewModel.TotalItems = row["TotalItems"].ToString(); managePricing_IndexViewModel.TotalBuyValue = row["TotalSellValue"].ToString(); } #endregion PricingDataTable = DataTablePhotoMapping(PricingDataTable); if (PricingDataTable != null) { managePricing_IndexViewModel.PricingDataTable = PricingDataTable; } managePricing_IndexViewModel.UserId = User.Identity.GetUserId(); } catch (Exception e) { ErrorMessages.Append(CUDConstants.UpdateCartError); } if (!String.IsNullOrEmpty(SuccessMessages.ToString())) { managePricing_IndexViewModel.SuccessMessage = SuccessMessages.ToString(); } if (!String.IsNullOrEmpty(ErrorMessages.ToString())) { managePricing_IndexViewModel.ErrorMessage = ErrorMessages.ToString(); } return(PartialView("CustomerPricingGrid", managePricing_IndexViewModel)); } else { return(RedirectToAction("Index", "Home")); } }