当前位置: 首页>>代码示例>>C#>>正文


C# CustomerRepository类代码示例

本文整理汇总了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);
 }
开发者ID:MarneeDear,项目名称:Terminal-Management-Applications,代码行数:7,代码来源:AutoCompleteController.cs

示例2: Initialize

        public void Initialize()
        {
            connection = Effort.DbConnectionFactory.CreateTransient();
            databaseContext = new TestContext(connection);
            objRepo = new CustomerRepository(databaseContext);

        }
开发者ID:asiertarancon,项目名称:atg.Concesionario,代码行数:7,代码来源:CustomerRepository.cs

示例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();
            }
        }
开发者ID:ljvblfz,项目名称:MicrosoftNLayerApp,代码行数:26,代码来源:BankAccountRepositoryTests.cs

示例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;
 }
开发者ID:daniel9992000,项目名称:bif5-sks-csharp,代码行数:28,代码来源:ConvertInstallation.cs

示例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;
 }
开发者ID:sakhibgareevrr,项目名称:re-pair,代码行数:8,代码来源:CustomerService.cs

示例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);
        }
开发者ID:gabrielsimas,项目名称:MicrosoftNLayerApp,代码行数:28,代码来源:CustomerRepositoryTests.cs

示例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);
                    }
                }
            }
        }
开发者ID:beingawesome,项目名称:Patterns,代码行数:59,代码来源:Program.cs

示例8: GetCustomerRepository

 public CustomerRepository GetCustomerRepository()
 {
     if (customerRepo == null)
     {
         customerRepo = new CustomerRepository();
     }
     return customerRepo;
 }
开发者ID:Darwiish,项目名称:MovieShopWeb,代码行数:8,代码来源:Facade.cs

示例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;
 }
开发者ID:yonglehou,项目名称:WebGoat.Net-1,代码行数:8,代码来源:OrderRepository.cs

示例10: AllCustomersViewModel

        public AllCustomersViewModel(CustomerRepository customerRepository)
        {
            _customerRepository = customerRepository;
            _customerRepository.CustomerAdded += this.OnCustomerAddedToRepository;
            base.DisplayName = "AllCustomersViewModelDisplayName";

            this.CreateAllCustomers();
        }
开发者ID:corecritter,项目名称:MVVMTest,代码行数:8,代码来源:AllCustomersViewModel.cs

示例11: ProfileController

 public ProfileController()
 {
     _currencyRepository = new CurrencyRepository();
     _balanceRepository = new BalanceRepository();
     _cardRepository = new CardRepository();
     _customerRepository = new CustomerRepository();
     _accountRepository = new AccountRepository();
 }
开发者ID:darkleia,项目名称:Bank,代码行数:8,代码来源:ProfileController.cs

示例12: TransferFundsController

 public TransferFundsController()
 { 
     _accountRepository = new AccountRepository();
     _cardRepository = new CardRepository();
     _customerRepository = new CustomerRepository();
     _transactionRepository = new TransactionRepository();
     _transactionTypeRepository = new TransactionTypeRepository();
     _balanceRepository = new BalanceRepository();
 }
开发者ID:darkleia,项目名称:Bank,代码行数:9,代码来源:TransferFundsController.cs

示例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);
 }
开发者ID:raduaron26,项目名称:Lua,代码行数:9,代码来源:UnitOfWork.cs

示例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);
 }
开发者ID:Bajena,项目名称:aptekanet,代码行数:10,代码来源:IAptekaNETUnitOfWork.cs

示例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();
     }
 }
开发者ID:nttung91,项目名称:PLSoft,代码行数:10,代码来源:Class1.cs


注:本文中的CustomerRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。