Ejemplo n.º 1
0
 public DemandService(IDemandRepository demandRepository, ICustomerRepository customerRepository, IMapper mapper, IEnumerable <IDemandRepository> demandRepositories)
 {
     this._demandRepository   = demandRepository;
     this._customerRepository = customerRepository;
     this.mapper             = mapper;
     this.demandRepositories = demandRepositories;
 }
 public AppDemandController(IDemandRepository _demandRepository, IConfiguration _configurtaion, IDistributedCache _distributedCache, ICacheManager <AppDemand> _cacheManager, ILogger <AppDemandController> _logger)
 {
     demandRepo       = _demandRepository;
     configuration    = _configurtaion;
     distributedCache = _distributedCache;
     cacheManager     = _cacheManager;
     logger           = _logger;
 }
Ejemplo n.º 3
0
 public HomeController(IDemandRepository repository, IUserInformationRepository userRepository,
     IProgressRepository progressRepository)
 {
     this.repository = repository;
     this.userRepository = userRepository;
     this.progressRepository = progressRepository;
     PageSize = Settings.Default.PageSize;
     ListProviders.SetListProvider(() => new DemandListProvider());
 }
Ejemplo n.º 4
0
 public DemandService(IUnitOfWork unitOfWork,
                      IDemandRepository demandRepository,
                      ICompanyUserRepository companyUserRepository,
                      IMapper mapper)
 {
     this.unitOfWork            = unitOfWork;
     this.demandRepository      = demandRepository;
     this.companyUserRepository = companyUserRepository;
     this.mapper = mapper;
 }
 public void TestInitialize()
 {
     repository = new FakeDemandRepository(new List<Demand>{
         new Demand{City=CityDef.Dongguan,DemandLevel=DemandLevelDef.A,ProjectState=ProjectStateDef.InProgress},
         new Demand{City=CityDef.Dongguan,DemandLevel=DemandLevelDef.B,ProjectState=ProjectStateDef.InProgress},
         new Demand{City=CityDef.Dongguan,DemandLevel=DemandLevelDef.C,ProjectState=ProjectStateDef.InProgress},
         new Demand{City=CityDef.Dongguan,DemandLevel=DemandLevelDef.A,ProjectState=ProjectStateDef.Complete},
         new Demand{City=CityDef.Shenzhen,DemandLevel=DemandLevelDef.B,ProjectState=ProjectStateDef.Complete}
     });
 }
 public async Task <IHttpActionResult> GetDemandByUser()
 {
     try
     {
         _DemandRepository = new DemandRepository();
         return(Ok(await _DemandRepository.GetDemandByUser(User.Identity.Name)));
     }
     catch (Exception e)
     {
         return(BadRequest("Error: " + e.Message));
     }
 }
        public async Task <IHttpActionResult> AddDemand(Demand demand)
        {
            try
            {
                _DemandRepository = new DemandRepository();
                await _DemandRepository.AddDemand(demand);

                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest("Error: " + e.Message));
            }
        }
Ejemplo n.º 8
0
 public ReportService(IUnitOfWork unitOfWork,
                      IMapper mapper,
                      IDemandRepository demandRepository,
                      IApplicationUserRepository applicationUserRepository,
                      ICompanyAgentMappingRepository companyAgentMappingRepository,
                      IApplicationUserService applicationUserService,
                      IOrderOfUrgencyService orderOfUrgencyService,
                      ICompanyService companyService)
 {
     this.unitOfWork                    = unitOfWork;
     this.mapper                        = mapper;
     this.demandRepository              = demandRepository;
     this.applicationUserRepository     = applicationUserRepository;
     this.companyAgentMappingRepository = companyAgentMappingRepository;
     this.applicationUserService        = applicationUserService;
     this.orderOfUrgencyService         = orderOfUrgencyService;
     this.companyService                = companyService;
 }
Ejemplo n.º 9
0
 public void TestInitialize()
 {
     repository = new FakeDemandRepository(new List<Demand>{
         new Demand{City=CityDef.Dongguan,DemandType=DemandTypeDef.Communication,
             ProjectState=ProjectStateDef.InProgress},
         new Demand{City=CityDef.Dongguan,DemandType=DemandTypeDef.Vip,
             ProjectState=ProjectStateDef.InProgress},
         new Demand{City=CityDef.Dongguan,DemandType=DemandTypeDef.Intra,
             ProjectState=ProjectStateDef.InProgress},
         new Demand{City=CityDef.Dongguan,DemandType=DemandTypeDef.Emergency,
             ProjectState=ProjectStateDef.InProgress},
         new Demand{City=CityDef.Dongguan,DemandType=DemandTypeDef.Market,
             ProjectState=ProjectStateDef.Complete},
         new Demand{City=CityDef.Foshan,DemandType=DemandTypeDef.Communication,
             ProjectState=ProjectStateDef.InProgress},
         new Demand{City=CityDef.Shenzhen,DemandType=DemandTypeDef.Market,
             ProjectState=ProjectStateDef.Complete}
     });
 }
