示例#1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(YueYePlat.Model.usercontrolinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update usercontrolinfo set ");
            strSql.Append("UserControlId=@UserControlId,");
            strSql.Append("UserControlName=@UserControlName");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@UserControlId",   MySqlDbType.VarChar,  20),
                new MySqlParameter("@UserControlName", MySqlDbType.VarChar, 300),
                new MySqlParameter("@Id",              MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.UserControlId;
            parameters[1].Value = model.UserControlName;
            parameters[2].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(YueYePlat.Model.usercontrolinfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into usercontrolinfo(");
            strSql.Append("UserControlId,UserControlName)");
            strSql.Append(" values (");
            strSql.Append("@UserControlId,@UserControlName)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@UserControlId",   MySqlDbType.VarChar, 20),
                new MySqlParameter("@UserControlName", MySqlDbType.VarChar, 300)
            };
            parameters[0].Value = model.UserControlId;
            parameters[1].Value = model.UserControlName;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public YueYePlat.Model.usercontrolinfo DataRowToModel(DataRow row)
 {
     YueYePlat.Model.usercontrolinfo model = new YueYePlat.Model.usercontrolinfo();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["UserControlId"] != null)
         {
             model.UserControlId = row["UserControlId"].ToString();
         }
         if (row["UserControlName"] != null)
         {
             model.UserControlName = row["UserControlName"].ToString();
         }
     }
     return(model);
 }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public YueYePlat.Model.usercontrolinfo GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id,UserControlId,UserControlName from usercontrolinfo ");
            strSql.Append(" where Id=@Id");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@Id", MySqlDbType.Int32)
            };
            parameters[0].Value = Id;

            YueYePlat.Model.usercontrolinfo model = new YueYePlat.Model.usercontrolinfo();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }