Пример #1
0
 public bool CheckAdminPasswordByLogin(string login, string password)
 {
     BL.Modules.Users.UserRoles ubl = new BL.Modules.Users.UserRoles();
     BL.Helpers.MD5CryptoServiceProvider md5 = new Helpers.MD5CryptoServiceProvider();
     BL.User user = db.Users.Where(u => (u.Password == md5.getMd5Hash(password)) && (u.Email == login || u.Login == login) && u.IsActive && u.UserRoleID == ubl.Admin).FirstOrDefault();
     return (user == null);
 }
Пример #2
0
 /// <summary>
 /// Registration User, Send Mail With ConfirmI
 /// </summary>
 /// <param name="login"></param>
 /// <param name="email"></param>
 /// <param name="password"></param>
 /// <param name="usersProperties"></param>
 public void RegisterUser(string login, string email, string password)
 {
     BL.User user = new BL.User();
     BL.Helpers.MD5CryptoServiceProvider md5 = new BL.Helpers.MD5CryptoServiceProvider();
     BL.Modules.Users.UserRoles userRoles = new BL.Modules.Users.UserRoles();
     BL.Modules.Users.UserRights userRights = new BL.Modules.Users.UserRights();
     Guid ConfirmationId = Guid.NewGuid();
     using (var ts = new TransactionScope())
     {
         user.UserID = Guid.NewGuid();
         user.Login = login;
         user.Email = email;
         user.Password = md5.getMd5Hash(password);
         user.IsActive = false;
         user.ConfirmationID = ConfirmationId;
         user.UserRoleID = userRoles.User;
         user.UserRightID = userRights.Read;
         db.Users.InsertOnSubmit(user);
         db.SubmitChanges();
         ts.Complete();
     }
     BL.Modules.Mail.Mail.Registration(user);
 }