Ejemplo 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);
        }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
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;
 }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
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;
 }