本文整理汇总了C#中CustomerRepository类的典型用法代码示例。如果您正苦于以下问题:C# CustomerRepository类的具体用法?C# CustomerRepository怎么用?C# CustomerRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CustomerRepository类属于命名空间,在下文中一共展示了CustomerRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Customers
public JsonResult Customers(string term)
{
term = term.ToLower();
IList<string> custList = new CustomerRepository(_sqlConnectionString).CustomerNamesList;
var result = custList.Where(c => c.ToLower().Contains(term)).Take(10);
return Json(result, JsonRequestBehavior.AllowGet);
}
示例2: Initialize
public void Initialize()
{
connection = Effort.DbConnectionFactory.CreateTransient();
databaseContext = new TestContext(connection);
objRepo = new CustomerRepository(databaseContext);
}
示例3: BankAccountRepositoryAddNewItemSaveItem
public void BankAccountRepositoryAddNewItemSaveItem()
{
//Arrange
var unitOfWork = new MainBCUnitOfWork();
var customerRepository = new CustomerRepository(unitOfWork);
var bankAccountRepository = new BankAccountRepository(unitOfWork);
var customer = customerRepository.Get(new Guid("43A38AC8-EAA9-4DF0-981F-2685882C7C45"));
var bankAccountNumber = new BankAccountNumber("1111", "2222", "3333333333", "01");
var newBankAccount = BankAccountFactory.CreateBankAccount(customer,bankAccountNumber);
//Act
bankAccountRepository.Add(newBankAccount);
try
{
unitOfWork.Commit();
}
catch (DbUpdateException ex)
{
var entry = ex.Entries.First();
}
}
示例4: ConverttoEntity
public static Installation ConverttoEntity(InstallationModel ininstallation)
{
Installation installation = null;
try
{
CustomerRepository crepo = new CustomerRepository();
MeasurementRepository mrepo = new MeasurementRepository();
installation = new Installation();
installation.customerid = ininstallation.customerid;
installation.installationid = ininstallation.installationid;
installation.latitude = ininstallation.latitude;
installation.longitude = ininstallation.longitude;
installation.description = ininstallation.description;
installation.serialno = ininstallation.serialno;
//installation.Customer = ConvertCustomer.ConverttoEntity(crepo.GetById(installation.customerid));
foreach (var item in ininstallation.Measurement)
{
installation.Measurement.Add(ConvertMeasurement.ConverttoEntity(mrepo.GetById(item)));
}
log.Info("InstallationModel wurde konvertiert.");
}
catch (Exception exp)
{
log.Error("InstallationModel konnte nicht konvertiert werden.");
throw new DalException("InstallationModel konnte nicht konvertiert werden.", exp);
}
return installation;
}
示例5: CustomerService
//public CustomerService(OrderRepository orderRepo, ApplicationUserManager userMan)
public CustomerService(UserAddressRepository userAddressRepo, OrderRepository orderRepo, CustomerRepository customerRepo, ApplicationUserManager userMan)
{
_userAddressRepo = userAddressRepo;
_orderRepo = orderRepo;
_customerRepo = customerRepo;
_userManager = userMan;
}
示例6: CustomerRepositoryAddNewItemSaveItem
public void CustomerRepositoryAddNewItemSaveItem()
{
//Arrange
var unitOfWork = new MainBCUnitOfWork();
ICustomerRepository customerRepository = new CustomerRepository(unitOfWork);
var countryId = new Guid("32BB805F-40A4-4C37-AA96-B7945C8C385C");
var customer = CustomerFactory.CreateCustomer("Felix", "Trend", countryId, new Address("city", "zipCode", "addressLine1", "addressLine2"));
customer.Id = IdentityGenerator.NewSequentialGuid();
customer.Picture = new Picture()
{
Id = customer.Id
};
//Act
customerRepository.Add(customer);
customerRepository.UnitOfWork.Commit();
//Assert
var result = customerRepository.Get(customer.Id);
Assert.IsNotNull(result);
Assert.IsTrue(result.Id == customer.Id);
}
示例7: Main
static void Main(string[] args)
{
using (var context = new DatabaseContext())
{
ICustomerRepository customers = new CustomerRepository(context);
IProductRepository products = new ProductRepository(context);
var github = new Customer() { IsActive = true, Name = "GitHub" };
var microsoft = new Customer() {IsActive = true, Name = "Microsoft"};
var apple = new Customer() { IsActive = false, Name = "Apple" };
customers.Create(github);
customers.Create(microsoft);
customers.Create(apple);
var windows = new Product()
{
CustomerId = microsoft.Id,
Description = "The best OS!",
Name = "Windows 10",
Sku = "AWESOME1"
};
var sourceControl = new Product()
{
CustomerId = github.Id,
Description = "The best hosted source control solution!",
Name = "GitHub Enterprise",
Sku = "AWESOME2"
};
var iphone = new Product()
{
CustomerId = apple.Id,
Description = "The best phone ever created!",
Name = "iPhone 6S",
Sku = "AWESOME3"
};
products.Create(windows);
products.Create(sourceControl);
products.Create(iphone);
foreach (var customer in customers.All.WhereIsActive().ToList())
{
Console.WriteLine(customer.Name);
}
foreach (var customer in customers.GetAllWithProducts().WhereNameBeginsWith("Git").WhereIsActive().ToList())
{
Console.WriteLine(customer.Name);
foreach (var product in customer.Products)
{
Console.WriteLine("-- {0}", product.Name);
}
}
}
}
示例8: GetCustomerRepository
public CustomerRepository GetCustomerRepository()
{
if (customerRepo == null)
{
customerRepo = new CustomerRepository();
}
return customerRepo;
}
示例9: GetOrderById
public Order GetOrderById(int OrderId)
{
_customerRepository = new CustomerRepository();
var order = _context.Orders.Single(o => o.OrderId == OrderId);
if (order.CustomerId.Length > 0)
order.Customer = _customerRepository.GetCustomerByCustomerId(order.CustomerId);
return order;
}
示例10: AllCustomersViewModel
public AllCustomersViewModel(CustomerRepository customerRepository)
{
_customerRepository = customerRepository;
_customerRepository.CustomerAdded += this.OnCustomerAddedToRepository;
base.DisplayName = "AllCustomersViewModelDisplayName";
this.CreateAllCustomers();
}
示例11: ProfileController
public ProfileController()
{
_currencyRepository = new CurrencyRepository();
_balanceRepository = new BalanceRepository();
_cardRepository = new CardRepository();
_customerRepository = new CustomerRepository();
_accountRepository = new AccountRepository();
}
示例12: TransferFundsController
public TransferFundsController()
{
_accountRepository = new AccountRepository();
_cardRepository = new CardRepository();
_customerRepository = new CustomerRepository();
_transactionRepository = new TransactionRepository();
_transactionTypeRepository = new TransactionTypeRepository();
_balanceRepository = new BalanceRepository();
}
示例13: UnitOfWork
public UnitOfWork(LuaContext context)
{
_context = context;
Authors = new AuthorRepository(_context);
Books = new BookRepository(_context);
Customers = new CustomerRepository(_context);
Rentals = new RentalRepository(_context);
Stocks = new StockRepository(_context);
}
示例14: AptekaNetUnitOfWork
public AptekaNetUnitOfWork()
{
Context = new AptekaNETDbContext();
OrderRepository = new OrderRepository(Context);
EmployeeRepository = new EmployeeRepository(Context);
CustomerRepository = new CustomerRepository(Context);
MedicineRepository = new MedicineRepository(Context);
ProductRepository = new ProductRepository(Context);
PharmacyRepository = new PharmacyRepository(Context);
}
示例15: Get
public void Get()
{
using (var uow = UnitOfWork.Create(true))
{
var repository = new CustomerRepository(uow);
var cus = repository.GetById(1);
Assert.IsNotNull(cus);
uow.Complete();
}
}