Exemplo n.º 1
0
        public IList <ProductImageInfo> GetList()
        {
            StringBuilder sb = new StringBuilder(250);

            sb.Append(@"select ProductId,ProductItemId,PictureAppend 
			            from ProductImage
					    order by LastUpdatedDate desc "                    );

            IList <ProductImageInfo> list = new List <ProductImageInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString()))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ProductImageInfo model = new ProductImageInfo();
                        model.ProductId     = reader.GetGuid(0);
                        model.ProductItemId = reader.GetGuid(1);
                        model.PictureAppend = reader.GetString(2);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Exemplo n.º 2
0
        public IList <ProductImageInfo> GetList(string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb = new StringBuilder(250);

            sb.Append(@"select ProductId,ProductItemId,PictureAppend
                        from ProductImage ");
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }

            IList <ProductImageInfo> list = new List <ProductImageInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ProductImageInfo model = new ProductImageInfo();
                        model.ProductId     = reader.GetGuid(0);
                        model.ProductItemId = reader.GetGuid(1);
                        model.PictureAppend = reader.GetString(2);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Maps a single shipment.
        /// </summary>
        /// <param name="shipment">Shipment to map.</param>
        /// <param name="cultureInfo">Culture Info.</param>
        /// <param name="imageInfo">Information about images</param>
        /// <param name="baseUrl">The request base url</param>
        /// <param name="cartVm">VM in which to map the shipment to.</param>
        /// <param name="cart">Cart being mapped.</param>
        protected virtual void MapOneShipment(
            Shipment shipment,
            CultureInfo cultureInfo,
            ProductImageInfo imageInfo,
            string baseUrl,
            CartViewModel cartVm,
            Overture.ServiceModel.Orders.Cart cart)
        {
            cartVm.CurrentShipmentId  = shipment.Id;
            cartVm.Rewards            = RewardViewModelFactory.CreateViewModel(shipment.Rewards, cultureInfo, RewardLevel.FulfillmentMethod, RewardLevel.Shipment).ToList();
            cartVm.OrderSummary.Taxes = TaxViewModelFactory.CreateTaxViewModels(shipment.Taxes, cultureInfo).ToList();
            cartVm.ShippingAddress    = GetAddressViewModel(shipment.Address, cultureInfo);

            cartVm.LineItemDetailViewModels = LineItemViewModelFactory.CreateViewModel(new CreateListOfLineItemDetailViewModelParam
            {
                Cart        = cart,
                LineItems   = shipment.LineItems,
                CultureInfo = cultureInfo,
                ImageInfo   = imageInfo,
                BaseUrl     = baseUrl
            }).ToList();

            MapLineItemQuantifiers(cartVm);

            cartVm.OrderSummary.IsShippingEstimatedOrSelected = IsShippingEstimatedOrSelected(shipment);
            cartVm.ShippingMethod = GetShippingMethodViewModel(shipment.FulfillmentMethod, cultureInfo);

#pragma warning disable 618
            MapShipmentAdditionalFees(shipment, cartVm.OrderSummary, cultureInfo);
#pragma warning restore 618
        }
Exemplo n.º 4
0
        public ProductImageInfo GetModel(object productItemId)
        {
            ProductImageInfo model = null;

            StringBuilder sb = new StringBuilder(300);

            sb.Append(@"select top 1 ProductId,ProductItemId,PictureAppend 
			            from ProductImage
						where ProductItemId = @ProductItemId "                        );
            SqlParameter parm = new SqlParameter("@ProductItemId", SqlDbType.UniqueIdentifier);

            parm.Value = Guid.Parse(productItemId.ToString());

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), parm))
            {
                if (reader != null)
                {
                    while (reader.Read())
                    {
                        model               = new ProductImageInfo();
                        model.ProductId     = reader.GetGuid(0);
                        model.ProductItemId = reader.GetGuid(1);
                        model.PictureAppend = reader.GetString(2);
                    }
                }
            }

            return(model);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 添加商品图片
        /// </summary>
        public ActionResult AddProductImage(string showImg, int displayOrder = 0, int pid = -1)
        {
            PartProductInfo partProductInfo = AdminProducts.AdminGetPartProductById(pid);

            if (partProductInfo == null)
            {
                return(PromptView(Url.Action("productimagelist", new { pid = pid }), "商品不存在"));
            }

            if (string.IsNullOrWhiteSpace(showImg))
            {
                return(PromptView(Url.Action("productimagelist", new { pid = pid }), "图片不能为空"));
            }

            ProductImageInfo productImageInfo = new ProductImageInfo
            {
                Pid          = pid,
                ShowImg      = showImg,
                IsMain       = 0,
                DisplayOrder = displayOrder,
                StoreId      = partProductInfo.StoreId
            };

            AdminProducts.CreateProductImage(productImageInfo);
            AddMallAdminLog("添加商品图片", "添加商品图片,商品ID为:" + pid);
            return(PromptView(Url.Action("productimagelist", new { pid = pid }), "商品图片添加成功"));
        }
