Ejemplo n.º 1
0
        private void AddProduct(HttpContext context)
        {
            string text = context.Request["ids"];
            int    num  = 0;

            string[] array = text.Split(',');
            foreach (string text2 in array)
            {
                if (!string.IsNullOrEmpty(text2))
                {
                    HomeProductInfo info = new HomeProductInfo
                    {
                        ProductId = text2.ToInt(0)
                    };
                    if (VShopHelper.AddHomeProdcut(info))
                    {
                        num++;
                    }
                }
            }
            if (num > 0)
            {
                base.ReturnSuccessResult(context, "添加成功!", 0, true);
                return;
            }
            throw new HidistroAshxException("选择首页商品失败!");
        }
Ejemplo n.º 2
0
        public bool AddHomeProdcut(HomeProductInfo info)
        {
            bool   result      = false;
            string commandText = $"SELECT COUNT(1) FROM Vshop_HomeProducts WHERE ProductId={info.ProductId} ";

            if ((int)base.database.ExecuteScalar(CommandType.Text, commandText) == 0)
            {
                info.DisplaySequence = this.GetMaxDisplaySequence <HomeProductInfo>();
                result = (this.Add(info, null) > 0);
            }
            return(result);
        }
Ejemplo n.º 3
0
        private void SaveOrder(HttpContext context)
        {
            int value = base.GetIntParam(context, "Value", false).Value;

            if (value >= 0)
            {
                int             value2 = base.GetIntParam(context, "ProductId", false).Value;
                HomeProductInfo info   = new HomeProductInfo
                {
                    ProductId       = value2,
                    DisplaySequence = value
                };
                if (VShopHelper.UpdateHomeProductSequence(info))
                {
                    base.ReturnSuccessResult(context, "保存排序成功!", 0, true);
                    return;
                }
                throw new HidistroAshxException("修改排序失败!未知错误!");
            }
            throw new HidistroAshxException("错误的参数");
        }
Ejemplo n.º 4
0
        private void AddProduct(HttpContext context)
        {
            string      text = context.Request["ids"];
            IList <int> list = new List <int>();

            if (text.Length < 0)
            {
                throw new HidistroAshxException("错误的参数!");
            }
            string[] array = text.Split(',');
            foreach (string text2 in array)
            {
                if (!string.IsNullOrEmpty(text2))
                {
                    list.Add(text2.ToInt(0));
                }
            }
            int num = 0;

            string[] array2 = text.Split(',');
            foreach (string obj in array2)
            {
                HomeProductInfo info = new HomeProductInfo
                {
                    ProductId = obj.ToInt(0)
                };
                if (VShopHelper.AddHomeProdcut(info))
                {
                    num++;
                }
            }
            if (num > 0)
            {
                base.ReturnSuccessResult(context, "AppProductSetting.aspx", 0, true);
                return;
            }
            throw new HidistroAshxException("选择首页商品失败!");
        }