Example #1
0
 public bool Authenticate(AccountInfo info)
 {
     dal = new DAL();
     try
     {
         dal.OpenConnection();
         return dal.SpAuthenticateUser(info.userid, info.password);
     }
     catch (Exception ex)
     {
         throw new FaultException<AccountServiceFault>(new AccountServiceFault(ex.Message));
     }
     finally
     {
         dal.CloseConnection();
     }
 }
Example #2
0
 public bool CreateAccount(AccountInfo info)
 {
     dal = new DAL();
     try
     {
         dal.OpenConnection();
         if (dal.SpIsUserExists(info.userid) > 0)
         {
             return false;
         }
         dal.SpInsertUser(info);
         return true;
     }
     catch (Exception ex)
     {
         throw new FaultException<AccountServiceFault>(new AccountServiceFault(ex.Message));
     }
     finally
     {
         dal.CloseConnection();
     }
 }
Example #3
0
 public void SpInsertUser(AccountInfo info)
 {
     string encrptedPassword = EncryptDecrypt.Encrypt(info.password);
     try
     {
         using (SqlCommand cmd = new SqlCommand("InsertUser", sqlConnection))
         {
             cmd.CommandTimeout = Convert.ToInt32(ConfigurationManager.AppSettings["ConnectionTimeOut"]);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@userId", info.userid);
             cmd.Parameters.AddWithValue("@password", encrptedPassword);
             cmd.Parameters.AddWithValue("@firstName", info.firstname);
             cmd.Parameters.AddWithValue("@lastName", info.lastname);
             if (cmd.Connection.State == ConnectionState.Closed)
             {
                 cmd.Connection.Open();
             }
             cmd.ExecuteNonQuery();
         }
     }
     catch
     {
         throw;
     }
 }