Exemplo n.º 1
0
 /// <summary>
 /// 编辑焦点广告图
 /// </summary>
 /// <param name="model">The model.</param>
 /// <returns></returns>
 public static bool EditFocusPic(FocusPicModel model)
 {
     using (var dal = FactoryDispatcher.FocusFactory())
     {
         if (model.ID > 0)
         {
             return(dal.UpdateFocusPic(model));
         }
         else
         {
             return(dal.AddFocusPic(model) > 0);
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 添加焦点广告图
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns>System.Int32.</returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public int AddFocusPic(FocusPicModel model)
        {
            string strSql = @"insert into BM_BannerManage(Type,Title,PicUrl,Description,IsEnable,Sort,LinkUrl) values(@Type,@Title,@PicUrl,@Description,@IsEnable,@Sort,@LinkUrl)";
            var    param  = new[] {
                new SqlParameter("@Title", model.Title),
                new SqlParameter("@PicUrl", model.PicUrl),
                new SqlParameter("@Description", model.Description),
                new SqlParameter("@IsEnable", model.IsEnable),
                new SqlParameter("@Sort", model.Sort),
                new SqlParameter("@LinkUrl", model.LinkUrl),
                new SqlParameter("@Type", model.Type)
            };

            return(DbHelperSQLP.ExecuteNonQuery(WebConfig.getConnectionString(), CommandType.Text, strSql, param));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 更新焦点广告图
        /// </summary>
        /// <param name="model">The model.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        /// <exception cref="System.NotImplementedException"></exception>
        public bool UpdateFocusPic(FocusPicModel model)
        {
            string strSql = @"update BM_BannerManage set 
                            Title = @Title,PicUrl = @PicUrl,Description = @Description,IsEnable = @IsEnable,Sort = @Sort,LinkUrl = @LinkUrl
                            where ID = @ID";
            var    param  = new[] {
                new SqlParameter("@Title", model.Title),
                new SqlParameter("@PicUrl", model.PicUrl),
                new SqlParameter("@Description", model.Description),
                new SqlParameter("@IsEnable", model.IsEnable),
                new SqlParameter("@Sort", model.Sort),
                new SqlParameter("@LinkUrl", model.LinkUrl),
                new SqlParameter("@ID", model.ID)
            };

            return(DbHelperSQLP.ExecuteNonQuery(WebConfig.getConnectionString(), CommandType.Text, strSql, param) > 0);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 编辑焦点广告图
        /// </summary>
        private void EditFocusPic()
        {
            FocusPicModel model = new FocusPicModel()
            {
                ID          = GetFormValue("focusid", 0),
                Title       = GetFormValue("focustitle", ""),
                LinkUrl     = GetFormValue("focuslinkurl", ""),
                PicUrl      = GetFormValue("focuspicurl", ""),
                Type        = GetFormValue("type", 0),
                IsEnable    = GetFormValue("focusenable", 0),
                Sort        = GetFormValue("focussort", 0),
                Description = GetFormValue("focusdescription", "")
            };

            if (FocusPicLogic.EditFocusPic(model))
            {
                json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.OK));
            }
            else
            {
                json = JsonHelper.JsonSerializer(new ResultModel(ApiStatusCode.操作失败));
            }
        }