本文整理汇总了C#中ZiblerBusinessComponents.Exceptions.ZiblerBusinessComponentsUnknownException类的典型用法代码示例。如果您正苦于以下问题:C# ZiblerBusinessComponentsUnknownException类的具体用法?C# ZiblerBusinessComponentsUnknownException怎么用?C# ZiblerBusinessComponentsUnknownException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ZiblerBusinessComponentsUnknownException类属于ZiblerBusinessComponents.Exceptions命名空间,在下文中一共展示了ZiblerBusinessComponentsUnknownException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateLoanRequestStatus
//.........这里部分代码省略.........
/* Determine if the loan has an earlier date than the currently selected for
* the VAT. If so, then this date should be used to search for the VAT */
bool replace = DateUtilities.IsFirstDateGreaterThanSecondDate (
vatStart.Value,
loan.StartDate.Value);
if (replace)
vatStart = Convert.ToDateTime (loan.StartDate);
}
}
}
/* Get all the Interests and their values to be used to calculate
* the statements for all the loans */
IDictionaryEnumerator en = hashIntRtDates.GetEnumerator ();
while (en.MoveNext ())
{
/* Interest Rate needed */
int intRateId = Convert.ToInt32 (en.Key);
/* Values needed from this date */
DateTime dt = Convert.ToDateTime (en.Value);
IList<InterestRateValue> list
= interestRateValueDAO.GetInterestRateValuesForStatement (intRateId,
dt,
DateTime.Today);
/* If the list is not null, then add it to the list */
if (list != null)
{
/* Add the values to a hash list and move on */
hashIntRtValues.Add (intRateId, list);
}
}
/* Get all the VATs */
IList<VAT> vats = vatDAO.GetVATsForStatement (financialInstitution,
vatStart.Value,
DateTime.Today);
/* If there are no VATs or Interest Rate Values return */
if (vats.Count <= 0 || hashIntRtValues.Count <= 0)
return;
/* Calculate the loan statements for all the loans previously selected
* Adjust the Loan Request status based on the number of days
* the loan request is delayed.
*
* Clasify the Loan Request based on the loan that has the most delayed
* days as follows:
*
* Corriente - No Delays
* Vencida - Delayed 1 to 3 days (including day 3)
* ExtraJudicial - Delayed 4 to 89 days
* JudicialAltoRiesgo - Delayed 90 or more
*
*/
bool firstPass = true;
foreach (LoanRequest loanRequest in loanReqts)
{
foreach (Loan loan in loanRequest.Loans)
{
/* Interest Rate values for the loan */
IList<InterestRateValue> intValues
= (IList<InterestRateValue>)hashIntRtValues[loan.InterestRate.Id];
try
{
SetLoanRequestStatus (loanRequest,
loan,
DateTime.Today,
vats,
intValues,
nrmlzdDate,
firstPass);
}
catch
{
break;
}
}
}
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例2: GetFinancialInstitutionNames
/// <summary>
/// Gets the names of all financial institutions in the system
/// </summary>
/// <returns></returns>
public IList<string> GetFinancialInstitutionNames()
{
try
{
IFinancialInstitutionDAO financialInstitutionDAO = _daoFactory.GetFinancialInstitutionDAO ();
IList<string> institutions = null;
institutions = financialInstitutionDAO.GetFinancialInstitutionNames ();
return institutions;
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例3: UpdateFinancialInstitution
//.........这里部分代码省略.........
{
bool keepDate = true;
/* the Main membership range dates will be null,
* so check for it */
if (membership.ValidFrom != null)
{
keepDate = DateUtilities.IsFirstDateGreaterOrEqualThanSecondDate (
membership.ValidFrom.Value,
startDate.Value);
}
if (keepDate)
{
/* Do nothing, keep the date */
}
else
{
/* Replace it */
startDate = membership.ValidFrom;
}
}
else
{
startDate = membership.ValidFrom;
}
if (endDate != null)
{
bool keepDate = true;
/* the Main membership range dates will be null,
* so check for it */
if (membership.ValidUntil != null)
{
keepDate = DateUtilities.IsFirstDateGreaterOrEqualThanSecondDate (
endDate.Value,
membership.ValidUntil.Value);
}
if (keepDate)
{
/* Do nothing, keep the date */
}
else
{
/* Replace it */
endDate = membership.ValidUntil;
}
}
else
{
endDate = membership.ValidUntil;
}
}
/* Only do this if the dates where found, otherwise
* rise an exception */
if (startDate != null && endDate != null)
{
/* Now that we have a start date and an end date, assign them to
* the Main app membership */
foreach (ApplicationFinancialInstitutionMembership membership in
finInstToUpdate.ApplicationFinancialInstitutionMemberships)
{
/* Assign the dates */
if (membership.Application.Name == "Main")
{
membership.ValidFrom = startDate;
membership.ValidUntil = endDate;
}
}
}
else
{
/* Something really bad must have happened if we got here.
* Add the error data*/
ZiblerBusinessComponentsUnknownException ex
= new ZiblerBusinessComponentsUnknownException ();
ex.Data.Add ("StartDate", startDate);
ex.Data.Add ("EndDate", endDate);
throw ex;
}
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例4: RetrieveAuthorizedAppSection
/// <summary>
/// Returns a list of the Application section that the Financial Institution/user
/// is allowed to view.
/// </summary>
/// <param name="userName">User name</param>
/// <param name="financialInstitution">Financiera</param>
/// <returns>Application section names</returns>
/// <exception cref="ZiblerBusinessComponentsException"/>
public IList<string> RetrieveAuthorizedAppSection(string userName,
string financialInstitution)
{
try
{
//DAO to access stored information
IFinancialUserDAO financialUserDAO = _daoFactory.GetFinancialUserDAO ();
FinancialUser financialUser = financialUserDAO.FindByUserNameFinancialInst (userName,
financialInstitution);
IList<string> authorizedSections = new List<string> ();
//If no user was found, then return false.
if (financialUser == null)
return authorizedSections;
if (financialUser.Active == true)
{
if (financialUser.Username == userName)
{
if (financialUser.FinancialInstitution.Name == financialInstitution)
{
//Look through all the memberships
foreach (ApplicationFinancialInstitutionMembership membership in
financialUser.FinancialInstitution.ApplicationFinancialInstitutionMemberships)
{
if (membership.Active)
{
if (DateUtilities.IsCurrentDateWithinDateRange (
Convert.ToDateTime (membership.ValidFrom),
Convert.ToDateTime (membership.ValidUntil)))
{
authorizedSections.Add (membership.Application.Name);
}
}
}
}
}
}
return authorizedSections;
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例5: AuthenticateClientUser
/// <summary>
/// This function will determine if the Client Username /password/Financiera
/// combination is valid
/// </summary>
/// <param name="userName">User name</param>
/// <param name="password">Password (not hashed)</param>
/// <param name="financialInstitution">Financiera</param>
/// <returns>True if all data is valid, false if it is not.</returns>
/// <exception cref="ZiblerBusinessComponentsException"/>
public bool AuthenticateClientUser(string userName,
string password,
string financialInstitution)
{
try
{
//DAO to access stored information
IClientDAO clientDAO = _daoFactory.GetClientDAO ();
//The user name in this case is the CURP
Client client = clientDAO.FindByCURPFinancialInst (userName, financialInstitution);
//If no user was found, then return false.
if (client == null)
return false;
string hashedPwd = Encryption.CreateHash (password);
if (client.CURP == userName)
{
if (client.AccountPassword == hashedPwd)
{
if (client.FinancialInstitution.Name == financialInstitution)
{
foreach (ApplicationFinancialInstitutionMembership membership in
client.FinancialInstitution.ApplicationFinancialInstitutionMemberships)
{
//TODO: HACK
/* This is hardcoded in the code. We should remove it from here
* and follow the same approach folloed in Zibler app */
if (membership.Application.Name == "Clients")
{
bool withinRange = DateUtilities.IsCurrentDateWithinDateRange (
Convert.ToDateTime (membership.ValidFrom),
Convert.ToDateTime (membership.ValidUntil));
if (withinRange)
{
if (membership.Active)
{
return true;
}
}
}
}
return true;
}
}
}
return false;
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例6: AuthorizeFinancialUserToAppSection
/// <summary>
/// This function will determine if the Financial User and the Financial Institution
/// has the right to access a specific section of the application
/// </summary>
/// <param name="userName">User Name</param>
/// <param name="financialInstitution">Financiera</param>
/// <param name="applicationSection">Section to be accessed</param>
/// <returns>True if the user / financial institution can access the section, false if not.</returns>
/// <exception cref="ZiblerBusinessComponentsException"/>
public bool AuthorizeFinancialUserToAppSection(string userName,
string financialInstitution,
string applicationSection)
{
try
{
//DAO to access stored information
IFinancialUserDAO financialUserDAO = _daoFactory.GetFinancialUserDAO ();
FinancialUser financialUser = financialUserDAO.FindByUserNameFinancialInst (userName,
financialInstitution);
//If no user was found, then return false.
if (financialUser == null)
return false;
if (financialUser.Active == true)
{
if (financialUser.Username == userName)
{
if (financialUser.FinancialInstitution.Name == financialInstitution)
{
//Look through all the memberships and compare against the one that has
//been provided
foreach (ApplicationFinancialInstitutionMembership membership in
financialUser.FinancialInstitution.ApplicationFinancialInstitutionMemberships)
{
//If found, now verify it is still valid
if (membership.Application.Name == applicationSection)
{
if (membership.Active)
{
if (DateUtilities.IsCurrentDateWithinDateRange (
Convert.ToDateTime (membership.ValidFrom),
Convert.ToDateTime (membership.ValidUntil)))
{
return true;
}
}
}
}
}
}
}
return false;
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例7: ClientGenerateNewPassword
/// <summary>
/// Generates the new password.
/// </summary>
/// <param name="financialInstitutionName">Name of the financial institution.</param>
/// <param name="curp">The curp.</param>
/// <param name="email">The email.</param>
/// <returns>Generated password (not hashed)</returns>
public string ClientGenerateNewPassword(string financialInstitutionName,
string curp,
string email)
{
try
{
//DAO to access stored information
IClientDAO clientDAO = _daoFactory.GetClientDAO ();
Client client = clientDAO.FindByCURPFinancialInst (curp, financialInstitutionName);
if (client == null)
{
throw new ZiblerBusinessComponentsException (
Resources.SecurityOperationsMsgPasswordRecoveryFailed);
}
else
{
if (client.ContactInformation.Email != email)
{
throw new ZiblerBusinessComponentsException (
Resources.SecurityOperationsMsgPasswordRecoveryFailed);
}
else
{
int passwordMinSize = 10;
int passwordMaxSize = 11;
string password = PasswordUtilities.Generate (passwordMinSize,
passwordMaxSize);
string hash = Encryption.CreateHash (password);
client.AccountPassword = hash;
return password;
}
}
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例8: CreateNewLoanInLoanRequest
//.........这里部分代码省略.........
newCommission.RateOverAmount = commissionToApply.RateOverAmount;
loan.AddLoanApplicableCommission (newCommission);
}
//Now that we have set the loan properties, we will add it to the
//loan request.
loanRequest.AddLoan (loan);
}
else
{
throw new
ZiblerBusinessComponentsException (
String.Format (
Resources.LoanRequestOperationsMsgAmountOutOfBoundariesForBracket,
minAmountAllowed.ToString ("C"),
maxAmountAllowed.ToString ("C")));
}
}
else
{
bool defaultParamFound = false;
//If the loan bracket was not found, look for the default parameters
foreach (LoanParameter existingParam in financialInstitution.LoanParameters)
{
//Look for the default parameter
if (existingParam.IsDefault && existingParam.LoanType == loan.LoanType)
{
defaultParamFound = true;
loan.AmortizationTableType = existingParam.AmortizationTableType;
loan.GracePeriod = existingParam.GracePeriod;
loan.GrossEarningsMargin = existingParam.GrossEarningsMargin;
loan.NumberOfAmortizations = existingParam.NumberOfAmortizations;
loan.OverdueRateFactor = existingParam.OverdueRateFactor;
loan.OverdueRateAmount = existingParam.OverdueRateAmount;
loan.PaymentFrequency = existingParam.PaymentFrequency;
loan.DelayedDays = 0;
//Now get the interest rate
loan.InterestRate = existingParam.InterestRate;
//Get the applicable commissions
foreach (LoanCommission commissionToApply
in existingParam.LoanCommissions)
{
LoanApplicableCommission newCommission
= new LoanApplicableCommission ();
newCommission.Amount = commissionToApply.Amount;
newCommission.Concept = commissionToApply.Concept;
newCommission.RateOverAmount = commissionToApply.RateOverAmount;
loan.AddLoanApplicableCommission (newCommission);
}
break;
}
}
if (defaultParamFound)
{
loanRequest.AddLoan (loan);
}
//There are no Default parameters
else
{
throw new ZiblerBusinessComponentsException (
Resources.LoanRequestOperationsMsgNoDefaultParameterExists);
}
}
}
else
{
//TODO: Add the loan applicable commissions
//If values have been provided then we simply take the loan
//and add it to the loan request.
InterestRate interestRate = interestRateDAO.FindById (interestRateId);
if (interestRate == null)
{
//No interest rate is available
throw new ZiblerBusinessComponentsException (
Resources.LoanRequestOperationsMsgNoInterestRateExists);
}
loan.InterestRate = interestRate;
loanRequest.AddLoan (loan);
}
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例9: CreateNewLoanRequestCollateral
/// <summary>
/// Adds a new Collateral to the Loan Request
/// </summary>
/// <param name="loanRequest">loanRequest</param>
/// <param name="collateral">collateral</param>
public void CreateNewLoanRequestCollateral(LoanRequest loanRequest, Collateral collateral)
{
try
{
//If the loan request is not editable, then don't give them the option
//to delete any data from it.
if (loanRequest.LoanRequestStatus != LoanRequestStatus.Condicionada
&& loanRequest.LoanRequestStatus != LoanRequestStatus.Capturada
&& loanRequest.LoanRequestStatus != LoanRequestStatus.ExpedienteIntegrado)
{
throw new ZiblerBusinessComponentsException (
Resources.LoanRequestOperationsMsgCannotAddCollateral);
}
//Add the collateral if no exceptions were thrown
loanRequest.AddCollateral (collateral);
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例10: GetNextUpdateDate
/// <summary>
/// Returns the next update date as one day after
/// the date provided.
/// </summary>
/// <param name="nextUpdtDate">nextUpdtDate</param>
/// <returns>Next update date.</returns>
private DateTime GetNextUpdateDate(DateTime nextUpdtDate)
{
try
{
/* Set the next update day to one day after */
nextUpdtDate = nextUpdtDate.AddDays (1);
/*
* Now that we have added the days, we need to calculate
* the hour. Valid hours are:
*
* 12am
* 1am
* 2am
* 3am
* 4am
* 5am
*
* Look at the hour in the nextUpdtDate and add 1 hour to it.
* Verify that the resulting hour is within range.
* */
AmPm dateType = DateUtilities.GetDateAmPm (nextUpdtDate);
/* Check and see that the date is not PM */
if (dateType == AmPm.PM)
{
/* If this is a PM, then roll back 12 hours, to
* make it AM */
nextUpdtDate = nextUpdtDate.AddHours (-12);
}
/* At this point the hour should be AM only*/
/* Check the hour */
int hour = nextUpdtDate.Hour;
/* If the hour is not any of the following then reset to 12. */
if (hour != 12 && hour != 1 && hour != 2 &&
hour != 3 && hour != 4 && hour != 5)
{
DateTime dateHldr = new DateTime (nextUpdtDate.Year,
nextUpdtDate.Month,
nextUpdtDate.Day,
12,
nextUpdtDate.Minute,
nextUpdtDate.Second);
/* Check the hour is not PM */
AmPm checkTyp = DateUtilities.GetDateAmPm (dateHldr);
/* Check and see that the date is not PM */
if (checkTyp == AmPm.PM)
{
dateHldr = dateHldr.AddHours (-12);
}
/* Set the hour to 12am */
nextUpdtDate = dateHldr;
}
/* If the hour is 5am, we need to substract 5 hours
* to roll the hour to 12 am */
if (hour == 5)
{
nextUpdtDate = nextUpdtDate.AddHours (-5);
}
else
{
/* Add one hour */
nextUpdtDate = nextUpdtDate.AddHours (1);
}
return nextUpdtDate;
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例11: NextHour
private int NextHour(int previousHour)
{
try
{
if (previousHour == 5)
previousHour = 12;
else
{
if (previousHour == 12)
previousHour = 1;
else
{
previousHour++;
}
}
return previousHour;
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例12: CreateNewFinancialInfoInLoanRequest
/// <summary>
/// Creates a new Financial Information
/// </summary>
/// <param name="financialInstitution">financialInstitution</param>
/// <param name="loanRequest">loanRequest</param>
/// <param name="financialInformation">financialInformation</param>
public void CreateNewFinancialInfoInLoanRequest(string financialInstitution,
LoanRequest loanRequest,
FinancialInformation financialInformation)
{
try
{
loanRequest.FinancialInformation = financialInformation;
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例13: VerifyLoanRequestTransitionIsValid
//.........这里部分代码省略.........
&& newStatus != LoanRequestStatus.ExpedienteIntegrado)
{
throw new ZiblerBusinessComponentsException (
String.Format (
Resources.LoanRequestOperationsMsgLoanStatusTransitionIsInvalid,
oldStatusName,
newStatusName));
}
}
else if (oldStatus == LoanRequestStatus.ExtraJudicial)
{
if (newStatus != LoanRequestStatus.JudicialAltoRiesgo
&& newStatus != LoanRequestStatus.Pagada
&& newStatus != LoanRequestStatus.Vencida
&& newStatus != LoanRequestStatus.Cancelada
&& newStatus != LoanRequestStatus.ExtraJudicial)
{
throw new ZiblerBusinessComponentsException (
String.Format (
Resources.LoanRequestOperationsMsgLoanStatusTransitionIsInvalid,
oldStatusName,
newStatusName));
}
}
else if (oldStatus == LoanRequestStatus.JudicialAltoRiesgo)
{
if (newStatus != LoanRequestStatus.Pagada
&& newStatus != LoanRequestStatus.Corriente
&& newStatus != LoanRequestStatus.Cancelada
&& newStatus != LoanRequestStatus.JudicialAltoRiesgo)
{
throw new ZiblerBusinessComponentsException (
String.Format (
Resources.LoanRequestOperationsMsgLoanStatusTransitionIsInvalid,
oldStatusName,
newStatusName));
}
}
else if (oldStatus == LoanRequestStatus.Pagada)
{
if (newStatus != LoanRequestStatus.Cancelada
&& newStatus != LoanRequestStatus.Pagada)
{
throw new ZiblerBusinessComponentsException (
String.Format (
Resources.LoanRequestOperationsMsgLoanStatusTransitionIsInvalid,
oldStatusName,
newStatusName));
}
}
else if (oldStatus == LoanRequestStatus.Rechazada)
{
if (newStatus != LoanRequestStatus.Rechazada)
{
throw new ZiblerBusinessComponentsException (
String.Format (
Resources.LoanRequestOperationsMsgLoanStatusTransitionIsInvalid,
oldStatusName,
newStatusName));
}
}
else if (oldStatus == LoanRequestStatus.Vencida)
{
if (newStatus != LoanRequestStatus.Corriente
&& newStatus != LoanRequestStatus.ExtraJudicial
&& newStatus != LoanRequestStatus.Pagada
&& newStatus != LoanRequestStatus.Cancelada
&& newStatus != LoanRequestStatus.Vencida)
{
throw new ZiblerBusinessComponentsException (
String.Format (
Resources.LoanRequestOperationsMsgLoanStatusTransitionIsInvalid,
oldStatusName,
newStatusName));
}
}
else
{
throw new ZiblerBusinessComponentsException (
String.Format (
Resources.LoanRequestOperationsMsgLoanStatusTransitionIsInvalid,
oldStatusName,
newStatusName));
}
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例14: CreateNewFinancialUser
/// <summary>
/// Creates a new Financial User in the system
/// </summary>
/// <param name="financialInstitution">Financial Institution this user belongs to.</param>
/// <param name="username">Username creating user</param>
/// <param name="financialUser">Financial User to be created</param>
/// <param name="applicationRoles">Application roles to be assigned to the financial user</param>
public void CreateNewFinancialUser(string financialInstitutionName,
string username,
FinancialUser financialUser,
IList<int> applicationRolesIds)
{
try
{
IFinancialInstitutionDAO financialInstitutionDAO = _daoFactory.GetFinancialInstitutionDAO ();
IApplicationRoleDAO applicationRoleDAO = _daoFactory.GetApplicationRoleDAO ();
//Make sure it does not exist in the system
if (financialInstitutionDAO.FinancialUserExists (financialInstitutionName,
financialUser.Username))
{
throw new ZiblerBusinessComponentsException (
Resources.FinancialUserOperationsMsgFinancialUserExists);
}
//Get all the application roles.
//TODO: There are not too many application roles, however this may cause issues
// in future releases when application roles are defined by the financial institution
IList<ApplicationRole> applicationRoles = applicationRoleDAO.FindAll ();
//Hash the password.
Encryption.EncryptProperties (financialUser);
//Add the roles since we did not throw any exception
foreach (ApplicationRole applicationRole in applicationRoles)
{
if (applicationRolesIds.Contains (applicationRole.Id))
financialUser.AddApplicationRole (applicationRole);
}
//Add the user to the financial institution
FinancialInstitution financialInstitution = financialInstitutionDAO.GetFinancialInstitutionByName (
financialInstitutionName);
/* If we could not find the financial institution
* raise an exception */
if (financialInstitution == null)
{
throw new ZiblerBusinessComponentsUnknownException ();
}
else
{
financialInstitution.AddFinancialUser (financialUser);
financialInstitutionDAO.MakePersistent (financialInstitution);
}
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}
示例15: CreateNewBusinessClient
/// <summary>
/// Creates a new Business Client
/// </summary>
/// <param name="businessId">businessId</param>
/// <param name="businessVersion">businessVersion</param>
/// <param name="client">client to be created</param>
public void CreateNewBusinessClient(int businessId,
int businessVersion,
BusinessClient client)
{
try
{
IBusinessInformationDAO businessInformationDAO = _daoFactory.GetBusinessInformationDAO ();
//Get all the business products. Note that I retrieve all products in a batch base
//and don't care about the number of records. This is because it is not likely
//the business will contain hundreds of products
BusinessInformation businessInformation = businessInformationDAO.FindByIdAndVersion (
businessId,
businessVersion);
if (businessInformation == null)
throw new ZiblerBusinessComponentsException (Resources.RecordNotFound);
else
{
foreach (BusinessClient existingClient in businessInformation.BusinessClients)
{
if (existingClient.Name == client.Name)
{
//Throw an exception and indicate the product already exists
throw new ZiblerBusinessComponentsException (
Resources.LoanRequestOperationsMsgBusinessAlreadyHasClient);
}
}
//Since no exception was thrown, then we add the new client to the list.
businessInformation.AddBusinessClient (client);
}
}
/* If the exception was thrown here, just pass it up */
catch (ZiblerBusinessComponentsException ex)
{
throw;
}
/* Catch any Data Layer or other exception and throw an unkown exception */
catch (Exception ex)
{
ZiblerBusinessComponentsUnknownException exc
= new ZiblerBusinessComponentsUnknownException (ex);
/* Throw the new exception */
throw exc;
}
}