예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">Model.plugin_images</param>
        /// <returns>ID</returns>
        public int Add(Model.plugin_images model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [" + databaseprefix + "plugin_images](");
            strSql.Append("class_id,title,target,img_url,link_url,content,sort_id,back_color,is_lock,add_time,is_type,icon_url");
            strSql.Append(") values(");
            strSql.Append("@class_id,@title,@target,@img_url,@link_url,@content,@sort_id,@back_color,@is_lock,@add_time,@is_type,@icon_url)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@class_id",   SqlDbType.Int,         4),
                new SqlParameter("@title",      SqlDbType.NVarChar,  255),
                new SqlParameter("@target",     SqlDbType.NVarChar,   20),
                new SqlParameter("@img_url",    SqlDbType.NVarChar,  255),
                new SqlParameter("@link_url",   SqlDbType.NVarChar,  255),
                new SqlParameter("@content",    SqlDbType.NText),
                new SqlParameter("@sort_id",    SqlDbType.Int,         4),
                new SqlParameter("@back_color", SqlDbType.NVarChar,   20),
                new SqlParameter("@is_lock",    SqlDbType.TinyInt,     1),
                new SqlParameter("@add_time",   SqlDbType.DateTime),
                new SqlParameter("@is_type",    SqlDbType.TinyInt,     1),
                new SqlParameter("@icon_url",   SqlDbType.NVarChar, 255)
            };
            parameters[0].Value  = model.class_id;
            parameters[1].Value  = model.title;
            parameters[2].Value  = model.target;
            parameters[3].Value  = model.img_url;
            parameters[4].Value  = model.link_url;
            parameters[5].Value  = model.content;
            parameters[6].Value  = model.sort_id;
            parameters[7].Value  = model.back_color;
            parameters[8].Value  = model.is_lock;
            parameters[9].Value  = model.add_time;
            parameters[10].Value = model.is_type;
            parameters[11].Value = model.icon_url;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (null != obj)
            {
                return(Convert.ToInt32(obj));
            }
            else
            {
                return(0);
            }
        }
예제 #2
0
 private bool DoEdit(int _id)
 {
     BLL.plugin_images   bll   = new BLL.plugin_images();
     Model.plugin_images model = bll.GetModel(_id);
     model.title      = txtName.Text;
     model.link_url   = txtUrl.Text;
     model.img_url    = txtImgUrl.Text;
     model.target     = rblTarget.SelectedValue;
     model.is_lock    = int.Parse(rblHide.SelectedValue);
     model.sort_id    = Utils.StrToInt(txtSort.Text, 99);
     model.back_color = txtColor.Text;
     model.is_type    = Utils.StrToInt(ddlType.SelectedValue, 0);
     model.content    = txtContent.Value;
     model.class_id   = Utils.StrToInt(ddlClassId.SelectedValue, 0);
     model.img_url    = txtImgUrl.Text.Trim();
     model.icon_url   = txtIconUrl.Text.Trim();
     if (bll.Update(model))
     {
         AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改橱窗内容:" + model.title);
         return(true);
     }
     return(false);
 }
예제 #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">Model.plugin_images</param>
 /// <returns>True Or False</returns>
 public bool Update(Model.plugin_images model)
 {
     return(dal.Update(model));
 }
예제 #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">Model.plugin_images</param>
 /// <returns>ID</returns>
 public int Add(Model.plugin_images model)
 {
     return(dal.Add(model));
 }