Exemplo n.º 1
0
        private void ShowInfo(int _id)
        {
            BLL.lable   bll   = new BLL.lable();
            Model.lable model = bll.GetModel(_id);
            txtTitle.Text = model.title;
            txtName.Text  = model.call_index;
            txtName.Attributes.Add("ajaxurl", "../tools/ajax.ashx?action=validate&old_name=" + Utils.UrlEncode(model.call_index));
            txtName.Focus(); //设置焦点,防止JS无法提交
            txtSort.Text          = model.sort_id.ToString();
            rblHide.SelectedValue = model.is_lock.ToString();
            ddlType.SelectedValue = model.type.ToString();
            txtContent.Value      = model.content;

            contentType = model.type;
        }
Exemplo n.º 2
0
 private bool DoEdit(int _id)
 {
     BLL.lable   bll   = new BLL.lable();
     Model.lable model = bll.GetModel(_id);
     model.title      = txtTitle.Text;
     model.call_index = txtName.Text;
     model.is_lock    = int.Parse(rblHide.SelectedValue);
     model.sort_id    = int.Parse(txtSort.Text);
     model.type       = int.Parse(ddlType.SelectedValue);
     model.content    = txtContent.Value;
     if (bll.Update(model))
     {
         AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改标签内容:" + model.title); //记录日志
         return(true);
     }
     return(false);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 组合成对象实体
 /// </summary>
 /// <param name="row">一行数据</param>
 /// <returns>Model.lable</returns>
 private Model.lable DataRowToModel(DataRow row)
 {
     Model.lable model = new Model.lable();
     if (row != null)
     {
         if (null != row["id"] && "" != row["id"].ToString())
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (null != row["call_index"])
         {
             model.call_index = row["call_index"].ToString();
         }
         if (null != row["title"])
         {
             model.title = row["title"].ToString();
         }
         if (null != row["type"] && "" != row["type"].ToString())
         {
             model.type = int.Parse(row["type"].ToString());
         }
         if (null != row["sort_id"] && "" != row["sort_id"].ToString())
         {
             model.sort_id = int.Parse(row["sort_id"].ToString());
         }
         if (null != row["content"])
         {
             model.content = row["content"].ToString();
         }
         if (null != row["user_name"])
         {
             model.user_name = row["user_name"].ToString();
         }
         if (null != row["is_lock"] && "" != row["is_lock"].ToString())
         {
             model.is_lock = int.Parse(row["is_lock"].ToString());
         }
         if (null != row["add_time"] && "" != row["add_time"].ToString())
         {
             model.add_time = DateTime.Parse(row["add_time"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        /// <param name="model">Model.lable</param>
        /// <returns>True or False</returns>
        public bool Update(Model.lable model)
        {
            StringBuilder strSql = new StringBuilder();

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

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

            strSql.Append("insert into [" + databaseprefix + "lable](");
            strSql.Append("call_index,title,type,sort_id,content,user_name,is_lock,add_time");
            strSql.Append(") values(");
            strSql.Append("@call_index,@title,@type,@sort_id,@content,@user_name,@is_lock,@add_time)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@call_index", SqlDbType.NVarChar,  50),
                new SqlParameter("@title",      SqlDbType.NVarChar, 100),
                new SqlParameter("@type",       SqlDbType.TinyInt,    1),
                new SqlParameter("@sort_id",    SqlDbType.Int,        4),
                new SqlParameter("@content",    SqlDbType.NText),
                new SqlParameter("@user_name",  SqlDbType.NVarChar, 100),
                new SqlParameter("@is_lock",    SqlDbType.TinyInt,    1),
                new SqlParameter("@add_time",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.call_index;
            parameters[1].Value = model.title;
            parameters[2].Value = model.type;
            parameters[3].Value = model.sort_id;
            parameters[4].Value = model.content;
            parameters[5].Value = model.user_name;
            parameters[6].Value = model.is_lock;
            parameters[7].Value = model.add_time;
            object obj = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (null != obj)
            {
                return(Convert.ToInt32(obj));
            }
            else
            {
                return(0);
            }
        }
Exemplo n.º 6
0
        private bool DoAdd()
        {
            BLL.lable   bll   = new BLL.lable();
            Model.lable model = new Model.lable();

            model.title      = txtTitle.Text;
            model.call_index = txtName.Text;
            model.is_lock    = int.Parse(rblHide.SelectedValue);
            model.sort_id    = int.Parse(txtSort.Text);
            model.type       = Utils.StrToInt(ddlType.SelectedValue, 0);
            model.content    = txtContent.Value;
            model.add_time   = DateTime.Now;
            //管理员
            DTcms.Model.manager adminModel = GetAdminInfo();
            model.user_name = adminModel.real_name;

            if (bll.Add(model) > 0)
            {
                AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "添加标签内容:" + model.title); //记录日志
                return(true);
            }
            return(false);
        }
Exemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 /// <param name="model">Model.lable</param>
 /// <returns>True Or False</returns>
 public bool Update(Model.lable model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 /// <param name="model">Model.lable</param>
 /// <returns>ID</returns>
 public int Add(Model.lable model)
 {
     return(dal.Add(model));
 }