示例#1
0
        public int CreateCompetition(CreateCompetitionInfo competitionCreateInfo)
        {
            var repository = ServiceProvider.Get <ICompetitionRepository>();

            competitionCreateInfo.ReferenceId = Guid.NewGuid().ToString();
            var result = repository.Create(competitionCreateInfo);

            return(result);
        }
示例#2
0
 private void MapCompetitionToData(CreateCompetitionInfo createCompetitionInfo, Competition competition)
 {
     competition.ReferenceId      = createCompetitionInfo.ReferenceId;
     competition.Name             = createCompetitionInfo.Name;
     competition.StartDate        = createCompetitionInfo.StartTime;
     competition.TypeId           = createCompetitionInfo.TypeId;
     competition.Site             = createCompetitionInfo.Site;
     competition.SitePhone        = createCompetitionInfo.SitePhone;
     competition.MainReferee      = createCompetitionInfo.MainReferee;
     competition.MainRefereePhone = createCompetitionInfo.MainRefereePhone;
     competition.EndTime          = createCompetitionInfo.EndTime;
 }
        private static CreateCompetitionInfo CreateCompetitionInfo(CreateCompetitionParameters parameters)
        {
            var createCompetitionInfo = new CreateCompetitionInfo();

            createCompetitionInfo.Name             = parameters.Name;
            createCompetitionInfo.StartTime        = parameters.StartTime;
            createCompetitionInfo.EndTime          = parameters.EndTime;
            createCompetitionInfo.TypeId           = parameters.Type;
            createCompetitionInfo.MainReferee      = parameters.MainReferee;
            createCompetitionInfo.MainRefereePhone = parameters.MainRefereePhone;
            createCompetitionInfo.Site             = parameters.Site;
            createCompetitionInfo.SitePhone        = parameters.SitePhone;
            return(createCompetitionInfo);
        }
示例#4
0
        public void Create(CreateCompetitionInfo competitionCreateInfo)
        {
            using (var scope = new System.Transactions.TransactionScope())
            {
                var competitionsEngine = ServiceProvider.Get <ICompetitionsEngine>();
                var competitionId      = competitionsEngine.CreateCompetition(competitionCreateInfo);

                if (competitionCreateInfo.PlayersFileUrl.NotNullOrEmpty())
                {
                    UpdateCompetitionPlayers(competitionId, competitionCreateInfo.PlayersFileUrl);
                }

                scope.Complete();
            }
        }
示例#5
0
        public int Create(CreateCompetitionInfo createCompetitionInfo)
        {
            Requires.ArgumentNotNull(createCompetitionInfo, "headerInfo");
            Requires.IntArgumentPositive(createCompetitionInfo.TypeId, "headerInfo.TypeId");

            var result = default(int);

            UseDataContext(
                dataContext =>
            {
                var competitionData = new Competition();
                MapCompetitionToData(createCompetitionInfo, competitionData);
                SetNewDataEntityCommonParameter(competitionData);
                dataContext.Competitions.InsertOnSubmit(competitionData);
                dataContext.SubmitChanges();

                result = competitionData.Id;
            });
            return(result);
        }