Ejemplo n.º 1
0
        //查询所有用户
        public static IList <Users> GetUsersAll()
        {
            IList <Users> list  = new List <Users>();
            string        sql   = "select * from Users";
            DataTable     table = DBHelper.GetDataSet(sql);

            foreach (DataRow row in table.Rows)
            {
                Users us = new Users();
                us.Id       = (int)row["Id"];
                us.LoginId  = (string)row["LoginId"];
                us.LoginPwd = (string)row["LoginPwd"];
                us.Name     = (string)row["Name"];
                us.Address  = (string)row["Address"];
                us.Phone    = (string)row["Phone"];
                us.Mail     = (string)row["Mail"];

                us.UserStates = UserStateService.GetUserStateById((int)row["UserStateId"]); //FK
                us.UserRoles  = UserRoleService.GetUserRoleById((int)row["UserRoleId"]);    //FK

                list.Add(us);
            }
            return(list);
        }