Exemple #1
0
        static public List <Point> GetAllPointsForAudit(Audit audit)
        {
            List <Point> ResultPoints = new List <Point>();

            using (PointRepository Pointrepo = new PointRepository())
            {
                foreach (var item in audit.resultats)
                {
                    ResultPoints.Add(item.point);
                }
            }
            return(ResultPoints);
        }
Exemple #2
0
        public async Task <PointUpdateTransactionResponse> Handle(PointCreateTransactionRequest request, CancellationToken cancellationToken)
        {
            var point = await PointRepository.Add(new Infrastructure.Persistence.DTO.Point()
            {
                Name = request.Name
            }, cancellationToken);

            PointUpdateTransactionResponse response = new PointUpdateTransactionResponse();

            response.Point = new Model.PointModel()
            {
                Id = point.Id, Name = point.Name
            };
            return(response);
        }
Exemple #3
0
        static public List <Point> GetAllPoints()
        {
            List <Point> Pointtemp = null;

            using (PointRepository Pointrepo = new PointRepository())
            {
                Pointtemp = (List <Point>)Pointrepo.GetAll();
                foreach (Point Point in Pointtemp)
                {
                    Pointrepo.context.Entry(Point).State = EntityState.Detached;
                }
            }

            return(Pointtemp);
        }
        public void Import()
        {
            Ac.WriteLn(AppServices.Strings.Loading);
            var points = new PointRepository <XyzPoint>();

            this.ReadPoints(this.Storage, points);
            //this.ReadSamplePoints(points);

            AddPointsToDrawing(points);

            var min = points.Min.ToPoint3d();
            var max = points.Max.ToPoint3d();

            Ac.ZoomTo(min, max);

            Ac.WriteLn(AppServices.Strings.XPointsLoaded, points.Count);
        }
 private void ReadSamplePoints(PointRepository <XyzPoint> repository)
 {
     repository.Add(new XyzPoint()
     {
         Id = "A", X = 1, Y = 5, Z = 1.1
     });
     repository.Add(new XyzPoint()
     {
         Id = "B", X = 8, Y = 2, Z = 2.22
     });
     repository.Add(new XyzPoint()
     {
         Id = "C", X = 2, Y = 9, Z = 3.333
     });
     repository.Add(new XyzPoint()
     {
         Id = "D", X = 8, Y = 4, Z = 4.4444
     });
 }
        public IActionResult Index()
        {
            FavouriteRepository favouriteRepository = new FavouriteRepository();
            List <Favourite>    favourites          = favouriteRepository.GetItems().Where(f => f.User_Id == _userManager.GetUserId(User)).ToList();

            PointRepository pointRepository = new PointRepository();
            List <Point>    points          = pointRepository.GetItems();

            List <JoinViewModel> joined = new List <JoinViewModel>();

            foreach (var el in favourites)
            {
                joined.Add(new JoinViewModel()
                {
                    Id       = el.Id,
                    NameFrom = points.First(p => p.Id == el.PointA_Id).Name,
                    NameTo   = points.First(p => p.Id == el.PointB_Id).Name
                });
            }

            return(View(joined));
        }
 public PointService(DatabaseContext db)
 {
     _PointRepo = new PointRepository(db);
     _db        = db;
 }
Exemple #8
0
 public PointsService(PointRepository pointRepository, IMapper mapper)
 {
     repository = pointRepository;
     _mapper    = mapper;
 }
 public ChartController(ApplicationContext dbContext)
 {
     pointRepository    = new PointRepository(dbContext);
     userDataRepository = new UserDataRepository(dbContext);
 }
Exemple #10
0
 public ServicesController(TripRepository tripRepository, PointRepository pointRepository)
 {
     _tripRepository  = tripRepository;
     _pointRepository = pointRepository;
 }
 public AdminsController(EmployeeRepository employeeRepository, RoleRepository roleRepository, PointRepository pointRepository)
 {
     this.employeeRepository = employeeRepository;
     this.roleRepository     = roleRepository;
     this.pointRepository    = pointRepository;
 }
Exemple #12
0
 private async void GetPoints()
 {
     this.Points = await PointRepository.GetPoints();
 }
 public PointController(PointTypeRepository pointTypeRepository, PointRepository pointRepository, RuleRepository ruleRepository)
 {
     this.pointTypeRepository = pointTypeRepository;
     this.pointRepository     = pointRepository;
     this.ruleRepository      = ruleRepository;
 }
Exemple #14
0
 public PointService()
 {
     _pointRepository = new PointRepository();
 }
