当前位置: 首页>>代码示例>>C#>>正文


C# Event.Parse方法代码示例

本文整理汇总了C#中Event.Parse方法的典型用法代码示例。如果您正苦于以下问题:C# Event.Parse方法的具体用法?C# Event.Parse怎么用?C# Event.Parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Event的用法示例。


在下文中一共展示了Event.Parse方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NewNominations

        public ActionResult NewNominations(string dtStart = "", string dtEnd = "", string league = "0")
        {
            ViewData["PageTitle"] = "Twoje nowe nominacje";
            ((List<BreadcrumbHelper>)ViewData["breadcrumbs"]).Add(
                new BreadcrumbHelper { Href = "#", Text = "Nowe nominacje" }
            );
            if (CurrentReferee != null)
            {
                var NominatedReferees = Unit.NominatedRepository.Get(filter: n => n.RefereeId == CurrentReferee.Id && !n.Confirmed); //GNRepository.Get();
                List<int> RefNominationsIDS = new List<int>();
                foreach (var nominated in NominatedReferees)
                {
                    RefNominationsIDS.Add(nominated.NominationId);
                }
                var Nominations = Unit.NominationRepository.Get(n => n.Published && RefNominationsIDS.Contains(n.Id), n => n.OrderByDescending(o => o.PublishDate));

                FillSearchNominationsForm(Nominations, dtStart, dtEnd, league);

                List<NominationDetails> NominationEvents = new List<NominationDetails>();
                foreach (Nomination _nomination in Nominations)
                {
                    Event _event = new Event();
                    if (_nomination.GameId != null)
                    {
                        _event.Parse(_nomination.Game, "game");
                    }
                    else if (_nomination.TournamentId != null)
                    {
                        _event.Parse(_nomination.Tournament, "tournament");
                    }
                    else
                    {
                        throw new Exception("Brak typu nominacji");
                    }
                    NominationEvents.Add(new NominationDetails { Event = _event, Nomination = _nomination, NominatedReferees = _nomination.Nominateds });

                }
                ViewBag.Games = NominationEvents;
                return View("ListNominations", NominationEvents);
            }
            else
            {
                return RedirectToAction("Index");
            }
        }
开发者ID:jager,项目名称:Referee,代码行数:45,代码来源:HomeController.cs

示例2: Profile

        public ActionResult Profile()
        {
            if (this.CurrentUser != null)
            {
                string UserName = CurrentUser.UserName;
                RefereeEntity refereeentity = Unit.RefereeRepository.Get(filter: r => r.Mailadr == UserName).FirstOrDefault();
                if (refereeentity == null)
                {
                    return RedirectToAction("Index");
                }
                ViewData["PageTitle"] = String.Format("Profil: {0} {1}", refereeentity.FirstName, refereeentity.LastName);
                ((List<BreadcrumbHelper>)ViewData["breadcrumbs"]).Add(
                    new BreadcrumbHelper { Href = "#", Text = refereeentity.FirstName + " " + refereeentity.LastName }
                );

                var NominatedReferees = Unit.NominatedRepository.Get(filter: n => n.RefereeId == refereeentity.Id); //GNRepository.Get();
                List<int> RefNominationsIDS = new List<int>();
                foreach (var nominated in NominatedReferees)
                {
                    RefNominationsIDS.Add(nominated.NominationId);
                }
                var Nominations = Unit.NominationRepository.Get(n => n.Published && RefNominationsIDS.Contains(n.Id), n => n.OrderByDescending(o => o.PublishDate));
                List<NominationDetails> NominationEvents = new List<NominationDetails>();
                foreach (Nomination _nomination in Nominations)
                {
                    Event _event = new Event();
                    if (_nomination.GameId != null)
                    {
                        _event.Parse(_nomination.Game, "game");
                    }
                    else if (_nomination.TournamentId != null)
                    {
                        _event.Parse(_nomination.Tournament, "tournament");
                    }
                    else
                    {
                        throw new Exception("Brak typu nominacji");
                    }
                    NominationEvents.Add(new NominationDetails { Event = _event, Nomination = _nomination, NominatedReferees = _nomination.Nominateds });
                }
                ViewBag.Games = NominationEvents;
                return View("../Referee/Details", refereeentity);
            }
            return RedirectToAction("Index");
        }
