public void DeleteAccountDetailLineItem(int AccountID, out TransactionalInformation transaction) { transaction = new TransactionalInformation(); AccountsBusinessRules accountsBusinessRules = new AccountsBusinessRules(); try { accountsDataService.CreateSession(); accountsDataService.BeginTransaction(); accountsDataService.DeleteAccountDetailLineItem(AccountID); accountsDataService.CommitTransaction(true); transaction.ReturnStatus = true; } catch (Exception ex) { transaction.ReturnMessage = new List <string>(); string errorMessage = ex.Message; transaction.ReturnStatus = false; transaction.ReturnMessage.Add(errorMessage); } finally { accountsDataService.CloseSession(); } }
public taccount CreateAccount(int AccountID, string FirstName, string LastName, string EmailAddress, string IsEnabled, string PostToSlack, string SlackBotChannel, string Password, string Role, out TransactionalInformation transaction) { transaction = new TransactionalInformation(); AccountsBusinessRules accountsBusinessRules = new AccountsBusinessRules(); taccount account = new taccount(); account.ACCOUNTID = AccountID; account.FIRSTNAME = FirstName; account.LASTNAME = LastName; account.EMAILADDRESS = EmailAddress; account.ISENABLED = IsEnabled; account.POSTTOSLACK = PostToSlack; account.SLACKBOTCHANNEL = SlackBotChannel; account.PASSWORD = Password; account.ROLE = Role; try { accountsDataService.CreateSession(); accountsBusinessRules.ValidateAccount(account, accountsDataService); if (accountsBusinessRules.ValidationStatus == true) { accountsDataService.BeginTransaction(); accountsDataService.CreateAccount(account); accountsDataService.CommitTransaction(true); transaction.ReturnStatus = true; transaction.ReturnMessage.Add("Account successfully created."); } else { transaction.ReturnStatus = accountsBusinessRules.ValidationStatus; transaction.ReturnMessage = accountsBusinessRules.ValidationMessage; transaction.ValidationErrors = accountsBusinessRules.ValidationErrors; } } catch (Exception ex) { transaction.ReturnMessage = new List <string>(); string errorMessage = ex.Message; transaction.ReturnStatus = false; transaction.ReturnMessage.Add(errorMessage); } finally { accountsDataService.CloseSession(); } return(account); }
public taccount UpdateAccountDetailLineItem(int AccountID, int quantity, out TransactionalInformation transaction) { transaction = new TransactionalInformation(); AccountsBusinessRules accountsBusinessRules = new AccountsBusinessRules(); taccount account = new taccount(); try { accountsDataService.CreateSession(); accountsBusinessRules.ValidateAccountDetailLineItem(account, accountsDataService); if (accountsBusinessRules.ValidationStatus == true) { accountsDataService.BeginTransaction(); accountsDataService.UpdateAccountDetailLineItem(account); accountsDataService.CommitTransaction(true); transaction.ReturnStatus = true; transaction.ReturnMessage.Add("Account line item successfully updated."); } else { transaction.ReturnStatus = accountsBusinessRules.ValidationStatus; transaction.ReturnMessage = accountsBusinessRules.ValidationMessage; transaction.ValidationErrors = accountsBusinessRules.ValidationErrors; } } catch (Exception ex) { transaction.ReturnMessage = new List <string>(); string errorMessage = ex.Message; transaction.ReturnStatus = false; transaction.ReturnMessage.Add(errorMessage); } finally { accountsDataService.CloseSession(); } return(account); }