Ejemplo n.º 1
0
 public void DataUpdate(int id)
 {
     Cms.Model.C_product model = new Cms.BLL.C_product().GetModel(id);
     #region 基本信息
     model.id          = id;
     model.typeId      = Convert.ToInt32(this.parentId.SelectedValue); //所属栏目、分类ID
     model.isHidden    = Convert.ToInt32(this.isHidden.SelectedValue); //显示状态
     model.isTop       = 0;                                            //0 不置顶
     model.isRecommend = 0;                                            //0 不推荐
     model.isHot       = 0;                                            //不属于热门
     model.isActive    = 0;
     if (cblItem.Items[0].Selected == true)
     {
         model.isTop = 1;//1 置顶
     }
     if (cblItem.Items[1].Selected == true)
     {
         model.isRecommend = 1;//1 推荐
     }
     if (cblItem.Items[2].Selected == true)
     {
         model.isHot = 1;//1 属于热门
     }
     if (cblItem.Items[3].Selected == true)
     {
         model.isActive = 1;              //1 属于评论
     }
     model.name = this.Title.Text.Trim(); //标题
     if (this.photoUrl.Text == "")
     {
         model.litpic = "/img/noPic.jpg";
     }
     else
     {
         model.litpic = this.photoUrl.Text;                                 //缩略图
     }
     model.sortId          = Convert.ToInt32(this.orderNumber.Text.Trim()); //排序
     model.views           = Convert.ToInt32(this.hits.Text.Trim());        //浏览次数
     model.createdTime     = Utils.StrToDateTime(updateTime.Text.Trim());   //添加时间
     model.intro           = this.intro.Text;                               //简介
     model.content         = this.content.Value;                            //内容
     model.seoTitle        = this.seoTitle.Text.Trim();                     //SEO标题
     model.seoKeyword      = this.seoKeyword.Text.Trim();                   //SEO关健字
     model.seoDescription  = this.seoDescription.Text.Trim();               //SEO描述
     model.sales           = Convert.ToInt32(sales.Text.Trim());
     model.price           = Convert.ToDecimal(price.Text.Trim());
     model.marketPrice     = Convert.ToDecimal(marketPrice.Text.Trim());
     model.integral        = Convert.ToInt32(integral.Text);
     model.stock           = Convert.ToInt32(stock.Text);
     model.unit            = unit.Text;
     model.sVersion        = Convert.ToInt32(0);
     model.manufactureDate = manufactureDate.Text;
     model.factoryName     = factoryName.Text;
     model.factoryAddress  = factoryAddress.Text;
     model.ingredients     = ingredients.Text;
     #endregion
     if (new Cms.BLL.C_product().Update(model))
     {
         adminUser.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), model.name); //记录日志
         #region 保存相册====================
         int cout = Cms.DBUtility.DbHelperSQL.ExecuteSql("delete from c_product_albums where productId=" + model.id);
         //检查是否有自定义图片
         if (photoUrl.Text.Trim() == "")
         {
             model.litpic = hidFocusPhoto.Value;
         }
         string[] albumArr  = Request.Form.GetValues("hid_photo_name");
         string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
         if (albumArr != null && albumArr.Length > 0)
         {
             List <Cms.Model.c_product_albums> ls          = new List <Cms.Model.c_product_albums>();
             Cms.Model.c_product_albums        modelAlbums = new Cms.Model.c_product_albums();
             for (int i = 0; i < albumArr.Length; i++)
             {
                 string[] imgArr = albumArr[i].Split('|');
                 if (imgArr.Length == 3)
                 {
                     modelAlbums.original_path = imgArr[1];
                     modelAlbums.thumb_path    = imgArr[2];
                     if (!string.IsNullOrEmpty(remarkArr[i]))
                     {
                         modelAlbums.remark = remarkArr[i];
                     }
                     else
                     {
                     }
                     modelAlbums.productId = model.id;
                 }
                 new Cms.BLL.c_product_albums().Add(modelAlbums);
             }
         }
         #endregion
         JscriptMsg("修改信息成功!", "list.aspx", "Success");
     }
     else
     {
         JscriptMsg("修改信息失败!", "edit.aspx?action=edit", "Error");
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Cms.Model.c_product_albums model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 3
0
    public void DataAdd()
    {
        Cms.Model.C_integral_product model = new Cms.Model.C_integral_product();
        #region 基本信息
        model.typeId      = Convert.ToInt32(this.parentId.SelectedValue); //所属栏目、分类ID
        model.isHidden    = Convert.ToInt32(this.isHidden.SelectedValue); //显示状态
        model.isTop       = 0;                                            //0 不置顶
        model.isRecommend = 0;                                            //0 不推荐
        model.isHot       = 0;                                            //不属于热门
        model.isActive    = 0;
        if (cblItem.Items[0].Selected == true)
        {
            model.isTop = 1;//1 置顶
        }
        if (cblItem.Items[1].Selected == true)
        {
            model.isRecommend = 1;//1 推荐
        }
        if (cblItem.Items[2].Selected == true)
        {
            model.isHot = 1;//1 属于热门
        }
        if (cblItem.Items[3].Selected == true)
        {
            model.isActive = 1;//1 属于评论
        }

        model.name = this.Title.Text.Trim();//标题
        if (this.photoUrl.Text == "")
        {
            model.litpic = "/img/noPic.jpg";
        }
        else
        {
            model.litpic = this.photoUrl.Text;                           //缩略图
        }
        model.sortId = Convert.ToInt32(this.orderNumber.Text.Trim());    //排序

        model.createdTime = Utils.StrToDateTime(updateTime.Text.Trim()); //添加时间
        model.intro       = this.intro.Text;                             //简介
        model.content     = this.content.Value;                          //内容

        model.sales          = Convert.ToInt32(sales.Text.Trim());
        model.price          = Convert.ToDecimal(price.Text.Trim());
        model.marketPrice    = Convert.ToDecimal(marketPrice.Text.Trim());
        model.integral       = Convert.ToInt32(integral.Text);
        model.stock          = Convert.ToInt32(stock.Text);
        model.marketIntegral = Convert.ToInt32(marketIntegral.Text);
        model.comments       = 0;
        model.favorableRate  = "0";
        model.starTime       = Utils.StrToDateTime(starTime.Text.Trim());
        model.typeId         = Convert.ToInt32(this.typeId.SelectedValue);
        model.limitNumber    = Convert.ToInt32(this.limitNumber.Text);
        #endregion
        int result = new Cms.BLL.C_integral_product().Add(model);
        if (result > 0)
        {
            adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), model.name); //记录日志
            #region 保存相册====================
            //检查是否有自定义图片
            if (photoUrl.Text.Trim() == "")
            {
                model.litpic = hidFocusPhoto.Value;
            }
            string[] albumArr  = Request.Form.GetValues("hid_photo_name");
            string[] remarkArr = Request.Form.GetValues("hid_photo_remark");
            if (albumArr != null && albumArr.Length > 0)
            {
                List <Cms.Model.c_product_albums> ls          = new List <Cms.Model.c_product_albums>();
                Cms.Model.c_product_albums        modelAlbums = new Cms.Model.c_product_albums();
                for (int i = 0; i < albumArr.Length; i++)
                {
                    string[] imgArr = albumArr[i].Split('|');
                    if (imgArr.Length == 3)
                    {
                        modelAlbums.original_path = imgArr[1];
                        modelAlbums.thumb_path    = imgArr[2];
                        if (!string.IsNullOrEmpty(remarkArr[i]))
                        {
                            modelAlbums.remark = remarkArr[i];
                        }
                        else
                        {
                        }
                        modelAlbums.productId = result;
                    }
                    new Cms.BLL.c_product_albums().Add(modelAlbums);
                }
            }
            #endregion
            JscriptMsg("添加信息成功!", "integralList.aspx", "Success");
        }
        else
        {
            JscriptMsg("添加信息失败!", "edit.aspx?action=add", "Error");
        }
    }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Cms.Model.c_product_albums model)
 {
     return(dal.Add(model));
 }