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

            strSql.Append("update 管理员表 set ");
            strSql.Append("密码=@密码,");
            strSql.Append("身份=@身份,");
            strSql.Append("身份代码=@身份代码");
            strSql.Append(" where 账号=@账号 ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@密码",   SqlDbType.VarChar, 50),
                new SqlParameter("@身份",   SqlDbType.VarChar, 10),
                new SqlParameter("@身份代码", SqlDbType.VarChar, 10),
                new SqlParameter("@账号",   SqlDbType.VarChar, 20)
            };
            parameters[0].Value = model._user;
            parameters[1].Value = model._password;
            parameters[2].Value = model._status;
            parameters[3].Value = model._statusCode;

            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.Admin model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into 管理员表(");
            strSql.Append("账号,密码,身份,身份代码)");
            strSql.Append(" values (");
            strSql.Append("@账号,@密码,@身份,@身份代码)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@账号",   SqlDbType.VarChar, 20),
                new SqlParameter("@密码",   SqlDbType.VarChar, 50),
                new SqlParameter("@身份",   SqlDbType.VarChar, 10),
                new SqlParameter("@身份代码", SqlDbType.VarChar, 10)
            };
            parameters[0].Value = model._user;
            parameters[1].Value = model._password;
            parameters[2].Value = model._status;
            parameters[3].Value = model._statusCode;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public MUSE.Model.Admin DataRowToModel(DataRow row)
 {
     MUSE.Model.Admin model = new MUSE.Model.Admin();
     if (row != null)
     {
         if (row["账号"] != null)
         {
             model._user = row["账号"].ToString();
         }
         if (row["密码"] != null)
         {
             model._password = row["密码"].ToString();
         }
         if (row["身份"] != null)
         {
             model._status = row["身份"].ToString();
         }
         if (row["身份代码"] != null)
         {
             model._statusCode = row["身份代码"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public MUSE.Model.Admin GetModel(string 账号)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 账号,密码,身份,身份代码 from 管理员表 ");
            strSql.Append(" where 账号=@账号 ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@账号", SqlDbType.VarChar, 20)
            };
            parameters[0].Value = 账号;

            MUSE.Model.Admin model = new MUSE.Model.Admin();
            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.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(MUSE.Model.Admin model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(MUSE.Model.Admin model)
 {
     return(dal.Add(model));
 }