活动页面添加参赛作品瀑布流
[PumpkinHouse.git] / PumpkinHouseWeb / Account / MembershipProvider.cs
blob8a600b595b9887faf5c69ffea783b59ec06c69c6
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Web;
5 using System.Web.Security;
6 using PumpkinHouseDatabase;
7 using PumpkinHouse.Utils;
9 namespace PumpkinHouse
11 public class MembershipProvider : SqlMembershipProvider
13 public override bool ValidateUser(string email, string password)
15 string username = Helper.ValidateUser(email, password);
16 if (username != null)
18 string returnUrl = HttpContext.Current.Request.Params["ReturnUrl"];
19 HttpContext.Current.Session["username"] = username;
21 if (Roles.IsUserInRole(username, "locked"))
23 HttpContext.Current.Response.Redirect("/Account/AccountLocked.aspx");
24 return false;
26 else
28 return true;
31 return username != null;
34 public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
36 using (DataUtils utils = new DataUtils(false))
38 IQueryable<DB_User> users = utils.FindAllUsers();
39 totalRecords = users.Count();
40 IList<MembershipUser> result = users.Skip(pageSize * pageIndex).Take(pageSize).Select(u => new MembershipUser("AspNetSqlMembershipProvider",
41 u.Username,
42 u.Username,
43 u.Email,
44 "",
45 u.Self_Introduction,
46 true,
47 u.Is_Locked == 1,
48 DateTime.Now,
49 DateTime.Now,
50 DateTime.Now,
51 DateTime.Now,
52 DateTime.Now)).ToList();
53 MembershipUserCollection c = new MembershipUserCollection();
54 foreach (MembershipUser u in result)
56 c.Add(u);
58 return c;