/// <summary> /// 登录并获取会员信息 /// </summary> /// <param name="userName">用户名、Email、手机</param> /// <param name="loginpwd">密码</param> /// <returns></returns> public static UserEntity UserLogin(string userName, string loginpwd) { loginpwd = DESEncrypt.GetEncryptionPwd(loginpwd); DataTable dt = new UserDAL().UserLogin(userName, loginpwd); UserEntity model = null; if (dt.Rows.Count > 0) { model = new UserEntity(); model.FillData(dt.Rows[0]); } return model; }
/// <summary> /// 获取会员信息 /// </summary> /// <param name="userid">会员ID</param> /// <returns></returns> public static UserEntity GetUserByUserID(string userid) { DataTable dt = new UserDAL().GetUserByUserID(userid); UserEntity model = new UserEntity(); if (dt.Rows.Count > 0) { model.FillData(dt.Rows[0]); } return model; }
/// <summary> /// 获取会员列表(分页) /// </summary> /// <param name="keywords">关键词</param> /// <param name="pageSize">页size</param> /// <param name="index">页码</param> /// <param name="total">返回总记录数</param> /// <param name="pages">返回总页数</param> /// <returns></returns> public static List<Entity.UserEntity> GetUsers(string keywords, int pageSize, int index, UserType type, out int total, out int pages) { List<Entity.UserEntity> list = new List<Entity.UserEntity>(); string table = "Users "; string columns = " * "; StringBuilder build = new StringBuilder(); build.Append(" Status != 9 and UserType=" + (int)type); if (keywords != "") { build.Append(" and (Name like '%" + keywords + "%' or UserName like '%" + keywords + "%')"); } DataTable dt = CommonBusiness.GetPagerData(table, columns, build.ToString(), "ID", pageSize, index, out total, out pages); foreach (DataRow dr in dt.Rows) { UserEntity model = new UserEntity(); model.FillData(dr); list.Add(model); } return list; }
/// <summary> /// 获取教师列表 /// </summary> /// <returns></returns> public static List<Entity.UserEntity> GetTeachers() { List<Entity.UserEntity> list = new List<Entity.UserEntity>(); DataTable dt = new UserDAL().GetTeachers(); foreach (DataRow dr in dt.Rows) { UserEntity model = new UserEntity(); model.FillData(dr); list.Add(model); } return list; }