开发者ID:jager,项目名称:Referee,代码行数:45,代码来源:HomeController.cs

示例3: Details

        public ViewResult Details(Guid id)
        {
            RefereeEntity refereeentity = Unit.RefereeRepository.GetById(id);
            var RefereeService = new RefereeEntityService(refereeentity);
            ViewBag.DaysOfNonAvilable = RefereeService.DaysOfNonAvailability(refereeentity.Availabilities.ToList<Availability>());

            ViewData["PageTitle"] = String.Format("Dane sędziego: {0} {1}", refereeentity.FirstName, refereeentity.LastName);
            ((List<BreadcrumbHelper>)ViewData["breadcrumbs"]).Add(
                new BreadcrumbHelper { Href = "#", Text = refereeentity.FirstName + " " + refereeentity.LastName }
            );
            ViewData["breadlinks"] = new List<BreadcrumbHelper>
            {
                new BreadcrumbHelper { Href = "/Referee", Text = "Listuj sędziów" },
                new BreadcrumbHelper { Href = "/Referee/Create", Text = "Dodaj sędziego", Role = HelperRoles.Administrator }
            };
            //GamesNominatedRepository GNRepository = new GamesNominatedRepository(id);
            var NominatedReferees = Unit.NominatedRepository.Get(filter: n => n.RefereeId == id); //GNRepository.Get();
            List<int> RefNominationsIDS = new List<int>();
            foreach (var nominated in NominatedReferees)
            {
                RefNominationsIDS.Add(nominated.NominationId);
            }
            var Nominations = Unit.NominationRepository.Get(n => n.Published && RefNominationsIDS.Contains(n.Id), n => n.OrderByDescending(o => o.PublishDate));
            List<NominationDetails> NominationEvents = new List<NominationDetails>();
            foreach (Nomination _nomination in Nominations)
            {
                Event _event = new Event();
                if (_nomination.GameId != null)
                {
                    _event.Parse(_nomination.Game, "game");
                }
                else if (_nomination.TournamentId != null)
                {
                    _event.Parse(_nomination.Tournament, "tournament");
                }
                else
                {
                    throw new Exception("Brak typu nominacji");
                }
                NominationEvents.Add(new NominationDetails { Event = _event, Nomination = _nomination, NominatedReferees = _nomination.Nominateds });
            }
            ViewBag.Games = NominationEvents;
            return View(refereeentity);
        }
开发者ID:jager,项目名称:Referee,代码行数:44,代码来源:RefereeController.cs

示例4: Create

        public ActionResult Create(int EventId, string Type)
        {
            Event Event = new Event();
            switch (Type)
            {
                case "tournament":
                    int tournamentId = EventId;
                    if (tournamentId > 0)
                    {
                        Event.Parse(Unit.TournamentRepository.GetById(tournamentId), Type);
                    }
                    break;

                case "game":
                default:
                    int gameId = EventId;
                    if (gameId > 0)
                    {
                        var g = Unit.NominationRepository.Get(filter: n => n.GameId == gameId);
                        if (g.Count() > 0)
                        {
                            return RedirectToAction("Edit", new { id = g.FirstOrDefault().Id });
                        }
                        Event.Parse(Unit.GameRepository.GetById(gameId), Type);
                    }
                    break;
            }
            if (Event.Name == null)
            {
                throw new Exception("Unknown event. Could not parse this event from given ident");
            }

            ViewData["PageTitle"] = "Dodaj nową obsadę";
            ((List<BreadcrumbHelper>)ViewData["breadcrumbs"]).Add(
                new BreadcrumbHelper { Href = "#", Text = "Nowa obsada" }
            );
            ViewData["breadlinks"] = new List<BreadcrumbHelper>
            {
                new BreadcrumbHelper { Href = "/Nomination", Text = "Pokaż nominacje" }
            };

            ViewBag.Event = Event;
            ViewBag.Conflicts = GetConflictNominations(Event.MinDate, Event.MaxDate);
            return View();
        }
