Beispiel #1
0
        public IDictionary <ModuleType, IModule> CreateModules()
        {
            Cmcl.Fixtures = CmclFixtures;
            Cmcl.Places   = CmclPlaces;

            var playersModule = new PlayersModule(Configuration.GameEngine, Players, Teams);

            //	Need to create just a Teams list object. Selecting the Teams Module has to refresh the potentially changed team.
            foreach (var team in Teams.Values)
            {
                team.Players      = new List <Player>(Players.Where(p => p.TeamName == team.TeamName));
                team.Formation[0] = team.Players[0];
                team.Formation[1] = team.Players[1];
            }
            var teamModule = new TeamModule(Teams);

            var competitionModule = new CompetitionsModule(new[] { Cmcl });
            var fixturesModule    = new FixturesModule(competitionModule.Competitions);
            var matchModule       = new MatchModule(new [] { Cmcl });

            Config.Configuration.GlobalWeek = () => Competition.GlobalWeek(new[] { Cmcl });

            return(new Dictionary <ModuleType, IModule>
            {
                { ModuleType.Team, teamModule },
                { ModuleType.SelectTeam, teamModule },
                { ModuleType.Fixtures, fixturesModule },
                { ModuleType.Competitions, competitionModule },
                { ModuleType.Match, matchModule },
                { ModuleType.Players, playersModule }
            });
        }
        public ActionResult TeamDataSave(FormCollection form)
        {
            int?       ID         = Convert.ToInt32(form["pageId"]);
            int        identityId = 0;
            TeamModule mdu        = new TeamModule();

            identityId = mdu.DoSaveData(form, ID);

            return(RedirectToAction("TeamDataEdit", new { ID = identityId }));
        }
        public ActionResult TeamDataAdd()
        {
            TeamDetailsDataModel defaultModel = new TeamDetailsDataModel();

            //defaultModel.Data.PUB_DT_STR = DateTime.UtcNow.AddHours(8).ToString("yyyy\\/MM\\/dd");
            //defaultModel.Data.DISABLE = false;
            defaultModel.Data.SQ = 1;
            //defaultModel.Data.HOME_PAGE_DISPLAY = true;
            TeamModule mdu    = new TeamModule();
            var        cities = mdu.GetCityData();

            TempData["cities"] = cities;
            return(View(defaultModel));
        }
        public ActionResult TeamDataEdit(int?ID)
        {
            if (!ID.HasValue)
            {
                return(RedirectToAction("TeamList"));
            }

            TeamDetailsDataModel model = new TeamDetailsDataModel();
            TeamModule           mdu   = new TeamModule();

            model = mdu.DoGetDetailsByID((int)ID);
            var cities = mdu.GetCityData();

            TempData["cities"] = cities;

            return(View(model));
        }
Beispiel #5
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // внедрение зависимостей
            NinjectModule teamModule     = new TeamModule();
            NinjectModule gameModule     = new GameModule();
            NinjectModule playerModule   = new PlayerModule();
            NinjectModule staduiumModule = new StaduimModule();
            NinjectModule serviceModule  = new ServiceModule("DefaultConnection");
            var           kernel         = new StandardKernel(teamModule, gameModule, playerModule, staduiumModule, serviceModule);

            kernel.Unbind <ModelValidatorProvider>();
            DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel));
        }
Beispiel #6
0
        public ActionResult Index(int?page, string qry, string sort, string disable, int?city, int?area)
        {
            TeamListViewModel model = new TeamListViewModel();

            model.Filter.CurrentPage  = page ?? 1;
            model.Filter.QueryString  = qry ?? string.Empty;
            model.Filter.SortColumn   = sort ?? string.Empty;
            model.Filter.Disable      = disable ?? string.Empty;
            model.Filter.CityID       = city;
            model.Filter.AreaID       = area;
            model.Filter.DoPagination = false;
            TeamModule mdu = new TeamModule();

            model.Result = mdu.DoGetList(model.Filter);

            TempData["CityData"] = mdu.GetCityData();
            return(View("Team", model));
        }
        public JsonResult TeamDataDelete(int?ID)
        {
            bool   success  = true;
            string messages = string.Empty;

            try
            {
                TeamModule mdu = new TeamModule();
                mdu.DoDeleteByID((int)ID);

                messages = "刪除成功";
            }
            catch (Exception ex)
            {
                success  = false;
                messages = ex.Message;
            }
            var resultJson = Json(new { success = success, messages = messages });

            return(resultJson);
        }
Beispiel #8
0
        public JsonResult GetCityArea(int?ID)
        {
            CityModel result      = new CityModel();
            string    jsonDataStr = string.Empty;
            bool      success     = true;
            string    messages    = string.Empty;

            try
            {
                TeamModule mdu = new TeamModule();
                result      = mdu.GetCityData().Where(s => s.ID == ID).First();
                jsonDataStr = JsonConvert.SerializeObject(result);
            }
            catch (Exception ex)
            {
                success  = false;
                messages = ex.Message;
            }
            var resultJson = Json(new { success = success, data = jsonDataStr, messages = messages });

            return(resultJson);
        }