Exemplo n.º 6
0
        public IList <ProductImageInfo> GetList(int pageIndex, int pageSize, string sqlWhere, params SqlParameter[] cmdParms)
        {
            StringBuilder sb         = new StringBuilder(250);
            int           startIndex = (pageIndex - 1) * pageSize + 1;
            int           endIndex   = pageIndex * pageSize;

            sb.Append(@"select * from(select row_number() over(order by LastUpdatedDate desc) as RowNumber,
			           ProductId,ProductItemId,PictureAppend
					   from ProductImage "                    );
            if (!string.IsNullOrEmpty(sqlWhere))
            {
                sb.AppendFormat(" where 1=1 {0} ", sqlWhere);
            }
            sb.AppendFormat(@")as objTable where RowNumber between {0} and {1} ", startIndex, endIndex);

            IList <ProductImageInfo> list = new List <ProductImageInfo>();

            using (SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.HnztcShopDbConnString, CommandType.Text, sb.ToString(), cmdParms))
            {
                if (reader != null && reader.HasRows)
                {
                    while (reader.Read())
                    {
                        ProductImageInfo model = new ProductImageInfo();
                        model.ProductId     = reader.GetGuid(1);
                        model.ProductItemId = reader.GetGuid(2);
                        model.PictureAppend = reader.GetString(3);

                        list.Add(model);
                    }
                }
            }

            return(list);
        }
