public static SaleProduct GetSaleProduct(string weiXinID, int saleProductId) { var dt = DAL.SaleProduct.GetSaleProduct(weiXinID, saleProductId); SaleProduct saleProduct = new SaleProduct(); foreach (System.Data.DataRow dr in dt.Rows) { saleProduct.Id = Convert.ToInt32(dr["id"].ToString()); saleProduct.WeiXinId = dr["WeiXinId"].ToString(); saleProduct.HotelId = Convert.ToInt32(dr["HotelId"].ToString()); saleProduct.ProductType = Convert.ToInt32(dr["ProductType"].ToString()); saleProduct.ProductName = dr["ProductName"].ToString(); saleProduct.ProductNum = Convert.ToInt32(dr["ProductNum"].ToString()); saleProduct.BeginTime = Convert.ToDateTime(dr["BeginTime"].ToString()); saleProduct.EndTime = Convert.ToDateTime(dr["EndTime"].ToString()); saleProduct.EffectiveBeginTime = Convert.ToDateTime(dr["EffectiveBeginTime"].ToString()); saleProduct.EffectiveEndTime = Convert.ToDateTime(dr["EffectiveEndTime"].ToString()); saleProduct.ProductPrice = Convert.ToDecimal(dr["ProductPrice"].ToString()); saleProduct.DetailDes = dr["DetailDes"].ToString(); saleProduct.SaleChannel = dr["SaleChannel"].ToString(); saleProduct.Status = Convert.ToInt32(dr["Status"].ToString()); saleProduct.LastUpdatetime = Convert.ToDateTime(dr["LastUpdateTime"].ToString()); saleProduct.FeeInclude = dr["FeeInclude"].ToString(); saleProduct.FeeExclude = dr["FeeExclude"].ToString(); saleProduct.OrderInfo = dr["OrderInfo"].ToString(); saleProduct.RefundInfo = dr["RefundInfo"].ToString(); saleProduct.ImageList = dr["ImageList"].ToString(); saleProduct.SmallImageList = dr["SmallImageList"].ToString(); saleProduct.BigImageList = dr["BigImageList"].ToString(); saleProduct.IsOnlineTaobao = Convert.ToInt32(dr["IsOnlineTaobao"].ToString()); saleProduct.IsOnlineQunar = Convert.ToInt32(dr["IsOnlineQunar"].ToString()); saleProduct.SysStatus = Convert.ToInt32(dr["SysStatus"].ToString()); saleProduct.MenPrice = Convert.ToDecimal(dr["MenPrice"].ToString()); saleProduct.MainPic = dr["MainPic"].ToString(); saleProduct.Tab = dr["Tab"].ToString(); saleProduct.BigMainPic = dr["BigMainPic"].ToString(); saleProduct.SmallMainPic = dr["SmallMainPic"].ToString(); saleProduct.IsUsehongbao = Convert.ToInt32(dr["IsUsehongbao"].ToString()); } return(saleProduct); }
public static List <SaleProduct> GetSaleProducts(string weiXinID, out int count, int page, int pagesize, string select, string query) { var dt = DAL.SaleProduct.GetSaleProducts(weiXinID, out count, page, pagesize, select, query); List <SaleProduct> saleProductList = new List <SaleProduct>(); foreach (System.Data.DataRow dr in dt.Rows) { SaleProduct saleProduct = new SaleProduct(); saleProduct.Id = Convert.ToInt32(dr["id"].ToString()); saleProduct.WeiXinId = dr["WeiXinId"].ToString(); saleProduct.HotelId = Convert.ToInt32(dr["HotelId"].ToString()); saleProduct.ProductType = Convert.ToInt32(dr["ProductType"].ToString()); saleProduct.ProductName = dr["ProductName"].ToString(); saleProduct.ProductNum = Convert.ToInt32(dr["ProductNum"].ToString()); saleProduct.BeginTime = Convert.ToDateTime(dr["BeginTime"].ToString()); saleProduct.EndTime = Convert.ToDateTime(dr["EndTime"].ToString()); saleProduct.EffectiveBeginTime = Convert.ToDateTime(dr["EffectiveBeginTime"].ToString()); saleProduct.EffectiveEndTime = Convert.ToDateTime(dr["EffectiveEndTime"].ToString()); saleProduct.ProductPrice = Convert.ToDecimal(dr["ProductPrice"].ToString()); saleProduct.DetailDes = dr["DetailDes"].ToString(); saleProduct.SaleChannel = dr["SaleChannel"].ToString(); saleProduct.Status = Convert.ToInt32(dr["Status"].ToString()); saleProduct.LastUpdatetime = Convert.ToDateTime(dr["LastUpdateTime"].ToString()); saleProduct.FeeInclude = dr["FeeInclude"].ToString(); saleProduct.FeeExclude = dr["FeeExclude"].ToString(); saleProduct.OrderInfo = dr["OrderInfo"].ToString(); saleProduct.RefundInfo = dr["RefundInfo"].ToString(); saleProduct.ImageList = dr["ImageList"].ToString(); saleProduct.SmallImageList = dr["SmallImageList"].ToString(); saleProduct.BigImageList = dr["BigImageList"].ToString(); saleProduct.IsOnlineTaobao = Convert.ToInt32(dr["IsOnlineTaobao"].ToString()); saleProduct.IsOnlineQunar = Convert.ToInt32(dr["IsOnlineQunar"].ToString()); saleProduct.SysStatus = Convert.ToInt32(dr["SysStatus"].ToString()); saleProductList.Add(saleProduct); } return(saleProductList); }
public static int UpdateSaleProduct(SaleProduct model) { int row = DAL.SaleProduct.UpdateSaleProductSale(model); return(row); }
public static int AddSaleProduct(SaleProduct model) { int Id = DAL.SaleProduct.AddSaleProductSale(model); return(Id); }
public ActionResult ProductDetail() { int Id = HotelCloud.Common.HCRequest.getInt("ProductId"); WeiXin.Models.Home.SaleProduct products = new WeiXin.Models.Home.SaleProduct(); Newtonsoft.Json.Converters.IsoDateTimeConverter timeFormat = new Newtonsoft.Json.Converters.IsoDateTimeConverter(); timeFormat.DateTimeFormat = "yyyy-MM-dd"; string key = HotelCloud.Common.HCRequest.GetString("key"); string hotelweixinId = key.Split('@')[0]; string userweixinId = key.Split('@')[1]; products = WeiXin.Models.Home.SaleProduct.GetSaleProduct(hotelweixinId, Id); if (products == null || products.Id == 0) { //return RedirectToAction("ProductErrMsg", "Product", new { id = RouteData.Values["id"], errmsg = "没找到对应的产品", key = HotelCloud.Common.HCRequest.GetString("key") }); return(RedirectToAction("productList", "Product", new { id = RouteData.Values["id"], key = HotelCloud.Common.HCRequest.GetString("key") })); } if (products.EndTime < DateTime.Now) { //return RedirectToAction("ProductErrMsg", "Product", new { id = RouteData.Values["id"], errmsg = "产品已过期", key = HotelCloud.Common.HCRequest.GetString("key") }); } if (products.Status != 0) { //return RedirectToAction("ProductErrMsg", "Product", new { id = RouteData.Values["id"], errmsg = "产品已下架", key = HotelCloud.Common.HCRequest.GetString("key") }); return(RedirectToAction("productList", "Product", new { id = RouteData.Values["id"], key = HotelCloud.Common.HCRequest.GetString("key") })); } double minPrice = 0; double maxPrice = 0; products.List_SaleProducts_TC = WeiXin.Models.Home.SaleProducts_TC.GetSaleProducts_TC(products.Id); DataTable db = WeiXin.Models.Home.SaleProduct.GetHotelInfo(products.WeiXinId); if (db.Rows.Count > 0) { ViewData["hotelname"] = db.Rows[0]["SubName"].ToString(); ViewData["tel"] = db.Rows[0]["tel"].ToString(); ViewData["address"] = db.Rows[0]["address"].ToString(); ViewData["WeiXin2Img"] = db.Rows[0]["WeiXin2Img"].ToString(); } //团购 if (products.ProductType == 0) { products.List_SaleProducts_TC = products.List_SaleProducts_TC.Where(c => c.ProductPrice > 0 && c.ProductNum > 0).OrderBy(c => c.ProductPrice).ToList(); if (products.List_SaleProducts_TC != null && products.List_SaleProducts_TC.Count > 0) { minPrice = Convert.ToDouble(products.List_SaleProducts_TC.Min(c => c.ProductPrice)); maxPrice = Convert.ToDouble(products.List_SaleProducts_TC.Max(c => c.ProductPrice)); } } //预售 else if (products.ProductType == 1) { foreach (var item in products.List_SaleProducts_TC) { item.List_SaleProducts_TC_Price = WeiXin.Models.Home.SaleProducts_TC_Price.GetSaleProducts_TC_Price(item.Id); } products.List_SaleProducts_TC = products.List_SaleProducts_TC.Where(c => c.List_SaleProducts_TC_Price.Count > 0).ToList(); if (products.List_SaleProducts_TC != null && products.List_SaleProducts_TC.Count > 0) { var t_price = new List <WeiXin.Models.Home.SaleProducts_TC_Price>(); products.List_SaleProducts_TC.ForEach(r => { t_price.AddRange(r.List_SaleProducts_TC_Price); }); minPrice = Convert.ToDouble(t_price.Min(c => c.Price)); maxPrice = Convert.ToDouble(t_price.Max(c => c.Price)); } } products.Json_SaleProducts_TC = Newtonsoft.Json.JsonConvert.SerializeObject(products.List_SaleProducts_TC, timeFormat); ViewData["products"] = products; if (minPrice == 0) { return(RedirectToAction("productList", "Product", new { id = RouteData.Values["id"], key = HotelCloud.Common.HCRequest.GetString("key") })); //return RedirectToAction("ProductErrMsg", "Product", new { id = RouteData.Values["id"], errmsg = "产品已售完", key = HotelCloud.Common.HCRequest.GetString("key") }); } ViewData["minPrice"] = minPrice; ViewData["maxPrice"] = maxPrice; return(View()); }