コード例 #1
0
ファイル: RestImporter.cs プロジェクト: SailScores/SailScores
        private IList <ScoreDto> MakeScores(
            SwObjects.Race swRace,
            List <SwObjects.Competitor> competitors,
            BoatClassDto boatClass,
            FleetDto fleet)
        {
            var retList = new List <ScoreDto>();

            foreach (var swScore in swRace.Results)
            {
                if (String.IsNullOrWhiteSpace(swScore.Code) &&
                    swScore.Place == 0)
                {
                    continue;
                }
                // Not going to import DNCs.
                // Sailwave can leave DNC in some codes when type is changed to scored.
                if (swScore.Code == "DNC" && swScore.ResultType == 3)
                {
                    continue;
                }

                var score = new ScoreDto
                {
                    Place = swScore.Place,
                    Code  = swScore.ResultType == 3 ? swScore.Code : null
                };
                var swComp = competitors.Single(c => c.Id == swScore.CompetitorId);
                score.CompetitorId = _competitors[swComp.Id].Id;

                retList.Add(score);
            }

            return(retList);
        }
コード例 #2
0
ファイル: RestImporter.cs プロジェクト: SailScores/SailScores
        private async Task <FleetDto> MakeNewFleet()
        {
            Console.Write("Enter the new fleet name > ");
            var className = Console.ReadLine().Trim();

            Console.Write("Enter the new fleet short name / abbreviation > ");
            var shortName = Console.ReadLine().Trim();

            var fleet = new FleetDto
            {
                Name      = className,
                ShortName = shortName,
                ClubId    = _club.Id,
                FleetType = Api.Enumerations.FleetType.SelectedBoats
            };

            try
            {
                var guid = await _apiClient.SaveFleet(fleet);

                fleet.Id = guid;
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Oh Noes! There was an exception: {ex}");
                throw;
            }

            return(fleet);
        }
コード例 #3
0
ファイル: MstGsController.cs プロジェクト: donimuzur/fms
        public JsonResult GetEmployeeData(string employeeId)
        {
            var      model = _employeeBLL.GetByID(employeeId);
            FleetDto data  = new FleetDto();

            data = _fleetBLL.GetVehicleByEmployeeId(model.EMPLOYEE_ID);
            model.EmployeeVehicle = data;
            return(Json(model));
        }
コード例 #4
0
ファイル: RestImporter.cs プロジェクト: SailScores/SailScores
        public async Task WriteSwSeriesToSS(SwObjects.Series series)
        {
            _club = await GetClub();

            _boatClass = await GetBoatClass();

            _fleet = await GetFleet();

            _season = await GetSeason();

            _series = await MakeSeries(series);

            _competitors = await GetCompetitors(series);
            await SaveRaces(series);
        }
コード例 #5
0
        public async Task <ActionResult <Guid> > Post([FromBody] FleetDto fleet)
        {
            if (!await _authService.CanUserEdit(User, fleet.ClubId))
            {
                return(Unauthorized());
            }
            var fleetBizObj = _mapper.Map <Fleet>(fleet);
            await _clubService.SaveNewFleet(fleetBizObj);

            var savedFleet =
                (await _clubService.GetAllFleets(fleet.ClubId))
                .First(c => c.Name == fleet.Name);

            return(Ok(savedFleet.Id));
        }
コード例 #6
0
ファイル: TraCrfController.cs プロジェクト: donimuzur/fms
        public JsonResult GetEmployee(string Id)
        {
            var      model = _employeeBLL.GetByID(Id);
            FleetDto data  = new FleetDto();

            if (CurrentUser.UserRole == Enums.UserRole.Fleet)
            {
                data = _fleetBLL.GetVehicleByEmployeeId(Id, "WTC");
                model.EmployeeVehicle = data;
                //model.
            }
            else
            {
                data = _fleetBLL.GetVehicleByEmployeeId(Id, "BENEFIT");
                model.EmployeeVehicle = data;
            }
            model.EmployeeVehicle = data;
            return(Json(model));
        }
コード例 #7
0
 public async Task <Guid> SaveFleet(FleetDto fleet)
 {
     return(await PostAsync <FleetDto>($"/api/fleets/", fleet));
 }
コード例 #8
0
ファイル: FleetBLL.cs プロジェクト: donimuzur/fms
        public void Save(FleetDto FleetDto, Login userLogin)
        {
            var dbFleet = Mapper.Map <MST_FLEET>(FleetDto);

            _FleetService.save(dbFleet, userLogin);
        }
コード例 #9
0
ファイル: FleetBLL.cs プロジェクト: donimuzur/fms
        public void Save(FleetDto FleetDto)
        {
            var dbFleet = Mapper.Map <MST_FLEET>(FleetDto);

            _FleetService.save(dbFleet);
        }