/// <summary> /// Get a single account given it's id. /// </summary> /// <param name="id">int or Integer</param> /// <returns>MAccountProfile</returns> /// <remarks>Returns null object if not found</remarks> public static MAccountProfile GetProfile(int id) { var mResult = from mProfile in GetAccounts(CurrentProfile()) where mProfile.Id == id select mProfile; MAccountProfile mRetVal = null; try { mRetVal = mResult.First(); } catch (InvalidOperationException) { String mMSG = "Count not find account: " + id + " in the database"; Logger mLog = Logger.Instance(); mLog.Error(mMSG); } catch (IndexOutOfRangeException) { String mMSG = "Count not find account: " + id + " in the database"; Logger mLog = Logger.Instance(); mLog.Error(mMSG); } if (mRetVal != null) { BAccounts mBAccount = new BAccounts(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement); mRetVal = mBAccount.GetProfile(mRetVal.Account); } return(mRetVal); }
/// <summary> /// Retrieves an account profile given the account /// </summary> /// <param name="account">String</param> /// <returns>a populated MAccountProfile</returns> public static MAccountProfile GetProfile(String account) { BAccounts mBAccount = new BAccounts(SecurityEntityUtility.CurrentProfile(), ConfigSettings.CentralManagement); MAccountProfile mRetVal = null; try { mRetVal = mBAccount.GetProfile(account); } catch (InvalidOperationException) { String mMSG = "Count not find account: " + account + " in the database"; Logger mLog = Logger.Instance(); mLog.Error(mMSG); } catch (IndexOutOfRangeException) { String mMSG = "Count not find account: " + account + " in the database"; Logger mLog = Logger.Instance(); mLog.Error(mMSG); } return(mRetVal); }