Exemplo n.º 1
0
 void SaveBtn_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (Email.Text.Length == 0)
         AlertMessage("Please enter an email address.");
     else if (CreditCard.Text.Length == 0)
         AlertMessage("Please enter a credit card number.");
     else if (Address.Text.Length == 0)
         AlertMessage("Please enter an address.");
     else if (Name.Text.Length == 0)
         AlertMessage("Please enter your full name.");
     else if (Password.Password.Length == 0)
         AlertMessage("Please enter a password.");
     else if (!Password.Password.Equals(Confirm.Password))
         AlertMessage("Passwords do not match.");
     else
     {
         try
         {
             AccountProfileDataModel serviceLayerCustomerProfile = new AccountProfileDataModel(Login.UserInfo.profileID, Password.Password, Name.Text, Address.Text, Email.Text, CreditCard.Text);
             serviceLayerCustomerProfile = App.BSL.updateAccountProfile(serviceLayerCustomerProfile);
             AlertMessage("Account updated.");
             Update.Text = "as of " + DateTime.Now;
         }
         catch (Exception ex)
         {
             AlertMessage("Failed to update account - " + ex.Message);
         }
     }
 }
 /// <summary>
 /// Updates account profile data for a user. 
 /// </summary>
 /// <param name="profileData">Profile data model class with updated info.</param>
 public AccountProfileDataModel updateAccountProfile(AccountProfileDataModel profileData)
 {
     try
     {
         return this.Channel.updateAccountProfile(profileData);
     }
     catch
     {
         this.Channel = null;
         throw;
     }
 }
Exemplo n.º 3
0
 public AccountProfileDataModel update(AccountProfileDataModel customerprofile, bool useSaltedHash)
 {
     try
     {
         // Get the paramters from the cache
         OracleParameter[] ProfileParms = GetUpdateAccountProfileParameters();
         string salt = " ";
         if (useSaltedHash)
         {
             SaltedHash sh = SaltedHash.Create(customerprofile.password);
             salt = sh.Salt;
             string hash = sh.Hash;
             customerprofile.password = hash;
         }
         ProfileParms[0].Value = customerprofile.address;
         ProfileParms[1].Value = salt;
         ProfileParms[2].Value = customerprofile.password;
         ProfileParms[3].Value = customerprofile.email;
         ProfileParms[4].Value = customerprofile.creditCard;
         ProfileParms[5].Value = customerprofile.fullName;
         ProfileParms[6].Value = customerprofile.userID;
         OracleHelper.ExecuteNonQuery(_internalConnection, _internalADOTransaction, CommandType.Text, SQL_UPDATE_ACCOUNTPROFILE, ProfileParms);
         return customerprofile;
     }
     catch 
     {
         throw;
     }
 }
Exemplo n.º 4
0
 public AccountProfileDataModel getAccountProfileData(string userid)
 {
     try
     {
         OracleParameter parm1 = new OracleParameter(PARM_USERID, OracleDbType.Varchar2, 20);
         parm1.Value = userid;
         OracleDataReader rdr = OracleHelper.ExecuteReaderSingleRowSingleParm(_internalConnection, _internalADOTransaction, CommandType.Text, SQL_SELECT_CUSTOMERPROFILE_BYUSERID,parm1);
         if (rdr.Read())
         {
             AccountProfileDataModel customerprofile = new AccountProfileDataModel(rdr.GetString(0), rdr.GetString(2), rdr.GetString(3), rdr.GetString(4), rdr.GetString(5), rdr.GetString(6));
             rdr.Close();
             return customerprofile;
         }
         rdr.Close();
         return null;
     }
     catch 
     {
         throw;
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Updates account profile data for a user. 
 /// </summary>
 /// <param name="profileData">Profile data model class with updated info.</param>
 public AccountProfileDataModel updateAccountProfile(AccountProfileDataModel profileData)
 {
     dalCustomer = Trade.DALFactory.Customer.Create(Settings.DAL);
     dalCustomer.Open(Settings.TRADEDB_SQL_CONN_STRING);;
     try
     {
         return dalCustomer.update(profileData, Settings.USE_SALTEDHASH_PASSWORDS);
     }
     catch 
     {
         throw;
     }
     finally
     {
         dalCustomer.Close();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Adds user account data to Account table and also profile data to AccountProfile table.
 /// </summary>
 /// <param name="userID"></param>
 /// <param name="password"></param>
 /// <param name="fullname"></param>
 /// <param name="address"></param>
 /// <param name="email"></param>
 /// <param name="creditcard"></param>
 /// <param name="openBalance"></param>
 /// <returns></returns>
 private AccountDataModel addNewRegisteredUser(string userID, string password, string fullname, string address, string email, string creditcard, decimal openBalance)
 {
     AccountProfileDataModel customerprofile = new AccountProfileDataModel(userID, password, fullname, address, email, creditcard);
     dalCustomer.insertAccountProfile(customerprofile, Settings.USE_SALTEDHASH_PASSWORDS);
    
     //Check our acid test conditions here for transactional testing; we want to test part way through
     //the register operations from the BSL, to make sure database is never left in state with one
     //insert above going through, and the one below not--the entire BSL operation needs to be
     //treated as one logical unit of work. Also note the ordering of operations here:
     //since trying to register a non-unique userid might be something that happens frequently in the real
     //world, lets do the insert that would fail on this condition first (accountprofile); 
     //rather than wait and do it last.
     if (customerprofile.userID.Equals(StockTraderUtility.ACID_TEST_USER))
         throw new Exception(StockTraderUtility.EXCEPTION_MESSAGE_ACID_REGISTRATION);
     AccountDataModel customer = new AccountDataModel(0, userID, DateTime.Now, (decimal)openBalance, 0, (decimal)openBalance, DateTime.Now, 0);
     dalCustomer.insertAccount(customer);
     return customer;
 }
Exemplo n.º 7
0
 /// <summary>
 /// Converts from service data contract model class to a UI Model class for quick HTML display in ASPX pages.
 /// </summary>
 private AccountProfileDataModel convertCustProfileFromUI(AccountProfileDataUI customerprofile)
 {
     AccountProfileDataModel serviceLayerCustomerProfile = new AccountProfileDataModel();
     serviceLayerCustomerProfile.password = customerprofile.password;
     serviceLayerCustomerProfile.address = customerprofile.address;
     serviceLayerCustomerProfile.creditCard = customerprofile.creditCard;
     serviceLayerCustomerProfile.email = customerprofile.email;
     serviceLayerCustomerProfile.fullName = customerprofile.fullName;
     serviceLayerCustomerProfile.userID = customerprofile.userID;
     return serviceLayerCustomerProfile;
 }
 public AccountProfileDataModel updateAccountProfile(AccountProfileDataModel profileData)
 {
     TradeService service = new TradeService();
     return service.updateAccountProfile(profileData);
 }