public Credential Create(string userName, string passWord)
        {
            Credential credential = new Credential
            {
                UserName = userName,
                Password = passWord,
                IsSystemUser = false,
                FirstName = null,
                LastName = null
            };

            return Create(credential);
        }
        public Credential Create(string userName, string passWord, string firstName, string lastName)
        {
            Credential credential = new Credential
            {
                UserName = userName,
                Password = passWord,
                IsSystemUser = true,
                FirstName = firstName,
                LastName = lastName
            };

            return Create(credential);
        }
        public Credential Create(Credential credential)
        {
            //Set the new password
            HashAlgorithm algorithm = HashAlgorithm.Create("SHA-256");

            byte[] hash = algorithm.ComputeHash(Encoding.ASCII.GetBytes(credential.Password));

            credential.Password = Convert.ToBase64String(hash);

            this.CredentialRepository.Create(credential);

            return credential;
        }
        public bool Validate(string userName, string password, out Credential credential)
        {
            password = this.HashService.CreateHash(password);

            credential = this.CredentialRepository.GetByUserNameAndPassword(userName, password);

            return (credential != null);
        }
 public void SignIn(Credential credential, HttpResponseBase httpResponseBase)
 {
     this.CustomFormsAuthentication.SignIn(credential.CredentialsId, credential.UserName, credential.FirstName, credential.LastName, credential.IsSystemUser, httpResponseBase);
 }
 /// <summary>
 /// Create a new Credential object.
 /// </summary>
 /// <param name="credentialsId">Initial value of the CredentialsId property.</param>
 /// <param name="userName">Initial value of the UserName property.</param>
 /// <param name="password">Initial value of the Password property.</param>
 /// <param name="isSystemUser">Initial value of the IsSystemUser property.</param>
 public static Credential CreateCredential(global::System.Int32 credentialsId, global::System.String userName, global::System.String password, global::System.Boolean isSystemUser)
 {
     Credential credential = new Credential();
     credential.CredentialsId = credentialsId;
     credential.UserName = userName;
     credential.Password = password;
     credential.IsSystemUser = isSystemUser;
     return credential;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Credentials EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToCredentials(Credential credential)
 {
     base.AddObject("Credentials", credential);
 }