Ejemplo n.º 10
0
 public void TestInitialize()
 {
     repository = new FakeDemandRepository(new List<Demand>
     {
         new Demand{City=CityDef.Chaozhou,DemandLevel=DemandLevelDef.A,
             ProjectState=ProjectStateDef.InProgress,ReceiveDate=DateTime.Today.AddDays(-100)},
         new Demand{City=CityDef.Chaozhou,DemandLevel=DemandLevelDef.A,
             ProjectState=ProjectStateDef.InProgress,ReceiveDate=DateTime.Today.AddDays(-200)},
         new Demand{City=CityDef.Chaozhou,DemandLevel=DemandLevelDef.A,
             ProjectState=ProjectStateDef.InProgress,ReceiveDate=DateTime.Today.AddDays(-10)},
         new Demand{City=CityDef.Foshan,DemandLevel=DemandLevelDef.B,
             ProjectState=ProjectStateDef.InProgress,ReceiveDate=DateTime.Today.AddDays(-20)},
         new Demand{City=CityDef.Foshan,DemandLevel=DemandLevelDef.B,
             ProjectState=ProjectStateDef.Complete,ReceiveDate=DateTime.Today.AddDays(-100),
             ActualCompleteDate=DateTime.Today.AddDays(-30)
         },
         new Demand{City=CityDef.Chaozhou,DemandLevel=DemandLevelDef.C,
             ProjectState=ProjectStateDef.Complete,ReceiveDate=DateTime.Today.AddDays(-100),
             ActualCompleteDate=DateTime.Today.AddDays(-80)
         }
     });
 }
        public async Task <IHttpActionResult> GetBookById(string id)
        {
            try
            {
                _BookRepository   = new BookRepository();
                _DemandRepository = new DemandRepository();
                Book book = await _BookRepository.GetBookById(id);

                User user = await this.AppUserManager.FindByNameAsync(User.Identity.Name);

                if (await _DemandRepository.CheckDemandExist(user, book) == null)
                {
                    await _DemandRepository.AddDemand(new Demand()
                    {
                        Book = book, User = user
                    });
                }
                return(Ok(book));
            }
            catch (Exception e)
            {
                return(BadRequest("Error: " + e.Message));
            }
        }
Ejemplo n.º 12
0
 public DemandController(IDemandRepository repository, ILogger <DemandController> logger, IPublisher publisher)
 {
     _repository    = repository ?? throw new ArgumentNullException(nameof(repository));
     _logger        = logger;
     this.publisher = publisher;
 }
Ejemplo n.º 13
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="reviewrepository"></param>
 public DemandService(IDemandRepository demandrepository)
 {
     this._demandrepository = demandrepository;
 }
 public void TestInitialize()
 {
     repository = new FakeDemandRepository(new List<Demand>{
         new Demand {
             Id = 1,
             City = CityDef.Guangzhou,
             ProjectName = "project1",
             ReceiveDate = new DateTime(2013,11,11) },
         new Demand {
             Id = 2,
             City = CityDef.Guangzhou,
             ProjectName = "project2",
             ReceiveDate = new DateTime(2013,11,11) },
         new Demand {
             Id = 3,
             City = CityDef.Foshan,
             ProjectName = "project3",
             ReceiveDate = new DateTime(2013,11,11) },
         new Demand {
             Id = 4,
             City = CityDef.Foshan,
             ProjectName = "project4",
             ReceiveDate = new DateTime(2013,11,11) },
         new Demand {
             Id = 5,
             City = CityDef.Foshan,
             ProjectName = "project5",
             ReceiveDate = new DateTime(2013,11,11) }
         });
     controller = new HomeController(repository, new FakeUserRepository(), new FakeProgressRepository());
 }
Ejemplo n.º 15
0
 public DemandController(IDemandRepository demandRepository)
 {
     this._DemandRepository = demandRepository;
 }
 public DemandDataCollector(ISubscriber subscriber, IDemandRepository repository)
 {
     this._subscriber = subscriber;
     this._repository = repository;
 }