public void ConvertTo_WebAccountToUserAccount_ConvertedObjectHasAccurateData(int expectedId, string expectedUsername, string expectedEmailAddress, AccountType expectedAccountType, AccountStatus expectedAccountStatus) { // Arrange DateTimeOffset expectedDate = DateTimeOffset.UtcNow; WebUserAccountModel webUserAccountModel = new WebUserAccountModel(); webUserAccountModel.Id = expectedId; webUserAccountModel.Username = expectedUsername; webUserAccountModel.EmailAddress = expectedEmailAddress; webUserAccountModel.AccountType = expectedAccountType.ToString(); webUserAccountModel.AccountStatus = expectedAccountStatus.ToString(); webUserAccountModel.CreationDate = expectedDate; webUserAccountModel.UpdationDate = expectedDate; UserAccountModel userAccountModel = new UserAccountModel(); // Act var convertedUserAccountModel = ModelConverterService.ConvertTo(webUserAccountModel, userAccountModel); // Assert Assert.IsTrue ( convertedUserAccountModel.Id == expectedId && convertedUserAccountModel.Username == expectedUsername && convertedUserAccountModel.Password == null && convertedUserAccountModel.Salt == null && convertedUserAccountModel.EmailAddress == expectedEmailAddress && convertedUserAccountModel.AccountType == expectedAccountType.ToString() && convertedUserAccountModel.AccountStatus == expectedAccountStatus.ToString() && convertedUserAccountModel.CreationDate == expectedDate && convertedUserAccountModel.UpdationDate == expectedDate ); }
public Product(AccountType SelectedProduct, AppUser customer, decimal balance) { AccountType = SelectedProduct.ToString(); AccountName = "Longhorn " + SelectedProduct.ToString(); Balance = balance; Customer = customer; }
public static HtmlString AccountEnumDisplayNameFor(this AccountType item) { var type = item.GetType(); var member = type.GetMember(item.ToString()); DisplayAttribute displayName = (DisplayAttribute)member[0].GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault(); if (displayName != null) { return(new HtmlString(displayName.Name)); } return(new HtmlString(item.ToString())); }
public static ConnectedAccount AddConnectedAccount(this DiscordClient client, AccountType type, string name, bool visibleToPublic = true) { string id = RandomString(12); // instead of having to GET the connections every time to find the next id, let's just pass a random one /shrug return(client.HttpClient.Put($"/users/@me/connections/{type.ToString().ToLower()}/{id}", $"{{\"name\":\"{name}\",\"visibility\":{(visibleToPublic ? 1 : 0)}}}") .Deserialize <ConnectedAccount>().SetClient(client)); }
internal override void WriteXml(XmlTextWriter xmlWriter) { xmlWriter.WriteStartElement("billing_info"); // Start: billing_info //if a recurly js token is supplied we don't want to send billing info here if (string.IsNullOrEmpty(TokenId)) { xmlWriter.WriteStringIfValid("first_name", FirstName); xmlWriter.WriteStringIfValid("last_name", LastName); xmlWriter.WriteStringIfValid("name_on_account", NameOnAccount); xmlWriter.WriteStringIfValid("address1", Address1); xmlWriter.WriteStringIfValid("address2", Address2); xmlWriter.WriteStringIfValid("city", City); xmlWriter.WriteStringIfValid("state", State); xmlWriter.WriteStringIfValid("zip", PostalCode); xmlWriter.WriteStringIfValid("country", Country); xmlWriter.WriteStringIfValid("phone", PhoneNumber); xmlWriter.WriteStringIfValid("vat_number", VatNumber); xmlWriter.WriteStringIfValid("currency", Currency); if (!IpAddress.IsNullOrEmpty()) { xmlWriter.WriteElementString("ip_address", IpAddress); } else { Debug.WriteLine("Recurly Client Library: Recording IP Address is strongly recommended."); } if (!CreditCardNumber.IsNullOrEmpty()) { xmlWriter.WriteElementString("number", CreditCardNumber); xmlWriter.WriteElementString("month", ExpirationMonth.AsString()); xmlWriter.WriteElementString("year", ExpirationYear.AsString()); xmlWriter.WriteStringIfValid("verification_value", VerificationValue); } if (!AccountNumber.IsNullOrEmpty()) { xmlWriter.WriteElementString("routing_number", RoutingNumber); xmlWriter.WriteElementString("account_number", AccountNumber); xmlWriter.WriteElementString("account_type", AccountType.ToString().EnumNameToTransportCase()); } if (!PaypalBillingAgreementId.IsNullOrEmpty()) { xmlWriter.WriteElementString("paypal_billing_agreement_id", PaypalBillingAgreementId); } if (!AmazonBillingAgreementId.IsNullOrEmpty()) { xmlWriter.WriteElementString("amazon_billing_agreement_id", AmazonBillingAgreementId); } } xmlWriter.WriteStringIfValid("token_id", TokenId); xmlWriter.WriteEndElement(); // End: billing_info }
public static bool HasPermission(List <string> validAccountAccessors) { string email; // Test if context is available try { email = HttpContext.Current.Session["Email"].ToString(); } catch { return(false); } AccountType refAccType = User.GetAccountType(email); // Administrators have master access to all if (refAccType == AccountType.Administrator) { return(true); } if (validAccountAccessors.Select(x => x.ToLower()).Contains(refAccType.ToString().ToLower())) { return(true); } return(false); }
/// <summary> /// Opens the account. /// </summary> /// <param name="user">The user.</param> /// <param name="accountType">The type of account.</param> /// <param name="id">The identifier.</param> public void OpenAccount(User user, AccountType accountType) { BankAccount bankAccount; string id = this.GenerateAccountId(user.ToString() + " " + accountType.ToString()); switch ((int)accountType) { case 0: { bankAccount = new BaseAccount(id, user, accountType, AccountStatus.Open, 0, 0); break; } case 1: { bankAccount = new GoldAccount(id, user, accountType, AccountStatus.Open, 0, 0); break; } case 2: { bankAccount = new PlatinumAccount(id, user, accountType, AccountStatus.Open, 0, 0); break; } default: { bankAccount = new BaseAccount(id, user, accountType, AccountStatus.Open, 0, 0); break; } } bankAccount.Status = AccountStatus.Open; this.bankAccounts.Create(bankAccount); }
public void AccoutTypeMapperToDTOTest() { AccountType accountType = AccountType.BASE; AccountTypeDTO accountTypeDTO = AccountTypeMapper.MapAccountTypeToDTO(accountType); Assert.That(accountType.ToString(), Is.EqualTo(accountTypeDTO.ToString())); }
private List <Guid> GetBusinessAccountsFromCache(AccountType AccountTypeToFind) { BusinessAccountCache oBA = (BusinessAccountCache)GlobalCachingProvider.Instance.GetItem(ImperaturGlobal.BusinessAccountCache); return(oBA.GetCache().Where(b => b.Item2.Equals(AccountTypeToFind.ToString())).Select(b => new Guid(b.Item1)).ToList()); }
public void CreateNewAccount(string name, AccountType type, string number, string currency = "rur", double balance = 0, bool isDefault = false) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Account name can't be null or empty"); } if (type == AccountType.BankAccount || type == AccountType.Card && string.IsNullOrEmpty(number)) { throw new ArgumentException("Account number can't be null or empty"); } var account = new Account() { Name = name, Type = type.ToString(), Number = number, Balance = balance, IsDefault = isDefault }; if (isDefault) { _unitOfWork.Repository <Account>().Where(a => a.IsDefault).ToList().ForEach(a => a.IsDefault = false); } _unitOfWork.Repository <Account>().Add(account); var result = _unitOfWork.SaveChanges(); if (!result.Item1) { throw new Exception(result.Item2); } }
/// <summary> /// Initializes a new instance of the <see cref="AccountId"/> class. /// </summary> /// <param name="broker">The broker identifier.</param> /// <param name="accountNumber">The account number identifier.</param> /// <param name="accountType">The account type identifier value.</param> public AccountId(Brokerage broker, AccountNumber accountNumber, AccountType accountType) : base($"{broker.Value}-{accountNumber.Value}-{accountType.ToString().ToUpper()}") { this.Broker = broker; this.AccountNumber = accountNumber; this.AccountType = accountType; }
public void setUserRole(String username, AccountType accountType) { AccountDAO accountDao = new AccountDAO(); AccountDTO accountDto = accountDao.find(username); accountDto.accountType = accountType.ToString(); accountDao.merge(accountDto); }
public Account(User user, AccountType type) { _user = user; _Id++; _type = type; _AccountId = type.ToString() + _Id.ToString(); }
/// <summary> /// Creates a new <see cref="Account"/> instance. /// </summary> /// <param name="accountType">The type of account.</param> /// <param name="person">The person who's the owner of this account.</param> /// <param name="emailAddress">The (optional) e-mail address attached to this account.</param> /// <param name="onUpdateAction">The action to be performed when an update arrives</param> public Account(AccountType accountType, Person person, string emailAddress = null, Action <CourseTask, Account> onUpdateAction = null) { Id = $"{accountType.ToString().ToUpper()}{person.Id}"; Type = accountType; Person = person; EmailAddress = emailAddress; _onUpdateAction = onUpdateAction; }
// Fetches all the accounts of the given AccountType. Results in the accessGrantedForAccountsWithUsernamesEvent or accessDeniedToAccountsEvent firing. public static void fetchAccountsWithAccountType(AccountType accountType, Dictionary <string, object> options) { var account = "com.apple." + accountType.ToString().ToLower(); if (Application.platform == RuntimePlatform.IPhonePlayer) { _sharingFetchAccountsWithAccountType(account, Json.encode(options ?? new Dictionary <string, object>())); } }
// Performs a request using the specified AccountType and username (retrieved from fetchAccountsWithAccountType). Each service has it's own API format for the url so refer // to their documentation directly for details on the url and parameters. Calling this reaults in the requestSucceeded/FailedEvent event firing. public static void performRequest(AccountType accountType, string username, string url, SharingRequestMethod requestMethod = SharingRequestMethod.Get, Dictionary <string, string> parameters = null) { var account = "com.apple." + accountType.ToString().ToLower(); if (Application.platform == RuntimePlatform.IPhonePlayer) { _sharingPerformRequest(account, username, url, requestMethod.ToString().ToLower(), Json.encode(parameters ?? new Dictionary <string, string>())); } }
private void SubCount(int userId, AccountType accountType, int setCount, int? updateUserId) { var numCount = _userAccountRepository.SubCount(userId, accountType, setCount, updateUserId); if (numCount != 1) { Logger.Warn(String.Format("减少{4}发生影响行数不为1,userid={0},foverCount={1},updateId={2},numCount={3}", userId, setCount, updateUserId, numCount, accountType.ToString())); } }
/// <inheritdoc /> public string OpenAccount(string firstName, string lastName, AccountType accountType) { firstName = firstName ?? throw new ArgumentNullException($"{nameof(firstName)} cannot be null."); lastName = lastName ?? throw new ArgumentNullException($"{nameof(lastName)} cannot be null."); string accountId = accountIdGeneratorService.GenerateId(firstName, lastName, accountType.ToString()); if (repository.GetAccountById(accountId) != null) { throw new ArgumentException("Such account already exists."); } BankAccount account = AccountResolver.CreateAccount(accountType.ToString(), accountId, firstName, lastName); repository.Add(account.ToAccountDto(accountType.ToString())); unitOfWork.Commit(); return(accountId); }
public void CanSaveToFile(string accountNumber, string name, decimal balance, AccountType type, bool expected) { List <string> accountList = new List <string>(); accountList.Add($"{accountNumber},{name},{balance},{type.ToString().Substring(0, 1).ToUpper()}"); FileAccountRepository file = new FileAccountRepository(); Assert.AreEqual(expected, file.SaveToFile(accountList, @"C:\Test\FileTest.txt")); }
/// <summary> /// Retrieve the list of accounts from a financial institution using OFX and return all accounts that are not already present in the database /// </summary> /// <param name="financialInstitution">Financial institution to query</param> /// <param name="fiCredentials">Credentials for financial institution account</param> /// <returns>List of accounts</returns> public static async Task <IEnumerable <Account> > EnumerateNewAccounts( OFX.Types.FinancialInstitution financialInstitution, OFX.Types.Credentials fiCredentials) { using (BackgroundTaskTracker.BeginTask("Retrieving Account Information")) { var ofxService = new OFX2Service(financialInstitution, fiCredentials); var accountList = new List <Account>(); var ofxAccountList = await ofxService.ListAccounts().ConfigureAwait(false); // TODO: If ofxAccountList is null, raise a more detailed exception using (var dataService = new DataService()) { foreach (var ofxAccount in ofxAccountList) { // Convert from OFX account type to db account type and encode account id AccountType accountType = AccountType.Checking; string accountId = ""; if (ofxAccount.GetType() == typeof(OFX.Types.CheckingAccount)) { accountType = AccountType.Checking; accountId = ((OFX.Types.CheckingAccount)ofxAccount).RoutingId + ":" + ofxAccount.AccountId; } else if (ofxAccount.GetType() == typeof(OFX.Types.SavingsAccount)) { accountType = AccountType.Savings; accountId = ((OFX.Types.SavingsAccount)ofxAccount).RoutingId + ":" + ofxAccount.AccountId; } else if (ofxAccount.GetType() == typeof(OFX.Types.CreditCardAccount)) { accountType = AccountType.Creditcard; accountId = ofxAccount.AccountId; } // Look for a matching account in the database if (!dataService.GetAccountByFinancialId(accountId).Any()) { // This account is not already in the DB, add to new account list accountList.Add(new Account { AccountName = accountType + ":" + ofxAccount.AccountId.Substring(ofxAccount.AccountId.Length - 4), AccountType = accountType.ToString(), Currency = "USD", FiAccountId = accountId }); } } } // Return the finalized list of new accounts return(accountList); } }
private int createAccount(String login, String password, String fullName, AccountType type) { SqlCommand command = DataService.createSqlCommand(CREATE_ACCOUNT); DataService.addParameter("@login", login); DataService.addParameter("@password", password); DataService.addParameter("@type", type.ToString()); DataService.addParameter("@created_at", DateTime.Now); DataService.addParameter("@full_name", fullName); return(Convert.ToInt32(command.ExecuteScalar())); }
public double accountBalance(AccountType target) { // validate this account belongs to this person var account = accounts.FirstOrDefault(a => a.accountType == target); if (account == null) { throw new Exception("No Account found " + target.ToString()); } // add the money to the account return(account.sumTransactions()); }
public bool CheckBalance() { if (AccountType.ToString().Equals("Saving")) { return(Balance > (Amount + TransferFee)); } if (AccountType.ToString().Equals("Checking")) { return(Balance > (Amount + 200 + TransferFee)); } return(false); }
public TestContext(AccountType accType) { this.AccountType = accType; if (AccountType == AccountType.Gross) Symbol = "EURUSD"; else Symbol = "EUR/USD"; VeryLowPrice = 0.5; VeryHighPrice = 1.5; Volume = 10000; this.Comment = string.Format("UnitTest for {0} account", accType.ToString()); }
public void MakeDeposit(int accNum, decimal amt, string note, AccountType type) { if (amt < 0) { throw new ArgumentOutOfRangeException(nameof(amt), "Deposit amount must be positive"); } // add a new deposit TransactionClass deposit = new TransactionClass(accNum, amt, note, type.ToString(), DateTime.Now); BankdatasClass.Transactions.Add(deposit); }
public void MakeWithdrawal(int accNum, decimal amt, string note, AccountType type) { if (amt < 0) { throw new ArgumentOutOfRangeException(nameof(amt), "Deposit amount must be positive"); } if (type.ToString() == "Savings" && Balance - amt < 100) { throw new ArgumentOutOfRangeException("You don't have sufficient fund for this operation"); } if (type.ToString() == "Current" && Balance - amt < 1000) { throw new InvalidOperationException("You don't have sufficient fund for this operation"); } // add a new deposit TransactionClass withdrawal = new TransactionClass(accNum, -amt, note, type.ToString(), DateTime.Now); BankdatasClass.Transactions.Add(withdrawal); }
/// <summary> /// Opretter en konto /// </summary> /// <param name="navn">Navn på kontoholder</param> /// <param name="type">Type af konto</param> /// <returns>Friendly-name på kontoen</returns> public string CreateAccount(string navn, AccountType type) { if (type == AccountType.checkingAccount) { accNum = BankRepoFile.AddAccount(new CheckingAccount(navn)); LoghandlerEvent("Der er oprettet en " + type.ToString() + " til " + navn); return($"Lønkonto med kontonummer {accNum}"); } else if (type == AccountType.masterCardAccount) { accNum = BankRepoFile.AddAccount(new MasterCardAccount(navn)); LoghandlerEvent("Der er oprettet en " + type.ToString() + " til " + navn); return($"Kreditkortkonto med kontonummer {accNum}"); } else if (type == AccountType.savingsAccount) { accNum = BankRepoFile.AddAccount(new SavingsAccount(navn)); LoghandlerEvent("Der er oprettet en " + type.ToString() + " til " + navn); return($"Opsparingskonto med kontonummer {accNum}"); } return(null); }
/// <summary> /// Create an account /// </summary> /// <param name="symbol">Symbol of currency</param> /// <param name="type">Type of account</param> /// <returns>Id of new account</returns> public async Task <string> CreateAccount(string symbol, AccountType type) { var endpoint = "/api/v1/accounts"; var body = new SortedDictionary <string, object>(); body.Add("currency", symbol); body.Add("type", type.ToString().ToLower()); var response = await Post <IdResponse>(endpoint, body); return(response.Id); }
public void AddRow(int id, string name, DateTime date, DateTime duedate, int amount, AccountType type, string info) { var row = dataTable.NewRow(); row["ID"] = id; row["Name"] = name; row["Date"] = date.ToShortDateString(); row["DueDate"] = duedate.ToShortDateString(); row["Amount"] = amount; row["Type"] = type.ToString(); row["Info"] = info; dataTable.Rows.Add(row); }
public void CanNotGetAccount(string accountNumber, string name, decimal balance, AccountType type) { List <string> accountList = new List <string>(); accountList.Add($"{accountNumber},{name},{balance},{type.ToString().Substring(0, 1).ToUpper()}"); FileAccountRepository file = new FileAccountRepository(); file.SaveToFile(accountList, @"C:\Test\FileTest.txt"); Account accountExtract = file.GetAccount("00000", @"C:\Test\FileTest.txt"); Assert.IsNull(accountExtract); }
/// <summary> /// Supplementary method that creates account instance of specific type based on AccountType argument (enum). /// Other arguments are used as constructor data. /// </summary> /// <param name="enumType"> /// Account type (enum). Type names in enum has to match existing account types precisely. /// </param> /// <param name="accountNumber"> /// Account number for Account object constructor. /// </param> /// <param name="accountOwner"> /// Account owner for Account object constructor. /// </param> /// <param name="accountSum"> /// Account sum for Account object constructor. /// </param> /// <param name="bonusScore"> /// Bonus score for Account object constructor. /// </param> /// <returns> /// Created Account instance. /// </returns> internal static Account CreateAccount(AccountType enumType, int accountNumber, string accountOwner, decimal accountSum, int bonusScore) { Type accountType = null; foreach (Type type in AccountTypes.AccountTypesArray) { if (enumType.ToString() == type.Name) { accountType = type; break; } } if (accountType == null) { throw new ArgumentException(message: $"Unknown account type ({enumType.ToString()}) - impossible to construct"); } Account newAccount = (Account)Activator.CreateInstance(accountType, accountNumber, accountOwner, accountSum, bonusScore); return(newAccount); }
private Account Given_an_account(AccountType type = AccountType.Sales) { return(Api.Accounts .Where(string.Format("Type == \"{0}\"", type.ToString().ToUpper())) .Find() .FirstOrDefault() ?? Api.Create(new Account { Name = Random.GetRandomString(20), Code = Random.GetRandomString(10), Type = type })); }
private Account Given_an_account(AccountType type = AccountType.Sales) { return Api.Accounts .Where(string.Format("Type == \"{0}\"", type.ToString().ToUpper())) .Find() .FirstOrDefault() ?? Api.Create(new Account { Name = Random.GetRandomString(20), Code = Random.GetRandomString(10), Type = type }); }
private async Task <Account> Given_an_account(AccountType type = AccountType.Sales) { return((await Api.Accounts .Where(string.Format("Type == \"{0}\" AND Status == \"ACTIVE\"", type.ToString().ToUpper())) .FindAsync()) .FirstOrDefault() ?? await Api.CreateAsync(new Account { Name = Random.GetRandomString(20), Code = Random.GetRandomString(10), Type = type })); }
public void SetAccountType(AccountType type) { if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor && this.mAccount != null) { AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.tendcloud.tenddata.TDGAAccount$AccountType"); AndroidJavaObject androidJavaObject = androidJavaClass.CallStatic<AndroidJavaObject>("valueOf", new object[] { type.ToString() }); this.mAccount.Call("setAccountType", new object[] { androidJavaObject }); } }
public void SetAccountType(AccountType type) { if (Application.platform != RuntimePlatform.OSXEditor && Application.platform != RuntimePlatform.WindowsEditor && this.mAccount != null) { AndroidJavaClass androidJavaClass = new AndroidJavaClass("com.tendcloud.tenddata.TDGAAccount$AccountType"); AndroidJavaObject androidJavaObject = androidJavaClass.CallStatic <AndroidJavaObject>("valueOf", new object[] { type.ToString() }); this.mAccount.Call("setAccountType", new object[] { androidJavaObject }); } }
private static bool TryParseAccountType(string value, out AccountType accountType) { var success = Enum.TryParse(value, out accountType); if (!success) return false; decimal d; var isInvalid = Decimal.TryParse(accountType.ToString(), out d); return !isInvalid; }
private HttpClient createHttpClient(Uri baseUri, string userName, string password, AccountType? accountType, IWebProxy proxy, bool compressionEnabled, TimeSpan timeout) { bool autenticationDisabled = string.IsNullOrEmpty(userName) && string.IsNullOrEmpty(password); HttpClientHandler handler = new HttpClientHandler { AutomaticDecompression = compressionEnabled ? DecompressionMethods.GZip | DecompressionMethods.Deflate : DecompressionMethods.None, Credentials = autenticationDisabled ? null : createCredentials(baseUri, userName, password), PreAuthenticate = !autenticationDisabled, UseProxy = proxy != null, Proxy = proxy }; HttpClient client = new HttpClient(handler, true) { BaseAddress = baseUri, Timeout = timeout }; client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(_defaultMediaType)); if (compressionEnabled) { client.DefaultRequestHeaders.AcceptEncoding.Add(StringWithQualityHeaderValue.Parse("gzip")); client.DefaultRequestHeaders.AcceptEncoding.Add(StringWithQualityHeaderValue.Parse("deflate")); } if (!autenticationDisabled && accountType != null) client.DefaultRequestHeaders.Add(_accountTypeHeaderName, accountType.ToString()); return client; }
private List<Guid> ReadIndex(AccountType accountType) { List<Guid> results = new List<Guid>(); Uri indexFileUri = new Uri("/" + accountType.ToString() + "Index.txt", UriKind.Relative); using (Package package = ZipPackage.Open(this.FilePath, System.IO.FileMode.OpenOrCreate)) { if (package.PartExists(indexFileUri)) { PackagePart indexPart = package.GetPart(indexFileUri); using (StreamReader reader = new StreamReader(indexPart.GetStream())) { string line = null; while ((line = reader.ReadLine()) != null) { Guid accountId = new Guid(line); results.Add(accountId); } } } } return results; }
public ActionResult DeleteProvider(string timelineId, string user, AccountType accountType) { var config = SocialAllianceConfig.Read(); var timelineConfig = config.ReadTimeline(timelineId, true); try { if (accountType == AccountType.youTube) { timelineConfig.YouTubeProviders.Remove(user); } else { timelineConfig.TwitterProviders.Remove(user); } SocialAllianceConfig.CreateOrUpdateTimeline(timelineConfig); } catch { TempData["Error"] = "There was an error deleting the entry, maybe it has already been deleted."; } return PartialView("_" + accountType.ToString() + "ProvidersListPartial", timelineConfig); }
private void SaveIndex(List<Guid> indexItems, AccountType accountType) { Dictionary<string, string> results = new Dictionary<string, string>(); Uri indexFileUri = new Uri("/" + accountType.ToString() + "Index.txt", UriKind.Relative); using (Package package = ZipPackage.Open(this.FilePath, System.IO.FileMode.OpenOrCreate)) { // Either get the existing PackagePart or create a new one PackagePart indexPart = null; if (package.PartExists(indexFileUri)) { indexPart = package.GetPart(indexFileUri); } else { indexPart = package.CreatePart(indexFileUri, "text/xml"); } // Now write the settings to the package using (StreamWriter sw = new StreamWriter(indexPart.GetStream())) { foreach (Guid accountId in indexItems) { sw.WriteLine(accountId.ToString()); } } } }
/// <summary> /// Creates an account given the <see cref="T:AccountType"/> to create. /// </summary> /// <param name="accountType">The <see cref="T:AccountType"/> of the account to create.</param> /// <returns>The newly created account.</returns> public static Account Create(AccountType accountType) { return Create(accountType.ToString()); }
public AccountBase CreateAccount(AccountType accountType) { var objectHandle = Activator.CreateInstance(null, string.Format("{0}Account", accountType.ToString())); return (AccountBase)objectHandle.Unwrap(); }