Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(MUSE.Model.membership model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update membership set ");
            strSql.Append("用户名=@用户名,");
            strSql.Append("密码=@密码,");
            strSql.Append("用户类型=@用户类型");
            strSql.Append(" where 用户名=@用户名 and 密码=@密码 and 用户类型=@用户类型 ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@用户名",  SqlDbType.VarChar, 20),
                new SqlParameter("@密码",   SqlDbType.VarChar, 50),
                new SqlParameter("@用户类型", SqlDbType.VarChar, 6)
            };
            parameters[0].Value = model.user;
            parameters[1].Value = model.password;
            parameters[2].Value = model.userType;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(MUSE.Model.membership model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into membership(");
            strSql.Append("用户名,密码,用户类型)");
            strSql.Append(" values (");
            strSql.Append("@用户名,@密码,@用户类型)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@用户名",  SqlDbType.VarChar, 20),
                new SqlParameter("@密码",   SqlDbType.VarChar, 50),
                new SqlParameter("@用户类型", SqlDbType.VarChar, 6)
            };
            parameters[0].Value = model.user;
            parameters[1].Value = model.password;
            parameters[2].Value = model.userType;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MUSE.Model.membership GetModel(string 用户名, string 密码, string 用户类型)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 用户名,密码,用户类型 from membership ");
            strSql.Append(" where 用户名=@用户名 and 密码=@密码 and 用户类型=@用户类型 ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@用户名",  SqlDbType.VarChar, 20),
                new SqlParameter("@密码",   SqlDbType.VarChar, 50),
                new SqlParameter("@用户类型", SqlDbType.VarChar, 6)
            };
            parameters[0].Value = 用户名;
            parameters[1].Value = 密码;
            parameters[2].Value = 用户类型;

            MUSE.Model.membership model = new MUSE.Model.membership();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MUSE.Model.membership DataRowToModel(DataRow row)
 {
     MUSE.Model.membership model = new MUSE.Model.membership();
     if (row != null)
     {
         if (row["用户名"] != null)
         {
             model.user = row["用户名"].ToString();
         }
         if (row["密码"] != null)
         {
             model.password = row["密码"].ToString();
         }
         if (row["用户类型"] != null)
         {
             model.userType = row["用户类型"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(MUSE.Model.membership model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(MUSE.Model.membership model)
 {
     return(dal.Add(model));
 }