예제 #1
0
 public CampaignBusiness(MardisContext mardisContext) : base(mardisContext)
 {
     _campaignDao         = new CampaignDao(mardisContext);
     _sequenceBusiness    = new SequenceBusiness(mardisContext);
     _customerDao         = new CustomerDao(mardisContext);
     _taskCampaignDao     = new TaskCampaignDao(mardisContext);
     _statusTaskDao       = new StatusTaskDao(mardisContext);
     _campaignServicesDao = new CampaignServicesDao(mardisContext);
     _serviceDao          = new ServiceDao(mardisContext);
     _branchDao           = new BranchDao(mardisContext);
     _userCanpaignDao     = new UserCanpaignDao(mardisContext);
 }
        public TaskCampaignBusiness(MardisContext mardisContext, RedisCache distributedCache)
            : base(mardisContext)
        {
            _taskCampaignDao           = new TaskCampaignDao(mardisContext);
            _questionDetailDao         = new QuestionDetailDao(mardisContext);
            _statusTaskBusiness        = new StatusTaskBusiness(mardisContext, distributedCache);
            _sequenceBusiness          = new SequenceBusiness(mardisContext);
            _campaignServicesDao       = new CampaignServicesDao(mardisContext);
            _branchDao                 = new BranchDao(mardisContext);
            _answerDao                 = new AnswerDao(mardisContext);
            _answerDetailDao           = new AnswerDetailDao(mardisContext);
            _branchImageBusiness       = new BranchImageBusiness(mardisContext);
            _userDao                   = new UserDao(mardisContext);
            _campaignDao               = new CampaignDao(mardisContext);
            _serviceDetailTaskBusiness = new ServiceDetailTaskBusiness(mardisContext);
            _personDao                 = new PersonDao(mardisContext);
            _profileDao                = new ProfileDao(mardisContext);
            _typeUserBusiness          = new TypeUserBusiness(mardisContext, distributedCache);
            _serviceDetailDao          = new ServiceDetailDao(mardisContext);
            _questionDao               = new QuestionDao(mardisContext);
            _redisCache                = distributedCache;
            _serviceDetailBusiness     = new ServiceDetailBusiness(mardisContext);

            Mapper.Initialize(cfg =>
            {
                cfg.CreateMap <Service, MyTaskServicesViewModel>()
                .ForMember(dest => dest.ServiceDetailCollection, opt => opt.MapFrom(src => src.ServiceDetails.OrderBy(sd => sd.Order)));
                cfg.CreateMap <ServiceDetail, MyTaskServicesDetailViewModel>()
                .ForMember(dest => dest.QuestionCollection, opt => opt.MapFrom(src => src.Questions.OrderBy(q => q.Order)))
                .ForMember(dest => dest.Sections, opt => opt.MapFrom(src => src.Sections.OrderBy(s => s.Order)));
                cfg.CreateMap <Question, MyTaskQuestionsViewModel>()
                .ForMember(dest => dest.HasPhoto, opt => opt.MapFrom(src => src.HasPhoto.IndexOf("S", StringComparison.Ordinal) >= 0))
                .ForMember(dest => dest.QuestionDetailCollection, opt => opt.MapFrom(src => src.QuestionDetails.OrderBy(qd => qd.Order)))
                .ForMember(dest => dest.CodeTypePoll, opt => opt.MapFrom(src => src.TypePoll.Code));
                cfg.CreateMap <QuestionDetail, MyTaskQuestionDetailsViewModel>();
            });
        }