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); }
public UserKeepFitDiaryService(long kid, User.IUserService user, IKeepFitDiaryRepository keepFitDiaryRepository, IKeepFitDiaryImgRepository keepFitDiaryImgRepository) : base(kid, keepFitDiaryRepository, keepFitDiaryImgRepository) { _User = user; }
public UserDailyFoodService( long id, User.IUserService user, IDailyFoodRepository dailyFoodRepository) : base(id, dailyFoodRepository) { _User = user; }
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(); } }
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)); } }
public IDailyFoodService GetService(long id, User.IUserService user) { if (user != null) { return(new UserDailyFoodService(id, user, _DailyFoodRepository)); } else { return(new NoneUserDailyFoodService(id, _DailyFoodRepository)); } }
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; }
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; }
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()); }); }
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(); }
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; }
public UserController(ILogService logger, User.IUserService userSvc) { _logger = logger; _userService = userSvc; }