Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static bool AddClientUser(FoodSafety.Model.sys_client_user model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into sys_client_user(");
            strSql.Append("userId,userName,userPassword,deptId,cdate,roleId,cuserId,expired)");
            strSql.Append(" values (");
            strSql.Append("@userId,@userName,@userPassword,@deptId,@cdate,@roleId,@cuserId,@expired)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@userId",       MySqlDbType.VarChar,   50),
                new MySqlParameter("@userName",     MySqlDbType.VarChar,   50),
                new MySqlParameter("@userPassword", MySqlDbType.VarChar,    1),
                new MySqlParameter("@deptId",       MySqlDbType.VarChar,   50),
                new MySqlParameter("@cdate",        MySqlDbType.DateTime),
                new MySqlParameter("@roleId",       MySqlDbType.VarChar,   50),
                new MySqlParameter("@cuserId",      MySqlDbType.VarChar,   50),
                new MySqlParameter("@expired",      MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.userId;
            parameters[1].Value = model.userName;
            parameters[2].Value = model.userPassword;
            parameters[3].Value = model.deptId;
            parameters[4].Value = model.cdate;
            parameters[5].Value = model.roleId;
            parameters[6].Value = model.cuserId;
            parameters[7].Value = model.expired;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        public static DataTable  GetUserModel(FoodSafety.Model.sys_client_user loginUser)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,userId,UserName,UserPassword,expired from sys_client_user ");
            strSql.Append(" where userId=@userId and UserPassword=@Password");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@userId",   MySqlDbType.VarChar, 20),
                new MySqlParameter("@Password", MySqlDbType.VarChar, 50)
            };
            parameters[0].Value = loginUser.userId;
            parameters[1].Value = loginUser.userPassword;


            try
            {
                return(DbHelperMySQL.CreateDbHelper().GetDataSet(strSql.ToString(), parameters).Tables[0]);
            }
            catch (Exception)
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
 public static DataTable GetUserModel(FoodSafety.Model.sys_client_user loginUser)
 {
     return(Sys_client_userDal.GetUserModel(loginUser));
 }
Ejemplo n.º 4
0
 public static bool AddClientUser(FoodSafety.Model.sys_client_user model)
 {
     return(Sys_client_userDal.AddClientUser(model));
 }