Exemple #15
0
        public BaseGetResponse <CheckResult> CheckByScanQrcode([FromUri] string code, [FromUri] string sessionkey)
        {
            var res = new BaseGetResponse <CheckResult>()
            {
                Code = -1, Msg = "没有这个打卡点", Data = null
            };

            //TODO:
            //1.检查是否有这个用户
            var user = UserRepository.FindUser(sessionkey);

            if (user == null)
            {
                res.Msg  = "会话已过期,需要重新登录";
                res.Code = 1;
                return(res);
            }
            //2.检查是否有这个二维码对应的打卡点
            DBCommon.Model.DBPoint point = null;
            point = PointRepository.FindPoint(code);
            if (point == null)
            {
                return(res);
            }

            //找出该打卡点当前时间正在进行的支部活动
            var BA_list = PointRepository.FindBranchActionByPointID(point.ID);

            BA_list = BA_list.Where(a => a.BranchID.Equals(user.BranchID)).ToList();
            bool isBranchAction = false;

            if (BA_list.Count > 0)
            {
                isBranchAction = true;
            }


            //3.打卡是否重复,不重复则写入数据库,重复则返回打卡失败
#warning 需要完善步骤
            if (isBranchAction)
            {
                string title = "";
                int    num   = 0;
                foreach (var action in BA_list)
                {
                    var dataresult = ScoreRepository.BA_Signin(action.ID, user.OpenID);
                    if (dataresult != null)
                    {
                        num++;
                        title += string.Format("[{0}.{1}]", num, dataresult.CheckPoint);
                    }
                    else
                    {
                        res.Msg  = "打卡失败,没有找到未打卡的支部活动";
                        res.Code = 4;
                    }
                }
                if (num > 0)
                {
                    res.Msg  = "打卡成功";
                    res.Code = 0;
                    res.Data = new CheckResult()
                    {
                        CheckPoint = string.Format("{0}共{1}个活动打卡", title, num),
                        CheckTime  = DateTime.Now
                    };
                }
                else
                {
                    return(res);
                }
            }
            else
            {
                string dataid = ScoreRepository.IsSignined(point.ID, user.OpenID);
                if (dataid != null)
                {
                    res.Msg  = "今天已打卡,请勿重复打卡";
                    res.Code = 2;
                    return(res);
                }
                var dataresult = ScoreRepository.Signin(point.ID, user.OpenID);
                if (dataresult != null)
                {
                    res.Msg  = "打卡成功";
                    res.Code = 0;
                    res.Data = dataresult;
                }
                else
                {
                    res.Msg  = "打卡失败,未知错误";
                    res.Code = 4;
                }
            }
            //var resultModel = PointRepository.CheckByScanQrcode(code, sessionkey);

            return(res);
        }
Exemple #16
0
        public async Task <Unit> Handle(PointDeleteTransactionRequest request, CancellationToken cancellationToken)
        {
            var success = await PointRepository.Delete(request.Id, cancellationToken);

            return(Unit.Value);
        }
Exemple #17
0
        public BaseGetResponse <string> LanchAction(dynamic data)
        {
            var res = new BaseGetResponse <string>()
            {
                Code = -1, Msg = "没有这个打卡点", Data = null
            };

            DBCommon.Model.DBBranchAction action = new DBCommon.Model.DBBranchAction();
            string session = data.Session;
            var    user    = UserRepository.FindUser(session);

            if (user != null)
            {
                if (user.IsManager)
                {
                    action.BranchID = user.BranchID;
                }
                else
                {
                    res.Code = 2;
                    res.Msg  = "只有管理员才能发起支部活动";
                    return(res);
                }
            }
            else
            {
                res.Code = 1;
                res.Msg  = "用户登录超时";
                return(res);
            }

            action.BeginTime = data.BeginTime;
            action.EndTime   = data.EndTime;
            action.Title     = data.Title;
            action.PointID   = data.PointID;


            var point = PointRepository.FindPointById(action.PointID);

            if (point == null)
            {
                res.Code = 3;
                res.Msg  = "没有这个打卡点";
                return(res);
            }

            string id = BranchActionRepository.LanuchAction(action);

            if (string.IsNullOrEmpty(id))
            {
                res.Code = 2;
                res.Msg  = "数据库错误,发起活动失败";
                return(res);
            }

            res.Code = 0;
            res.Msg  = "发起活动成功";
            res.Data = id;

            return(res);
        }
Exemple #18
0
 public EmployeesController(EmployeeRepository employeeRepository, DepartmentRepository departmentRepository, RoleRepository roleRepository, PointRepository pointRepository)
 {
     this.employeeRepository   = employeeRepository;
     this.departmentRepository = departmentRepository;
     this.roleRepository       = roleRepository;
     this.pointRepository      = pointRepository;
 }
Exemple #19
0
 //Methods
 private async void GetUserPoints()
 {
     this.TotalPoints = await PointRepository.GetTotalPoints();
 }
        public DistancesService(DistanceRepository distanceRepository, IMapper mapper, PointRepository pointRepository, MapRepository mapRepository)
        {
            repository       = distanceRepository;
            _mapper          = mapper;
            _pointRepository = pointRepository;
            _mapRepository   = mapRepository;

            CreateGraphs();
        }
Exemple #21
0
 /// <summary>
 /// Ctor
 /// </summary>
 public PointService()
 {
     this._pointRepository = new PointRepository();
     this._cacheManager    = new CacheManager();
 }
Exemple #22
0
 public PointController()
 {
     this.pointRepository = new PointRepository();
 }