private static AuthenticationService GetAuthenticationService() { var profile = new ProfileDao(); var token = new RsaTokenDao(); // 你可以隨時抽換 log 的紀錄方式,只需要實作 ILog var log = GetLog(); var result = new AuthenticationService(profile, token, log); return(result); }
public bool IsValid(string account, string password) { // 根據 account 取得自訂密碼 var profileDao = new ProfileDao(); var passwordFromDao = profileDao.GetPassword(account); // 根據 account 取得 RSA token 目前的亂數 var rsaToken = new RsaTokenDao(); var randomCode = rsaToken.GetRandom(account); // 驗證傳入的 password 是否等於自訂密碼 + RSA token亂數 var validPassword = passwordFromDao + randomCode; return(password == validPassword ? true : false); }
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>(); }); }
public ProfileBusiness(MardisContext context) { _profileDao = new ProfileDao(context); }
public UserBusiness(MardisContext context) : base(context) { _userDao = new UserDao(context); _taskCampaignDao = new TaskCampaignDao(context); _profileDao = new ProfileDao(context); }