public void a_AddValid() { var response = client.AddMasterAccount(entity); WasSuccessfulTest(response); Assert.True(response.Data.id > 0); Assert.True(response.Data.data_saved.id == response.Data.id); entity = response.Data.data_saved; }
public void UpdateAccountTest() { MasterAccount account = new MasterAccount(1) { AccountNumber = "MK0001", AccountName = "Mikel Master Account", ContactId = 1, CompanyId = 1, ContactRole = "Owner/Operator", BillingMethod = BillingMethod.CreditCard, EmailBillDataFile = true, EmailBill = true, PostBill = true, BillingAddressType = BillingAddressType.Physical, Password = "******", IsInvoiceRoot = true, HasRequestedInvoicing = true }; bool success = accountRepository.UpdateAccount(account); Assert.IsTrue(success); AirtimeBillingDataContext db = DbFactory.GetDataContext(); var saved = db.Accounts.Where(a => a.AccountId == account.Id.Value).SingleOrDefault(); Assert.IsNotNull(saved); Assert.AreEqual(account.AccountNumber, saved.AccountNumber, "Account Number"); Assert.AreEqual(account.AccountName, saved.AccountName, "Account Name"); Assert.AreEqual(account.ContactId, saved.ContactId, "Contact Id"); Assert.AreEqual(account.CompanyId, saved.CompanyId, "Company Id"); Assert.AreEqual(account.ContactRole, saved.ContactRole, "Contact Role"); Assert.AreEqual((int)account.BillingMethod, saved.BillingMethod, "Billing Method"); Assert.AreEqual(account.EmailBillDataFile, saved.EmailBillDataFile, "Email Bill Data File"); Assert.AreEqual(account.EmailBill, saved.EmailBill, "Email Bill"); Assert.AreEqual(account.PostBill, saved.PostBill, "Post Bill"); Assert.AreEqual((int)account.BillingAddressType, saved.BillingAddressType, "Billing Address Type"); Assert.AreEqual(account.Password, saved.Password, "Password"); Assert.AreEqual(account.IsInvoiceRoot, saved.IsInvoiceRoot, "Is Invoice Root"); Assert.AreEqual(account.HasRequestedInvoicing, saved.HasRequestedInvoicing, "Has Requested Invoicing"); }
public AddMasterAccountResponse AddMasterAccount(MasterAccount entity) { var response = client.AddMasterAccount(entity); return new AddMasterAccountResponse(response); }
public EditMasterAccountResponse EditMasterAccount(MasterAccount entity) { var response = client.EditMasterAccount(entity); return new EditMasterAccountResponse(response); }
protected void SaveAccount(object sender, EventArgs e) { Account account; if (IsMaster) { var master = new MasterAccount(Account.AccountId.Value); if (hdnCompanyId.Value.Length > 0) { int id; if (int.TryParse(hdnCompanyId.Value, out id)) { if (id > 0) master.CompanyId = id; } } account = master; } else { var sub = new SubAccount(Account.AccountId.Value); if (hdnMasterAccountId.Value.Length > 0) { int id; if (int.TryParse(hdnMasterAccountId.Value, out id)) { if (id > 0) sub.MasterAccountId = id; } } account = sub; } account.AccountName = Account.AccountName; account.AccountNumber = Account.AccountNumber; account.BillingAddressType = Account.BillingAddressType; account.BillingMethod = Account.BillingMethod; account.ContactRole = Account.ContactRole; account.EmailBill = Account.EmailBill; account.EmailBillDataFile = Account.EmailBillDataFile; account.Password = Account.Password; account.PostBill = Account.PostBill; account.IsInvoiceRoot = Account.IsInvoiceRoot; account.IsInternational = Account.IsInternational; account.AmountPaid = Account.AmountPaid; account.PreviousBill = Account.PreviousBill; if (hdnContactId.Value.Length > 0) { int contactId; if (int.TryParse(hdnContactId.Value, out contactId)) { if (contactId > 0) account.ContactId = contactId; } } var request = new SaveAccountRequest { Account = account, User = Users.Current }; var response = AccountService.SaveAccount(request); if (response.IsSuccessful) { UserMessage.SetSuccess("Acount Saved"); } else { UserMessage.SetFailure(response.Message); } }
public static SubAccount CreateSubAccount(MasterAccount rootAccount) { var subAccount = new SubAccount(2) { AccountName = "Test Sub Account", AccountNumber = "LW0002", BillingAddressType = BillingAddressType.Postal, // Doesn't matter for sub accounts. BillingMethod = BillingMethod.CreditCard, // Doesn't matter for sub accounts. ContactId = rootAccount.ContactId, ContactRole = "CEO", EmailBill = false, IsInvoiceRoot = false, PostBill = true, EmailBillDataFile = false, HasRequestedInvoicing = false, Password = "******", MasterAccountId = rootAccount.Id.Value }; return subAccount; }
public static MasterAccount CreateRootInvoiceAccount(Contact rootContact) { var rootAccount = new MasterAccount(1) { AccountName = "Test Master Account", AccountNumber = "LW0001", BillingAddressType = BillingAddressType.Postal, BillingMethod = BillingMethod.Invoice, ContactId = rootContact.Id.Value, ContactRole = "CEO", EmailBill = false, IsInvoiceRoot = true, PostBill = true, EmailBillDataFile = false, HasRequestedInvoicing = false, Password = "******" }; return rootAccount; }
public static AirtimeBilling.Core.Entities.Account CreateEntity(this Account account) { if (account.ParentAccountId == null) { var entity = new MasterAccount(account.AccountId) { AccountNumber = account.AccountNumber, AccountName = account.AccountName, ContactId = account.ContactId, ContactRole = account.ContactRole, BillingMethod = (BillingMethod) Enum.Parse(typeof(BillingMethod), account.BillingMethod.ToString()), EmailBillDataFile = account.EmailBillDataFile, EmailBill = account.EmailBill, PostBill = account.PostBill, Password = account.Password, BillingAddressType = (BillingAddressType) Enum.Parse(typeof(BillingAddressType), account.BillingAddressType.ToString()), IsInvoiceRoot = account.IsInvoiceRoot, CompanyId = account.CompanyId, HasRequestedInvoicing = account.HasRequestedInvoicing, IsInternational = account.IsInternational, AmountPaid = account.AmountPaid, PreviousBill = account.PreviousBill }; return entity; } else { var entity = new AirtimeBilling.Core.Entities.SubAccount(account.AccountId) { AccountNumber = account.AccountNumber, AccountName = account.AccountName, ContactId = account.ContactId, ContactRole = account.ContactRole, BillingMethod = (BillingMethod) Enum.Parse(typeof(BillingMethod), account.BillingMethod.ToString()), EmailBillDataFile = account.EmailBillDataFile, EmailBill = account.EmailBill, PostBill = account.PostBill, Password = account.Password, BillingAddressType = (BillingAddressType) Enum.Parse(typeof(BillingAddressType), account.BillingAddressType.ToString()), IsInvoiceRoot = account.IsInvoiceRoot, MasterAccountId = account.ParentAccountId.Value, HasRequestedInvoicing = account.HasRequestedInvoicing, IsInternational = account.IsInternational, AmountPaid = account.AmountPaid, PreviousBill = account.PreviousBill }; return entity; } }
public IList<Account> GetSubAccounts(MasterAccount masterAccount) { return _accountRepository.GetAllSubAccounts(masterAccount.Id.Value); }