示例#1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(LingLong.Admin.Model.dt_manager_log model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dt_manager_log(");
            strSql.Append("user_id,user_name,action_type,remark,user_ip,add_time)");
            strSql.Append(" values (");
            strSql.Append("@user_id,@user_name,@action_type,@remark,@user_ip,@add_time)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@user_id",     MySqlDbType.Int32,    11),
                new MySqlParameter("@user_name",   MySqlDbType.VarChar, 100),
                new MySqlParameter("@action_type", MySqlDbType.VarChar, 100),
                new MySqlParameter("@remark",      MySqlDbType.VarChar, 255),
                new MySqlParameter("@user_ip",     MySqlDbType.VarChar,  30),
                new MySqlParameter("@add_time",    MySqlDbType.DateTime)
            };
            parameters[0].Value = model.user_id;
            parameters[1].Value = model.user_name;
            parameters[2].Value = model.action_type;
            parameters[3].Value = model.remark;
            parameters[4].Value = model.user_ip;
            parameters[5].Value = model.add_time;

            int rows = DbHelperMySql.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(LingLong.Admin.Model.dt_manager_log model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dt_manager_log set ");
            strSql.Append("user_id=@user_id,");
            strSql.Append("user_name=@user_name,");
            strSql.Append("action_type=@action_type,");
            strSql.Append("remark=@remark,");
            strSql.Append("user_ip=@user_ip,");
            strSql.Append("add_time=@add_time");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@user_id",     MySqlDbType.Int32,      11),
                new MySqlParameter("@user_name",   MySqlDbType.VarChar,   100),
                new MySqlParameter("@action_type", MySqlDbType.VarChar,   100),
                new MySqlParameter("@remark",      MySqlDbType.VarChar,   255),
                new MySqlParameter("@user_ip",     MySqlDbType.VarChar,    30),
                new MySqlParameter("@add_time",    MySqlDbType.DateTime),
                new MySqlParameter("@id",          MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.user_id;
            parameters[1].Value = model.user_name;
            parameters[2].Value = model.action_type;
            parameters[3].Value = model.remark;
            parameters[4].Value = model.user_ip;
            parameters[5].Value = model.add_time;
            parameters[6].Value = model.id;

            int rows = DbHelperMySql.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public LingLong.Admin.Model.dt_manager_log DataRowToModel(DataRow row)
 {
     LingLong.Admin.Model.dt_manager_log model = new LingLong.Admin.Model.dt_manager_log();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["user_id"] != null && row["user_id"].ToString() != "")
         {
             model.user_id = int.Parse(row["user_id"].ToString());
         }
         if (row["user_name"] != null)
         {
             model.user_name = row["user_name"].ToString();
         }
         if (row["action_type"] != null)
         {
             model.action_type = row["action_type"].ToString();
         }
         if (row["remark"] != null)
         {
             model.remark = row["remark"].ToString();
         }
         if (row["user_ip"] != null)
         {
             model.user_ip = row["user_ip"].ToString();
         }
         if (row["add_time"] != null && row["add_time"].ToString() != "")
         {
             model.add_time = DateTime.Parse(row["add_time"].ToString());
         }
     }
     return(model);
 }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public LingLong.Admin.Model.dt_manager_log GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select id,user_id,user_name,action_type,remark,user_ip,add_time from dt_manager_log ");
            strSql.Append(" where id=@id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@id", MySqlDbType.Int32)
            };
            parameters[0].Value = id;

            LingLong.Admin.Model.dt_manager_log model = new LingLong.Admin.Model.dt_manager_log();
            DataSet ds = DbHelperMySql.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LingLong.Admin.Model.dt_manager_log model)
 {
     return(dal.Update(model));
 }
示例#6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(LingLong.Admin.Model.dt_manager_log model)
 {
     return(dal.Add(model));
 }