Exemplo n.º 7
0
 protected void btImage_Click(object sender, EventArgs e)
 {
     if (fuImage.HasFile)
     {
         //檔名切換
         string imgFileName = WebUtility.ChangeFileNameAsRandom(fuImage.FileName);
         if (WebUtility.CheckImageExt(System.IO.Path.GetExtension(imgFileName)))
         {
             //從Web.Config取得路徑
             string serverFileName = WebUtility.MergePathAndFileName(imgFileName, Tools.GetAppSettings("ProductImageTempPath"));
             fuImage.SaveAs(serverFileName);
             if (Session["pdimginfo"] == null)
             {
                 pdImgInfos = new List <ProductImageInfo>();
             }
             else
             {
                 pdImgInfos = (List <ProductImageInfo>)Session["pdimginfo"];
             }
             ProductImageInfo info = new ProductImageInfo();
             info.pi_image     = imgFileName;
             info.pi_imageName = imgFileName;
             pdImgInfos.Add(info);
             tfBLL.InsertTempFiles("product", Tools.GetAppSettings("ProductImageTempPath") + imgFileName);
             Session["pdimginfo"] = pdImgInfos;
             rpImage.DataSource   = pdImgInfos;
             rpImage.DataBind();
         }
         else
         {
             this.Page.Controls.Add(Tools.Tomsg("副檔名格式錯誤"));
         }
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// 获得商品图片列表
        /// </summary>
        /// <param name="pid">商品id</param>
        /// <returns></returns>
        public static List <ProductImageInfo> GetProductImageList(int pid)
        {
            List <ProductImageInfo> productImageList = null;

            if (_productnosql != null)
            {
                productImageList = _productnosql.GetProductImageList(pid);
                if (productImageList == null)
                {
                    productImageList = new List <ProductImageInfo>();
                    IDataReader reader = BrnShop.Core.BSPData.RDBS.GetProductImageList(pid);
                    while (reader.Read())
                    {
                        ProductImageInfo productImageInfo = BuildProductImageFromReader(reader);
                        productImageList.Add(productImageInfo);
                    }
                    reader.Close();
                    _productnosql.CreateProductImageList(pid, productImageList);
                }
            }
            else
            {
                productImageList = new List <ProductImageInfo>();
                IDataReader reader = BrnShop.Core.BSPData.RDBS.GetProductImageList(pid);
                while (reader.Read())
                {
                    ProductImageInfo productImageInfo = BuildProductImageFromReader(reader);
                    productImageList.Add(productImageInfo);
                }
                reader.Close();
            }

            return(productImageList);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 创建商品图片
 /// </summary>
 public static void CreateProductImage(ProductImageInfo productImageInfo)
 {
     BrnShop.Core.BSPData.RDBS.CreateProductImage(productImageInfo);
     if (_productnosql != null)
     {
         _productnosql.ClearProductImage(productImageInfo.Pid);
     }
 }
Exemplo n.º 10
0
 /// <summary>
 /// 创建商品图片
 /// </summary>
 public static void CreateProductImage(ProductImageInfo productImageInfo)
 {
     BrnShop.Data.Products.CreateProductImage(productImageInfo);
     if (productImageInfo.IsMain == 1)
     {
         UpdateProductShowImage(productImageInfo.Pid, productImageInfo.ShowImg);
     }
 }
Exemplo n.º 11
0
 public override IDataReader AddProductImage(ProductImageInfo proimage)
 {
     return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("usp_Product_AddProductImage")
                                    , GetNull(proimage.product_id)
                                    , GetNull(proimage.image)
                                    , GetNull(proimage.create_by)
                                    ));
 }
Exemplo n.º 12
0
        public static ProductImageInfo AddProductImage(string product_id, string image, string create_by)
        {
            ProductImageInfo proimage = new ProductImageInfo();

            proimage.product_id = product_id;
            proimage.image      = image;
            proimage.create_by  = create_by;
            return(CBO.FillObject <ProductImageInfo>(DataProvider.Instance().AddProductImage(proimage)));
        }
Exemplo n.º 13
0
        /// <summary>
        /// 设置商品默认图片
        /// </summary>
        /// <param name="sysNo">商品图片编号</param>
        /// <returns></returns>
        public static bool SetProductDefaultImage(ProductImageInfo imageInfo)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("SetProductDefaultImage");

            cmd.SetParameterValue("@SysNo", imageInfo.SysNo);
            cmd.SetParameterValue("@ProductSysNo", imageInfo.ProductSysNo);
            cmd.ExecuteNonQuery();
            return(true);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 更新商品图片优先级
        /// </summary>
        /// <param name="imageInfo">商品图片信息</param>
        /// <returns></returns>
        public static bool UpdateProductImagePriority(ProductImageInfo imageInfo)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("UpdateProductImagePriority");

            cmd.SetParameterValue("@SysNo", imageInfo.SysNo);
            cmd.SetParameterValue("@Priority", imageInfo.Priority);
            cmd.ExecuteNonQuery();
            return(true);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 改变商品图片排序
        /// </summary>
        /// <param name="pImgId">商品图片id</param>
        /// <param name="displayOrder">排序值</param>
        public static void ChangeProductImageDisplayOrder(int pImgId, int displayOrder)
        {
            ProductImageInfo productImageInfo = GetProductImageById(pImgId);

            if (productImageInfo != null)
            {
                BrnShop.Data.Products.ChangeProductImageDisplayOrder(productImageInfo.Pid, pImgId, displayOrder);
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// 改变商品图片排序
        /// </summary>
        /// <param name="pImgId">商品图片id</param>
        /// <param name="showImg">图片排序</param>
        /// <returns></returns>
        public static bool ChangeProductImageDisplayOrder(int pImgId, int displayOrder)
        {
            ProductImageInfo productImageInfo = GetProductImageById(pImgId);

            if (productImageInfo != null)
            {
                return(BrnShop.Data.Products.ChangeProductImageDisplayOrder(productImageInfo.Pid, pImgId, displayOrder));
            }
            return(false);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 设置图片为商品主图
        /// </summary>
        /// <param name="pImgId">商品图片id</param>
        public static void SetProductMainImage(int pImgId)
        {
            ProductImageInfo productImageInfo = GetProductImageById(pImgId);

            if (productImageInfo != null && productImageInfo.IsMain != 1)
            {
                BrnShop.Data.Products.SetProductMainImage(productImageInfo.Pid, pImgId);
                UpdateProductShowImage(productImageInfo.Pid, productImageInfo.ShowImg);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// 删除商品图片
        /// </summary>
        /// <param name="pImgId">商品图片id</param>
        public static void DeleteProductImageById(int pImgId)
        {
            ProductImageInfo productImageInfo = GetProductImageById(pImgId);

            BrnShop.Data.Products.DeleteProductImageById(productImageInfo.Pid, pImgId);
            if (productImageInfo.IsMain == 1)
            {
                UpdateProductShowImage(productImageInfo.Pid, "");
            }
        }
Exemplo n.º 19
0
        public List <ProductImageInfo> GetallImgWithProduct(int p_id)
        {
            List <ProductImageInfo> infos  = new List <Model.ProductImageInfo>();
            IDataReader             reader = db.GetallImgWithProduct(p_id).CreateDataReader();

            while (reader.Read())
            {
                infos.Add(ProductImageInfo.Populate(reader));
            }
            return(infos);
        }
Exemplo n.º 20
0
        public ProductImageInfo GetImgWithKey(int pi_id)
        {
            ProductImageInfo info   = new Model.ProductImageInfo();
            IDataReader      reader = db.GetImageWithKey(pi_id).CreateDataReader();

            if (reader.Read())
            {
                info = ProductImageInfo.Populate(reader);
            }
            return(info);
        }
Exemplo n.º 21
0
 public override IDataReader SetProductImage(ProductImageInfo proimage)
 {
     return(SqlHelper.ExecuteReader(ConnectionString, GetFullyQualifiedName("usp_Product_SetProductImage")
                                    , GetNull(proimage.image_id)
                                    , GetNull(proimage.product_id)
                                    , GetNull(proimage.image)
                                    , GetNull(proimage.display_sort)
                                    , GetNull(proimage.lastupdate_by)
                                    , GetNull(proimage.is_del)
                                    ));
 }
Exemplo n.º 22
0
        /// <summary>
        /// 删除商品图片
        /// </summary>
        /// <param name="pImgId">商品id</param>
        /// <returns></returns>
        public static bool DeleteProductImageById(int pImgId)
        {
            ProductImageInfo productImageInfo = GetProductImageById(pImgId);
            bool             result           = BrnShop.Data.Products.DeleteProductImageById(productImageInfo.Pid, pImgId);

            if (result && productImageInfo.IsMain == 1)
            {
                UpdateProductShowImage(productImageInfo.Pid, "");
            }
            return(result);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 从IDataReader创建ProductImageInfo
        /// </summary>
        public static ProductImageInfo BuildProductImageFromReader(IDataReader reader)
        {
            ProductImageInfo productImageInfo = new ProductImageInfo();

            productImageInfo.PImgId       = TypeHelper.ObjectToInt(reader["pimgid"]);
            productImageInfo.Pid          = TypeHelper.ObjectToInt(reader["pid"]);
            productImageInfo.ShowImg      = reader["showimg"].ToString();
            productImageInfo.IsMain       = TypeHelper.ObjectToInt(reader["ismain"]);
            productImageInfo.DisplayOrder = TypeHelper.ObjectToInt(reader["displayorder"]);

            return(productImageInfo);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 获得商品图片
        /// </summary>
        /// <param name="pImgId">图片id</param>
        /// <returns></returns>
        public static ProductImageInfo GetProductImageById(int pImgId)
        {
            ProductImageInfo productImageInfo = null;
            IDataReader      reader           = BrnShop.Core.BSPData.RDBS.GetProductImageById(pImgId);

            if (reader.Read())
            {
                productImageInfo = BuildProductImageFromReader(reader);
            }
            reader.Close();
            return(productImageInfo);
        }
Exemplo n.º 25
0
        /// <summary>
        /// 保存商品图片信息
        /// </summary>
        /// <param name="imageInfo">商品图片信息</param>
        /// <returns></returns>
        public static bool SaveProductImageInfo(ProductImageInfo imageInfo)
        {
            DataCommand cmd = DataCommandManager.GetDataCommand("SaveProductImageInfo");

            cmd.SetParameterValue("@ProductSysNo", imageInfo.ProductSysNo);
            cmd.SetParameterValue("@ResourceUrl", imageInfo.ResourceUrl);
            cmd.SetParameterValue("@InUserName", imageInfo.InUserName);
            cmd.SetParameterValue("@CompanyCode", imageInfo.CompanyCode);
            cmd.SetParameterValue("@LanguageCode", imageInfo.LanguageCode);
            cmd.ExecuteNonQuery();
            return(true);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 删除商品图片
        /// </summary>
        public ActionResult DelProductImage(int pImgId = -1)
        {
            ProductImageInfo productImageInfo = AdminProducts.GetProductImageById(pImgId);

            if (productImageInfo == null || productImageInfo.StoreId != WorkContext.StoreId)
            {
                return(Content("0"));
            }

            AdminProducts.DeleteProductImageById(pImgId);
            AddStoreAdminLog("删除商品图片", "删除商品图片,商品图片ID:" + pImgId);
            return(Content("1"));
        }
Exemplo n.º 27
0
        /// <summary>
        /// 改变商品图片的排序
        /// </summary>
        public ActionResult ChangeProductImageDisplayOrder(int pImgId = -1, int displayOrder = 0)
        {
            ProductImageInfo productImageInfo = AdminProducts.GetProductImageById(pImgId);

            if (productImageInfo == null || productImageInfo.StoreId != WorkContext.StoreId)
            {
                return(Content("0"));
            }

            AdminProducts.ChangeProductImageDisplayOrder(pImgId, displayOrder);
            AddStoreAdminLog("修改商品图片顺序", "修改商品图片顺序,商品图片ID:" + pImgId);
            return(Content("1"));
        }
Exemplo n.º 28
0
        /// <summary>
        /// 设置图片为商品主图
        /// </summary>
        public ActionResult SetProductMianImage(int pImgId = -1)
        {
            ProductImageInfo productImageInfo = AdminProducts.GetProductImageById(pImgId);

            if (productImageInfo == null || productImageInfo.StoreId != WorkContext.StoreId)
            {
                return(Content("0"));
            }

            AdminProducts.SetProductMainImage(pImgId);
            AddStoreAdminLog("设置商品主图", "设置商品主图,商品图片ID:" + pImgId);
            return(Content("1"));
        }
Exemplo n.º 29
0
 protected void rpImage_ItemCommand(object source, RepeaterCommandEventArgs e)
 {
     if (e.CommandName == "Delete")
     {
         pdImgBLL.Delete(int.Parse(e.CommandArgument.ToString()));
     }
     if (e.CommandName == "Update")
     {
         ProductImageInfo info = pdImgBLL.GetImgWithKey(int.Parse(e.CommandArgument.ToString()));
         hfImageIndex.Value = info.pi_imageName;
     }
     rpImage.DataSource = pdImgBLL.GetallImgWithProduct(Tools.GetInt32SafeFromQueryString(this.Page, "id", 0));
     rpImage.DataBind();
 }
Exemplo n.º 30
0
        protected virtual async Task <CompleteCheckoutViewModel> MapOrderToCompleteCheckoutViewModel(Overture.ServiceModel.Orders.Order order,
                                                                                                     CompleteCheckoutParam param)
        {
            if (order == null)
            {
                return(null);
            }

            var orderStatuses = await LookupService.GetLookupDisplayNamesAsync(new GetLookupDisplayNamesParam
            {
                CultureInfo = param.CultureInfo,
                LookupType  = LookupType.Order,
                LookupName  = "OrderStatus",
            }).ConfigureAwait(false);

            var productImageInfo = new ProductImageInfo
            {
                ImageUrls = await ImageService.GetImageUrlsAsync(order.Cart.GetLineItems()).ConfigureAwait(false)
            };

            var getVmOrderParam = new CreateOrderDetailViewModelParam {
                Order              = order,
                CultureInfo        = param.CultureInfo,
                OrderStatuses      = orderStatuses,
                OrderDetailBaseUrl = OrderUrlProvider.GetOrderDetailsBaseUrl(param.CultureInfo),
                BaseUrl            = param.BaseUrl,
                ProductImageInfo   = productImageInfo,
            };

            var orderViewModel = OrderDetailsViewModelFactory.CreateLightViewModel(getVmOrderParam);

            var completeCheckoutViewModel = new CompleteCheckoutViewModel
            {
                OrderNumber       = order.OrderNumber,
                Order             = orderViewModel,
                CustomerEmail     = order.Cart.Customer.Email,
                CustomerFirstName = order.Cart.Customer.FirstName,
                CustomerLastName  = order.Cart.Customer.LastName,
                Affiliation       = order.Cart.OrderLocation?.Name,
                Revenu            = order.Cart.Total,
                Tax             = order.Cart.TaxTotal,
                Shipping        = order.Cart.FulfillmentCost,
                ShippingOptions = order.Cart.Shipments?.FirstOrDefault()?.FulfillmentMethod.FulfillmentMethodType.ToString().ToLowerInvariant(),
                BillingCurrency = order.Cart.BillingCurrency,
                Coupons         = MapCoupons(order, param.CultureInfo),
                LineItems       = orderViewModel?.Shipments.FirstOrDefault()?.LineItems
            };

            return(completeCheckoutViewModel);
        }