• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# CustomerRepository类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中CustomerRepository的典型用法代码示例。如果您正苦于以下问题:C# CustomerRepository类的具体用法?C# CustomerRepository怎么用?C# CustomerRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CustomerRepository类属于命名空间,在下文中一共展示了CustomerRepository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: GetAllWithNullArgument_ThrowsExceptions

        public void GetAllWithNullArgument_ThrowsExceptions()
        {
            using (CustomerRepository repository = new CustomerRepository())
            {
                IEnumerable<Customer> customers =
                    repository.GetAll(null);

                Assert.Fail("Show have thrown an ArgumentNullException.");
            }
        }
开发者ID:Division42LLC,项目名称:Division42.Data.Repository.EntityFramework,代码行数:10,代码来源:EntityFrameworkRepositoryBaseTests.cs


示例17: UsingTheRepo_WithoutOpeningItBefore_ThrowsException

        public void UsingTheRepo_WithoutOpeningItBefore_ThrowsException()
        {
            var customerMock = new Mock<CustomerRecord>();
            var lineFileMock = new Mock<ILineFile>();
            var repo = new CustomerRepository<CustomerRecord>(lineFileMock.Object, ';');

            Assert.Throws<RepositoryException>(() => repo.Store(customerMock.Object));
            Assert.Throws<RepositoryException>(() => repo.Delete(customerMock.Object));
            Assert.Throws<RepositoryException>(() => repo.Select(customerMock.Object));
            Assert.Throws<RepositoryException>(() => repo.Select(new Func<CustomerRecord, bool>(c => true)));
        }
开发者ID:jesuswasrasta,项目名称:CsvRepository,代码行数:11,代码来源:CustomerRepositoryTests.cs


示例18: GetNamesAndEmailTest

        public void GetNamesAndEmailTest()
        {
            // Arrange
            CustomerRepository repository = new CustomerRepository();
            var customerList = repository.Retrieve();

            // Act
            var query = repository.GetNamesAndEmail(customerList);

            // NOT REALLY A TEST
        }
开发者ID:jimxshaw,项目名称:samples-csharp,代码行数:11,代码来源:CustomerRepositoryTest.cs


示例19: TestThatErrorsAreExplicit

        /// <summary>
        /// Rule 5a) Missing data or errors must be made explicit.
        /// </summary>
        public void TestThatErrorsAreExplicit()
        {
            // create a repository
            var repo = new CustomerRepository();

            // find a customer by id
            var customer = repo.GetById(42);

            // what is the expected output?
            Console.WriteLine(customer.Id);
        }
开发者ID:javierholguera,项目名称:progressive_net_2015-intro_to_fsharp,代码行数:14,代码来源:QaEquality.cs


示例20: Wrong

        public static void Wrong()
        {
            var repository = new CustomerRepository();
            Customer customer = new Customer()
            {
                Name = "Michael L Perry",
                PhoneNumber = "222-9999"
            };

            repository.Save(customer);
        }
开发者ID:michaellperry,项目名称:Provable-APIs,代码行数:11,代码来源:5-Factories.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# CustomerRequest类代码示例发布时间:2022-05-24
下一篇:
C# CustomerInfoValidator类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap