/// <summary> /// 依据sql语句查询用户 /// </summary> /// <param name="safeSql"></param> /// <returns></returns> private static IList <User> GetUsersBySql(string safeSql) { List <User> list = new List <User>(); using (DataTable table = DBHelper.GetDataSet(safeSql)) { foreach (DataRow row in table.Rows) { User user = new User(); user.Id = (int)row["Id"]; user.LoginName = (string)row["LoginId"]; user.LoginPwd = (string)row["LoginPwd"]; user.Name = (string)row["Name"]; user.Address = (string)row["Address"]; user.Phone = (string)row["Phone"]; user.Mail = (string)row["Mail"]; user.UserState = UserStateService.GetUserStateById((int)row["UserStateId"]); //FK user.UserRole = UserRoleService.GetUserRoleById((int)row["UserRoleId"]); //FK list.Add(user); } return(list); } }
public static UserState GetUserStateById(int id) { return(UserStateService.GetUserStateById(id)); }
/// <summary> /// 根据Id获得UserState对象 /// </summary> /// <param name="id"></param> /// <returns></returns> public UserState GetUserStateById(int id) { return(uss.GetUserStateById(id)); }