Esempio n. 1
0
        public IFootPrintService AddOrUpdateFootPrint(User.IUserService user, UpdateFootPrintModel model)
        {
            IFootPrintStrategy strategy;

            if (model.Pid > 0)
            {
                strategy = new ProjFootPrintWithPidStrategy(user, model, _FootPrintServiceFactory, _FootPrintRepository, _StaticResourceManager, _ProjSourceManager, _FootPrintImgRepository);
            }
            else
            {
                strategy = new ProjFootPrintWithNameStrategy(user, model, _FootPrintServiceFactory, _FootPrintRepository, _StaticResourceManager, _ProjSourceManager, _FootPrintImgRepository);
            }

            var service = strategy.SaveFootPrint();

            var fid         = service.Fid;
            var taskFactory = new TaskFactory().StartNew(() =>
            {
                var url   = "http://api.fc.t.tgnet.com/Api/InitFootPrintAddress";
                var query = new System.Collections.Specialized.NameValueCollection();
                query.Add("fid", fid.ToString());
                FCRMAPI.RequstUtility.TransmitToMQ(url, query, null);
            });

            return(service);
        }
Esempio n. 2
0
 public UserKeepFitDiaryService(long kid, User.IUserService user,
                                IKeepFitDiaryRepository keepFitDiaryRepository,
                                IKeepFitDiaryImgRepository keepFitDiaryImgRepository)
     : base(kid, keepFitDiaryRepository, keepFitDiaryImgRepository)
 {
     _User = user;
 }
Esempio n. 3
0
 public UserDailyFoodService(
     long id,
     User.IUserService user,
     IDailyFoodRepository dailyFoodRepository)
     : base(id, dailyFoodRepository)
 {
     _User = user;
 }
Esempio n. 4
0
 public void UpdateRemark(User.IUserService user, string remark)
 {
     ExceptionHelper.ThrowIfNull(user, nameof(user));
     ExceptionHelper.ThrowIfTrue(_LazyEntity.Value.uid != user.Uid, "uid", "用户不允许修改他人的足迹");
     if (!string.IsNullOrWhiteSpace(remark))
     {
         _LazyEntity.Value.content = remark;
         _LazyEntity.Value.updated = DateTime.Now;
         _FootPrintRepository.SaveChanges();
     }
 }
Esempio n. 5
0
 public IUserKeepFitDiaryService GetService(User.IUserService user, long kid)
 {
     if (user != null)
     {
         return(new UserKeepFitDiaryService(kid, user, _KeepFitDiaryRepository, _KeepFitDiaryImgRepository));
     }
     else
     {
         return(new NoneUserKeepFitDiaryService(kid, _KeepFitDiaryRepository, _KeepFitDiaryImgRepository));
     }
 }
Esempio n. 6
0
 public IDailyFoodService GetService(long id, User.IUserService user)
 {
     if (user != null)
     {
         return(new UserDailyFoodService(id, user, _DailyFoodRepository));
     }
     else
     {
         return(new NoneUserDailyFoodService(id, _DailyFoodRepository));
     }
 }
Esempio n. 7
0
 public ProjFootPrintWithPidStrategy(
     User.IUserService user,
     UpdateFootPrintModel model,
     IFootPrintServiceFactory footPrintServiceFactory,
     IFootPrintRepository footPrintRepository,
     IStaticResourceManager staticResourceManager,
     Project.IProjSourceManager projSourceManager,
     IRepository <Data.FootPrintImg> footPrintImgRepository
     ) : base(user, model, footPrintServiceFactory, footPrintRepository, staticResourceManager, footPrintImgRepository)
 {
     ExceptionHelper.ThrowIfNotId(model.Pid, nameof(model.Pid));
     _Pid = model.Pid.Value;
     _ProjSourceManager = projSourceManager;
 }
Esempio n. 8
0
 public ProjFootPrintWithNameStrategy(
     User.IUserService user,
     UpdateFootPrintModel model,
     IFootPrintServiceFactory footPrintServiceFactory,
     IFootPrintRepository footPrintRepository,
     IStaticResourceManager staticResourceManager,
     Project.IProjSourceManager projSourceManager,
     IRepository <Data.FootPrintImg> footPrintImgRepository
     ) : base(user, model, footPrintServiceFactory, footPrintRepository, staticResourceManager, footPrintImgRepository)
 {
     ExceptionHelper.ThrowIfNullOrWhiteSpace(model.ProjName, nameof(model.ProjName));
     _Name = model.ProjName;
     _ProjSourceManager = projSourceManager;
 }
Esempio n. 9
0
 public InsitudeOfGrowthUserService(User.IUserService user,
                                    IRepository <Data.InstitudeOfGrowthTrade> institudeOfGrowthTradeRepository,
                                    IStudentRepository studentRepository,
                                    IRepository <Data.Class> classRepository,
                                    IRepository <Data.ClassStuRelation> classStuRelationRepository)
 {
     ExceptionHelper.ThrowIfNull(user, nameof(user));
     _User = user;
     _InstitudeOfGrowthTradeRepository = institudeOfGrowthTradeRepository;
     _StudentRepository          = studentRepository;
     _ClassRepository            = classRepository;
     _ClassStuRelationRepository = classStuRelationRepository;
     _LazyValue = new Lazy <Data.Student>(() => { return(GetOrCreate()); });
 }
Esempio n. 10
0
        public void InitFootPrintAddress(User.IUserService user)
        {
            var model = new UpdateFootPrintModel()
            {
                Fid       = _LazyEntity.Value.fid,
                Pid       = _LazyEntity.Value.pid,
                Address   = _LazyEntity.Value.address,
                Latitude  = _LazyEntity.Value.latitude,
                Longitude = _LazyEntity.Value.longitude,
            };

            model.Images = this.Imgs.Select(p => new FootImageInfo()
            {
                ImageKey  = p.imageKey,
                Address   = p.address,
                Latitude  = p.latitude,
                Longitude = p.longitude,
            }).ToArray();
            var strategy = new ProjFootPrintWithPidStrategy(user, model, _FootPrintServiceFactory, _FootPrintRepository, _StaticResourceManager, _ProjSourceManager, _FootPrintImgRepository);

            strategy.InitFootPrintAddress();
        }
Esempio n. 11
0
 public BaseFootPrintStrategy(User.IUserService user,
                              UpdateFootPrintModel model,
                              IFootPrintServiceFactory footPrintServiceFactory,
                              IFootPrintRepository footPrintRepository,
                              IStaticResourceManager staticResourceManager,
                              IRepository <Data.FootPrintImg> footPrintImgRepository
                              )
 {
     ExceptionHelper.ThrowIfNull(user, nameof(user));
     _User    = user;
     _Model   = model;
     _Uid     = user.Uid;
     _Fid     = model.Fid;
     _Address = model.Address;
     _Content = model.Content;
     _Tags    = model.TagId;
     _Image   = model.Images;
     _FootPrintServiceFactory = footPrintServiceFactory;
     _FootPrintRepository     = footPrintRepository;
     _StaticResourceManager   = staticResourceManager;
     _FootPrintImgRepository  = footPrintImgRepository;
 }
Esempio n. 12
0
 public UserController(ILogService logger, User.IUserService userSvc)
 {
     _logger      = logger;
     _userService = userSvc;
 }