Exemple #1
0
        private bool DoAdd()
        {
            bool result = false;

            Model.article_spec model = new Model.article_spec();
            BLL.article_spec   bll   = new BLL.article_spec();

            model.channel_id = this.channel_id;
            model.title      = txtTitle.Text.Trim();
            model.remark     = txtRemark.Text.Trim();
            model.sort_id    = Utils.StrToInt(txtSortId.Text.Trim(), 99);

            #region 保存规格选项
            string[] itemIdArr     = Request.Form.GetValues("item_id");
            string[] itemTitleArr  = Request.Form.GetValues("item_title");
            string[] itemImgUrlArr = Request.Form.GetValues("item_imgurl");
            string[] itemSortIdArr = Request.Form.GetValues("item_sortid");
            if (itemIdArr != null && itemTitleArr != null && itemImgUrlArr != null && itemSortIdArr != null)
            {
                if ((itemIdArr.Length == itemTitleArr.Length) && (itemTitleArr.Length == itemImgUrlArr.Length) && (itemImgUrlArr.Length == itemSortIdArr.Length))
                {
                    List <Model.article_spec_value> ls = new List <Model.article_spec_value>();
                    for (int i = 0; i < itemIdArr.Length; i++)
                    {
                        Model.article_spec_value modelt = new Model.article_spec_value();
                        modelt.id      = Utils.StrToInt(itemIdArr[i].Trim(), 0);
                        modelt.title   = itemTitleArr[i].Trim();
                        modelt.img_url = itemImgUrlArr[i].Trim();
                        modelt.sort_id = Utils.StrToInt(itemSortIdArr[i].Trim(), 99);
                        ls.Add(modelt);
                    }
                    model.values = ls;
                }
            }
            #endregion

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加商品规格:" + model.title); //记录日志
                result = true;
            }
            return(result);
        }
        private bool DoAdd()
        {
            bool result = false;
            Model.article_spec model = new Model.article_spec();
            BLL.article_spec bll = new BLL.article_spec();

            model.title = txtTitle.Text.Trim();
            model.remark = txtRemark.Text.Trim();
            model.sort_id = Utils.StrToInt(txtSortId.Text.Trim(), 99);

            #region 保存规格选项
            string[] itemIdArr = Request.Form.GetValues("item_id");
            string[] itemTitleArr = Request.Form.GetValues("item_title");
            string[] itemImgUrlArr = Request.Form.GetValues("item_imgurl");
            string[] itemSortIdArr = Request.Form.GetValues("item_sortid");
            if (itemIdArr != null && itemTitleArr != null && itemImgUrlArr != null && itemSortIdArr != null)
            {
                if ((itemIdArr.Length == itemTitleArr.Length) && (itemTitleArr.Length == itemImgUrlArr.Length) && (itemImgUrlArr.Length == itemSortIdArr.Length))
                {
                    List<Model.article_spec_value> ls = new List<Model.article_spec_value>();
                    for (int i = 0; i < itemIdArr.Length; i++)
                    {
                        Model.article_spec_value modelt = new Model.article_spec_value();
                        modelt.id = Utils.StrToInt(itemIdArr[i].Trim(), 0);
                        modelt.title = itemTitleArr[i].Trim();
                        modelt.img_url = itemImgUrlArr[i].Trim();
                        modelt.sort_id = Utils.StrToInt(itemSortIdArr[i].Trim(), 99);
                        ls.Add(modelt);
                    }
                    model.values = ls;
                }
            }
            #endregion

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加商品规格:" + model.title); //记录日志
                result = true;
            }
            return result;
        }