Beispiel #1
0
 public void Insert(Entities.UsersPassword obj)
 {
     obj.ConfirmPassword = obj.Password;
     obj.Created         = DateTime.Now;
     obj.Modifed         = null;
     obj.Active          = true;
     repository.Insert(obj);
 }
Beispiel #2
0
        public int Login(Entities.UsersPassword obj)
        {
            // var b = true;
            var user =
                Select()
                .Where(x => x.User.Email == obj.User.Email.ToLower() && x.Password == obj.Password && x.User.Active)
                .FirstOrDefault();

            return(user != null ? user.Uid : 0);
        }
Beispiel #3
0
        public void Create(Entities.User obj)
        {
            // transaction scope
            using (var trans = new System.Transactions.TransactionScope())
            {
                // insert into Users
                Insert(obj);

                // UsersRole object
                Entities.UsersRole objUsersRole = new UsersRole();
                objUsersRole.RoleId = obj.RoleId;
                objUsersRole.Uid    = obj.Uid;

                // insert into UsersRole
                Rent.Business.Services.UserRole userRole = new UserRole();
                userRole.Insert(objUsersRole);

                // UsersPassword object
                Entities.UsersPassword objUsersPassword = new Entities.UsersPassword();
                objUsersPassword.Uid      = obj.Uid;
                objUsersPassword.Password = obj.UsersPassword.Password;

                // insert into UsersPassword
                Rent.Business.Services.UsersPassword usersPassword = new UsersPassword();
                usersPassword.Insert(objUsersPassword);

                // UsersNotification object
                Entities.UsersNotification objUsersNotification = new UsersNotification();
                objUsersNotification.Uid = obj.Uid;

                // insert into UsersNotification
                Rent.Business.Services.UserNotification userNotification = new UserNotification();
                userNotification.Insert(objUsersNotification);

                // into into UserAccessCode
                Rent.Business.Interfaces.IUserAccess iUserAccess = new UserAcess();
                iUserAccess.Insert(Rent.Common.Helper.Generator.AccessCode(), obj.Uid);

                // UsersManager
                if (obj.ManagerId > 0)
                {
                    Rent.Entities.UsersManager objUsersManager = new UsersManager();
                    objUsersManager.ManagerId = (int)obj.ManagerId;
                    objUsersManager.Uid       = obj.Uid;

                    // into into UsersUsersManager
                    Rent.Business.Interfaces.IUserManager iUserManager = new UserManager();
                    iUserManager.Insert(objUsersManager);
                }

                // commit transaction
                trans.Complete();
            }
        }
Beispiel #4
0
 public void Update(Entities.UsersPassword obj)
 {
     obj.ConfirmPassword = obj.Password;
     obj.Modifed         = DateTime.Now;
     repository.Update(obj);
 }