开发者ID:jager,项目名称:Referee,代码行数:45,代码来源:NominationController.cs

示例5: CreateEvent

 private Event CreateEvent(Nomination nomination)
 {
     Event Event = new Event();
     if (nomination.GameId != null)
     {
         Event.Parse(nomination.Game, "game");
     }
     else
     {
         Event.Parse(nomination.Tournament, "tournament");
     }
     return Event;
 }
开发者ID:jager,项目名称:Referee,代码行数:13,代码来源:NominationController.cs

示例6: Index

        //
        // GET: /Nomination/
        //[Authorize(Roles = HelperRoles.Sedzia)]
        public ViewResult Index(string dtStart = "", string dtEnd = "", string league = "0", bool Published = false, bool NotPublished = false)
        {
            var Nominations = FillSearchNominationsForm(Unit.NominationRepository.Get(), dtStart, dtEnd, league, Published, NotPublished);
            List<NominationDetails> NominationEvents = new List<NominationDetails>();
            foreach (Nomination _nomination in Nominations)
            {
                Event _event = new Event();
                if (_nomination.GameId != null)
                {

                    _event.Parse(_nomination.Game, "game");
                }
                else if (_nomination.TournamentId != null)
                {
                    _event.Parse(_nomination.Tournament, "tournament");
                }
                else
                {
                    throw new Exception("Brak typu nominacji");
                }
                NominationEvents.Add(new NominationDetails {  Event = _event, Nomination = _nomination, NominatedReferees = _nomination.Nominateds } );
            }
            if (!Request.IsAuthenticated)
            {
                return View("ListNominationsUnauthorized", NominationEvents.OrderByDescending(x => x.Event.MinDate));
            }
            return View("ListNominations", NominationEvents.OrderByDescending(x => x.Event.MinDate));
        }
开发者ID:jager,项目名称:Referee,代码行数:31,代码来源:NominationController.cs

示例7: Edit

        public ActionResult Edit(int id)
        {
            Nomination nomination = Unit.NominationRepository.GetById(id);
            string Type = "";
            if (nomination.GameId != null)
            {
                Type = "game";
            }
            else if (nomination.TournamentId != null)
            {
                Type = "tournament";
            }

            Event Event = new Event();
            switch (Type)
            {
                case "tournament":
                    int TournamentId = (int)nomination.TournamentId;
                    if (TournamentId > 0)
                    {
                        Event.Parse(Unit.TournamentRepository.GetById(TournamentId), Type);
                    }
                    break;

                case "game":
                default:
                    int gameId = (int)nomination.GameId;
                    if (gameId > 0)
                    {
                        Event.Parse(Unit.GameRepository.GetById(gameId), Type);
                    }
                    break;
            }
            if (Event.Name == null)
            {
                throw new Exception("Unknown event. Could not parse this event from given ident");
            }
            ViewData["PageTitle"] = "Edytuj obsadę";
            ((List<BreadcrumbHelper>)ViewData["breadcrumbs"]).Add(
                new BreadcrumbHelper { Href = "#", Text = String.Format("Obsada dla {0}", Event.Name) }
            );
            ViewData["breadlinks"] = new List<BreadcrumbHelper>
            {
                new BreadcrumbHelper { Href = "/Nomination", Text = "Pokaż nominacje" }
            };
            ViewData["RefereeId"] = Unit.RefereeRepository.Get();
            ViewData["FunctionId"] = Unit.FunctionRepository.Get();
            ViewBag.Event = Event;
            return View(nomination);
        }
开发者ID:jager,项目名称:Referee,代码行数:50,代码来源:NominationController.cs


注:本文中的Event.Parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。