Ejemplo n.º 1
0
        public SignInStatus ValidateLogin()
        {
            SignInStatus result = SignInStatus.Failure;

            ETAH.Account account = ETAH.Account.ExecuteCreateByEmail(this.email);

            if (account != null)
            {
                if (account.Status == ETAH.Account.STATUS_ACTIVE)
                {
                    if (account.Password.Equals(ETAH.AccountPasswordHasher.HashPassword(this.password, account.Salt)))
                    {
                        result = SignInStatus.Success;
                    }
                    else
                    {
                        result = SignInStatus.Failure;
                    }
                }
                else
                {
                    result = SignInStatus.Deactivated;
                }
            }
            else
            {
                result = SignInStatus.Failure;
            }

            return(result);
        }
Ejemplo n.º 2
0
 public EditViewModel(ETAH.Account account)
 {
     this.firstName       = account.FirstName;
     this.lastName        = account.LastName;
     this.email           = account.Email;
     this.contactNo       = account.ContactNo;
     this.shippingAddress = account.ShippingAddress;
     this.country         = account.Country;
     this.id = account.ID;
 }
Ejemplo n.º 3
0
        public OrderViewModel()
        {
            this.CheckPendingOrders();

            if (this.order != null)
            {
                this.id            = this.order.ID;
                this.accountID     = this.order.AccountID;
                this.dateCreated   = this.order.DateCreated;
                this.status        = this.order.Status;
                this.paymentMethod = this.order.PaymentMethod;
                this.totalAmount   = this.order.TotalAmount;
                this.orderItems    = ETC.OrderItem.ListByOrderID(this.id);
                this.user          = this.order.ExecuteCreateAccountByAccountID();
            }
        }
Ejemplo n.º 4
0
        public bool Save()
        {
            bool result = false;

            if (this.id != Constants.DEFAULT_VALUE_INT)
            {
                ETAH.Account account  = ETAH.Account.ExecuteCreate(this.id);
                string       password = ETAH.AccountPasswordHasher.HashPassword(this.currentPassword, account.Salt);

                if (account.Password.Equals(password))                 // If current password correct
                {
                    string salt      = String.Empty;
                    string hPassword = ETAH.AccountPasswordHasher.CreatePassword(this.newPassword, out salt);

                    account.UpdatePasswordSalt(hPassword, salt, Common.Session.Account.ID);

                    result = true;
                }
            }

            return(result);
        }
Ejemplo n.º 5
0
        public bool Save()
        {
            bool result = false;

            if (CheckEmailAsync(this.email))
            {
                string salt      = String.Empty;
                string hPassword = ETAH.AccountPasswordHasher.CreatePassword(Password, out salt);

                ETAH.Account newAccount = ETAH.Account.ExecuteCreate(
                    this.firstName,
                    this.lastName,
                    this.email,
                    hPassword,
                    salt,
                    this.contactNo,
                    this.shippingAddress,
                    this.country,
                    ETAH.Account.STATUS_ACTIVE,
                    (int)ETAH.Account.RoleCode.All,
                    SELF_REGISTERED,
                    SELF_REGISTERED);

                newAccount.Insert();

                if (newAccount.ID != Constants.DEFAULT_VALUE_INT)
                {
                    this.successMsg = Constants.MSG_REG_SUCCESS;
                    result          = true;
                }
            }
            else
            {
                this.modelError = Constants.MSG_REG_FAIL_EMAIL_EXIST;
            }

            return(result);
        }
Ejemplo n.º 6
0
        public bool Save()
        {
            bool result = false;

            ETAH.Account account    = ETAH.Account.ExecuteCreate(ID);
            ETAH.Account accByEmail = ETAH.Account.ExecuteCreateByEmail(Email);

            if (accByEmail == null || (account.Email == accByEmail.Email))
            {
                if (account != null)
                {
                    account.Update(
                        this.firstName,
                        this.lastName,
                        this.email,
                        this.contactNo,
                        this.shippingAddress,
                        this.country,
                        Common.Session.Account.Status,
                        Common.Session.Account.Role,
                        this.id);

                    this.successMsg = Constants.MSG_MANAGE_SUCCESS;
                    result          = true;
                }
                else
                {
                    this.modelError = Constants.MSG_MANAGE_FAIL;
                }
            }
            else
            {
                this.modelError = Constants.MSG_MANAGE_FAIL_EMAIL_EXIST;
            }

            return(result);
        }