public ActionResult ViewOrderDetail(long OrderId = 0) { OrderShipModel model = new OrderShipModel(); CmnEntityModel currentUser = Session["CmnEntityModel"] as CmnEntityModel; var authorityList = currentUser != null ? currentUser.USER_AUTHORITY : 0; if (currentUser == null || currentUser.USER_ID == 0) { return(RedirectToAction("Login", "UserAccount")); } CommonService comService = new CommonService(); CommonDa da = new CommonDa(); AdminOrderShipDa dataAccess = new AdminOrderShipDa(); if (OrderId > 0) { OrderShipModel infor = new OrderShipModel(); infor = dataAccess.getInforOrder(OrderId); model = infor != null ? infor : model; var inforUserSender = da.getInforUser(model.USER_ID); if (inforUserSender != null) { model.SENDER_CITY_NAME = inforUserSender.CITY_NAME; model.SENDER_DISTRICT_NAME = inforUserSender.DISTRICT_NAME; model.SENDER_TOWN_NAME = inforUserSender.TOWN_NAME; model.SENDER_NAME = inforUserSender.USER_NAME; model.SENDER_PHONE = inforUserSender.USER_PHONE; model.SENDER_ADDRESS = inforUserSender.USER_ADDRESS; } model.RECEIVE_TOTAL_MONEY = model.PRICE_PRODUCT.HasValue ? model.PRICE_PRODUCT.Value : 0; if (model.USER_PAYMENT == User_Pay.Receiver) { decimal shipMoney = model.PRICE_SHIP; decimal priceProduct = model.PRICE_PRODUCT.HasValue ? model.PRICE_PRODUCT.Value : 0; model.RECEIVE_TOTAL_MONEY = priceProduct + shipMoney; } model.ORDER_STATUS_TEXT = OrderStatus.Items[model.ORDER_STATUS].ToString(); model.OTHER_REQUIREMENT_TEXT = Other_Requirement.Items[model.OTHER_REQUIREMENT].ToString(); model.PRODUCT_TYPE_TEXT = Product_Type.Items[model.PRODUCT_TYPE].ToString(); model.SHIP_TYPE_TEXT = Ship_Type.Items[model.SHIP_TYPE].ToString(); model.PRODUCT_WEIGHT_TEXT = Product_Weight.Items[model.PRODUCT_WEIGHT].ToString(); model.PRODUCT_SIZE_TEXT = Constant.PRODUCT_SIZE_TEXT_DEFAULT; if (string.IsNullOrEmpty(model.ACCEPTANCE_NAME)) { model.ACCEPTANCE_NAME = Constant.ACCEPTANCE_NAME_DEFAULT; } if (model.PRODUCT_LENGTH != null && model.PRODUCT_HEIGHT != null && model.PRODUCT_WIDTH != null && model.PRODUCT_LENGTH > 0 && model.PRODUCT_HEIGHT > 0 && model.PRODUCT_WIDTH > 0) { model.PRODUCT_SIZE_TEXT = model.PRODUCT_LENGTH.ToString() + "x" + model.PRODUCT_WIDTH.ToString() + "x" + model.PRODUCT_HEIGHT.ToString(); } } return(this.PartialView("ViewOrderDetail", model)); }
public ActionResult PrintOrderCustom(string ORDER_ID_STRING) { CommonDa da = new CommonDa(); OrderShipDa dataAccess = new OrderShipDa(); List <OrderShipModel> listOrderShip = new List <OrderShipModel>(); OrderShipModel model = new OrderShipModel(); if (!string.IsNullOrEmpty(ORDER_ID_STRING)) { List <long> ORDER_ID_LIST = ORDER_ID_STRING.Split(',').Select(long.Parse).ToList(); if (ORDER_ID_LIST.Count > 0) { for (int i = 0; i < ORDER_ID_LIST.Count(); i++) { if (ORDER_ID_LIST[i] > 0) { var infor = dataAccess.getInforOrder(ORDER_ID_LIST[i]); model = infor != null ? infor : model; var inforUserSender = da.getInforUser(model.USER_ID); if (inforUserSender != null) { model.SENDER_CITY_NAME = inforUserSender.CITY_NAME; model.SENDER_DISTRICT_NAME = inforUserSender.DISTRICT_NAME; model.SENDER_TOWN_NAME = inforUserSender.TOWN_NAME; model.SENDER_NAME = inforUserSender.USER_NAME; model.SENDER_PHONE = inforUserSender.USER_PHONE; model.SENDER_ADDRESS = inforUserSender.USER_ADDRESS; } model.RECEIVE_TOTAL_MONEY = model.PRICE_PRODUCT.HasValue ? model.PRICE_PRODUCT.Value : 0; if (model.USER_PAYMENT == User_Pay.Receiver) { decimal shipMoney = model.PRICE_SHIP; decimal priceProduct = model.PRICE_PRODUCT.HasValue ? model.PRICE_PRODUCT.Value : 0; model.RECEIVE_TOTAL_MONEY = priceProduct + shipMoney; } model.ORDER_STATUS_TEXT = OrderStatus.Items[model.ORDER_STATUS].ToString(); model.OTHER_REQUIREMENT_TEXT = Other_Requirement.Items[model.OTHER_REQUIREMENT].ToString(); model.PRODUCT_TYPE_TEXT = Product_Type.Items[model.PRODUCT_TYPE].ToString(); model.SHIP_TYPE_TEXT = Ship_Type.Items[model.SHIP_TYPE].ToString(); model.PRODUCT_WEIGHT_TEXT = Product_Weight.Items[model.PRODUCT_WEIGHT].ToString(); model.PRODUCT_SIZE_TEXT = Constant.PRODUCT_SIZE_TEXT_DEFAULT; if (string.IsNullOrEmpty(model.ACCEPTANCE_NAME)) { model.ACCEPTANCE_NAME = Constant.ACCEPTANCE_NAME_DEFAULT; } if (model.PRODUCT_LENGTH != null && model.PRODUCT_HEIGHT != null && model.PRODUCT_WIDTH != null && model.PRODUCT_LENGTH > 0 && model.PRODUCT_HEIGHT > 0 && model.PRODUCT_WIDTH > 0) { model.PRODUCT_SIZE_TEXT = model.PRODUCT_LENGTH.ToString() + "x" + model.PRODUCT_WIDTH.ToString() + "x" + model.PRODUCT_HEIGHT.ToString(); } listOrderShip.Add(model); } } } return(new ViewAsPdf("ViewOrderDetailPDF", listOrderShip)); //return View("ViewOrderDetailPDF", model); } return(new EmptyResult()); }