public ActionResult UserExchange(int id) { UserObj user = AppData.SessionUser; if (user == null) { return(Redirect("/Login.html")); } ExchangeBLL exchangeBLL = new ExchangeBLL(); var exchangeInfo = exchangeBLL.GetExchangeByID(id); if (exchangeInfo == null) { return(Redirect("/Error/2.html")); } OrderBLL orderBLL = new OrderBLL(); ProductBLL productBLL = new ProductBLL(); AreaBLL areaBLL = new AreaBLL(); OrderObj orderObj = orderBLL.GetOrderByID(exchangeInfo.OrderID); if (orderObj == null || user.UserID != orderObj.UserID) { return(Redirect("/Error/2.html")); } ViewBag.returnProduct = productBLL.GetProduct(exchangeInfo.ReturnProductID); if (exchangeInfo.ExchangeProductID != 0) { ViewBag.exchangeProduct = productBLL.GetProduct(exchangeInfo.ExchangeProductID); } ViewBag.exchangeInfo = exchangeInfo; ViewBag.order = orderObj; ViewBag.area = areaBLL.GetAreaByRetionID(exchangeInfo.RegionID); return(View()); }
public ActionResult ViewReturnExchange(int id) { if (!AppData.IsManagerLogin) { return(Redirect("/Manage/Error/1.html")); } if (PrivilegeBLL.HasNotPrivilege(AppData.SessionUserID, 20)) { return(Redirect("/Manage/Error/2.html")); } ExchangeBLL exchangeBLL = new ExchangeBLL(); var exchangeInfo = exchangeBLL.GetExchangeByID(id); UserBLL userBLL = new UserBLL(); OrderBLL orderBLL = new OrderBLL(); ProductBLL productBLL = new ProductBLL(); AreaBLL areaBLL = new AreaBLL(); OrderObj orderObj = orderBLL.GetOrderByID(exchangeInfo.OrderID); ViewBag.returnProduct = productBLL.GetProduct(exchangeInfo.ReturnProductID); if (exchangeInfo.ExchangeProductID != 0) { ViewBag.exchangeProduct = productBLL.GetProduct(exchangeInfo.ExchangeProductID); } ViewBag.exchangeInfo = exchangeInfo; ViewBag.order = orderObj; ViewBag.userInfo = userBLL.GetUserByID(orderObj.UserID); ViewBag.userInfo = userBLL.GetUserByID(orderObj.UserID); ViewBag.area = areaBLL.GetAreaByRetionID(exchangeInfo.RegionID); return(View()); }