Ejemplo n.º 1
0
 private void ShowInfo(int _id)
 {
     BLL.plugin_images_class   bll   = new BLL.plugin_images_class();
     Model.plugin_images_class model = bll.GetModel(_id);
     txtName.Text          = model.title;
     txtCallIndex.Text     = model.call_index;
     txtNum.Text           = model.num.ToString();
     txtHeight.Text        = model.height.ToString();
     txtWidth.Text         = model.width.ToString();
     txtSort.Text          = model.sort_id.ToString();
     rblHide.SelectedValue = model.is_lock.ToString();
 }
Ejemplo n.º 2
0
 /// <summary>
 /// 遍历插入图片尺寸
 /// </summary>
 private DataTable add_class_info(DataTable dt, Model.plugin_images_class model)
 {
     if (dt.Rows.Count > 0)
     {
         dt.Columns.Add("height", Type.GetType("System.Int32"));
         dt.Columns.Add("width", Type.GetType("System.Int32"));
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             dt.Rows[i]["height"] = model.height;
             dt.Rows[i]["width"]  = model.width;
         }
     }
     return(dt);
 }
Ejemplo n.º 3
0
 private bool DoEdit(int _id)
 {
     BLL.plugin_images_class   bll   = new BLL.plugin_images_class();
     Model.plugin_images_class model = bll.GetModel(_id);
     model.title      = txtName.Text.Trim();
     model.call_index = txtCallIndex.Text.Trim();
     model.num        = Utils.StrToInt(txtNum.Text.Trim(), 10);
     model.width      = Utils.StrToInt(txtWidth.Text.Trim(), 100);
     model.height     = Utils.StrToInt(txtHeight.Text.Trim(), 100);
     model.is_lock    = int.Parse(rblHide.SelectedValue);
     model.sort_id    = Utils.StrToInt(txtSort.Text, 99);
     if (bll.Update(model))
     {
         AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改广告橱窗位信息" + model.title); //记录日志
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 组合成对象实体
 /// </summary>
 /// <param name="row">一行数据</param>
 /// <returns>Model.plugin_images_class</returns>
 private Model.plugin_images_class DataRowToModel(DataRow row)
 {
     Model.plugin_images_class model = new Model.plugin_images_class();
     if (row != null)
     {
         if (null != row["id"] && "" != row["id"].ToString())
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (null != row["title"])
         {
             model.title = row["title"].ToString();
         }
         if (null != row["call_index"])
         {
             model.call_index = row["call_index"].ToString();
         }
         if (null != row["num"] && "" != row["num"].ToString())
         {
             model.num = int.Parse(row["num"].ToString());
         }
         if (null != row["width"] && "" != row["width"].ToString())
         {
             model.width = int.Parse(row["width"].ToString());
         }
         if (null != row["height"] && "" != row["height"].ToString())
         {
             model.height = int.Parse(row["height"].ToString());
         }
         if (null != row["sort_id"] && "" != row["sort_id"].ToString())
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (null != row["is_sys"] && "" != row["is_sys"].ToString())
         {
             model.is_sys = int.Parse(row["is_sys"].ToString());
         }
         if (null != row["is_lock"] && "" != row["is_lock"].ToString())
         {
             model.is_lock = int.Parse(row["is_lock"].ToString());
         }
     }
     return(model);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">Model.plugin_images_class</param>
        /// <returns>True or False</returns>
        public bool Update(Model.plugin_images_class model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [" + databaseprefix + "plugin_images_class] set ");
            strSql.Append("title=@title,");
            strSql.Append("call_index=@call_index,");
            strSql.Append("num=@num,");
            strSql.Append("width=@width,");
            strSql.Append("height=@height,");
            strSql.Append("sort_id=@sort_id,");
            strSql.Append("is_sys=@is_sys,");
            strSql.Append("is_lock=@is_lock");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",      SqlDbType.NVarChar, 100),
                new SqlParameter("@call_index", SqlDbType.NVarChar,  50),
                new SqlParameter("@num",        SqlDbType.Int,        4),
                new SqlParameter("@width",      SqlDbType.Int,        4),
                new SqlParameter("@height",     SqlDbType.Int,        4),
                new SqlParameter("@sort_id",    SqlDbType.Int,        4),
                new SqlParameter("@is_sys",     SqlDbType.TinyInt,    1),
                new SqlParameter("@is_lock",    SqlDbType.TinyInt,    1),
                new SqlParameter("@id",         SqlDbType.Int, 4)
            };
            parameters[0].Value = model.title;
            parameters[1].Value = model.call_index;
            parameters[2].Value = model.num;
            parameters[3].Value = model.width;
            parameters[4].Value = model.height;
            parameters[5].Value = model.sort_id;
            parameters[6].Value = model.is_sys;
            parameters[7].Value = model.is_lock;
            parameters[8].Value = model.id;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            return(false);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        /// <param name="model">Model.plugin_images_class</param>
        /// <returns>ID</returns>
        public int Add(Model.plugin_images_class model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into [" + databaseprefix + "plugin_images_class](");
            strSql.Append("title,call_index,num,width,height,sort_id,is_sys,is_lock");
            strSql.Append(") values(");
            strSql.Append("@title,@call_index,@num,@width,@height,@sort_id,@is_sys,@is_lock)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@title",      SqlDbType.NVarChar, 100),
                new SqlParameter("@call_index", SqlDbType.NVarChar,  50),
                new SqlParameter("@num",        SqlDbType.Int,        4),
                new SqlParameter("@width",      SqlDbType.Int,        4),
                new SqlParameter("@height",     SqlDbType.Int,        4),
                new SqlParameter("@sort_id",    SqlDbType.Int,        4),
                new SqlParameter("@is_sys",     SqlDbType.TinyInt,    1),
                new SqlParameter("@is_lock",    SqlDbType.TinyInt, 1)
            };
            parameters[0].Value = model.title;
            parameters[1].Value = model.call_index;
            parameters[2].Value = model.num;
            parameters[3].Value = model.width;
            parameters[4].Value = model.height;
            parameters[5].Value = model.sort_id;
            parameters[6].Value = model.is_sys;
            parameters[7].Value = model.is_lock;
            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (null != obj)
            {
                return(Convert.ToInt32(obj));
            }
            else
            {
                return(0);
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">Model.plugin_images_class</param>
 /// <returns>True Or False</returns>
 public bool Update(Model.plugin_images_class model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">Model.plugin_images_class</param>
 /// <returns>ID</returns>
 public int Add(Model.plugin_images_class model)
 {
     return(dal.Add(model));
 }