Example #1
0
 void ReturnToDefaultOptionsMenu(GameObject currentMenuToClose)              //could make this more generic with menu to open to if UI gets more complex
 {
     activeTimetableItem = null;
     timetableItemsParent.GetComponent <CanvasGroup> ().interactable = true;
     currentMenuToClose.SetActive(false);
     defaultOptionsMenu.SetActive(true);
 }
Example #2
0
 public void OnTrainOutOfStation(TimetableItem timetableItem)
 {
     trainPool.RestoreItem(timetableItem.train.trainSerialID, timetableItem.train);          //TODO: it seems that this sometimes calls on options that are already restored... investigate
     platforms.RestoreItem(timetableItem.platform.platformNumber.ToString(), timetableItem.platform);
     timetable.Remove(timetableItem);
     RecalculateSoonestTimetableItemForDestination(timetableItem.destination);
 }
Example #3
0
    public void AssignTrainToTimetableItem(string trainSerialID, TimetableItem timetableItem)
    {
        Train train = trainPool.UseItem(trainSerialID);

        timetableItem.train = train;
        train.OnAssignedToTimetableItem(timetableItem);
    }
Example #4
0
    public void AssignPlatformToTimetableItem(string platformNo, TimetableItem timetableItem)
    {
        Platform platform = platforms.UseItem(platformNo);

        timetableItem.platform = platform;
        platform.OnAssignedToTimetableItem(timetableItem);
        RecalculateSoonestTimetableItemForDestination(timetableItem.destination);
    }
Example #5
0
 public void RemovePlatformFromTimetableItem(TimetableItem timetableItem)
 {
     //for future reference: do not need to RestoreOption for train or platform because they are restored when item is first selected for modification, if it is then wiped they will stay restored!
     timetableItem.platform.OnRemovedFromTimetableItem(timetableItem);
     timetableItem.platform = null;
     //TODO: reduce people's happiness
     RecalculateSoonestTimetableItemForDestination(timetableItem.destination);               //will set it to null unless there is another timetable item for this dest with a platform assignment
 }
Example #6
0
 //Default Options Menu
 public void OnClick_NewTimetableItem()
 {
     timetableItemsParent.GetComponent <CanvasGroup> ().interactable = false;
     defaultOptionsMenu.SetActive(false);
     //pass message to the GameManager to add an item to the Model and store in our activeTimetableItem reference for later manipulation
     activeTimetableItem = GameManager.instance.CreateTimetableItem(GameManager.instance.GetCurrentGameTime());
     creation_schedDepartureTimeText.text = ConvertGameTimeToHHMM(activeTimetableItem.scheduledDepartureTime);               //initially set the time to the current time
     itemCreationMenu.SetActive(true);
 }
        protected void clubList_OnItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem dataItem = (ListViewDataItem)e.Item;

                var club = dataItem.DataItem as ClubItem;

                if (club != null)
                {

                    //Get club Urls
                    var ltrClubLink = e.Item.FindControl("ltrClubLink") as System.Web.UI.WebControls.Literal;
                    string ClubLinkUrl = "";

                    if (club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableItem.TemplateId)) != null)
                    {
                        TimetableItem timetableItem = new TimetableItem(club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableItem.TemplateId)));

                        if (club.IsPlaceholder.Checked)
                        {
                            Item campaign;
                            if (club.PlaceholderCampaign.Item.TemplateID.ToString() == ClubMicrositeLandingItem.TemplateId)
                            {
                                campaign =
                                    club.PlaceholderCampaign.Item.Axes.SelectSingleItem(
                                        String.Format("*[@@tid='{0}']", MicrositeHomeItem.TemplateId));

                                wrappers.VirginActive.PageTemplates.ClubMicrosites.MicrositeTimetableItem micrositeTimetableItem = new wrappers.VirginActive.PageTemplates.ClubMicrosites.MicrositeTimetableItem(campaign.Axes.SelectSingleItem(String.Format(@"descendant::*[@@tid = '{0}']", wrappers.VirginActive.PageTemplates.ClubMicrosites.MicrositeTimetableItem.TemplateId)));

                                ClubLinkUrl = Sitecore.Links.LinkManager.GetItemUrl(micrositeTimetableItem);
                            }
                        }
                        else
                        {
                            SectionContainerItem timetableSectionItem = new SectionContainerItem(timetableItem.InnerItem.Parent);
                            ClubLinkUrl = timetableSectionItem.PageSummary.Url;
                        }
                    }
                    else
                    {
                        if (club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableDownloadItem.TemplateId)) != null)
                        {

                            TimetableDownloadItem timetableDownloadItem = new TimetableDownloadItem(club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableDownloadItem.TemplateId)));
                            ClubLinkUrl = timetableDownloadItem.PageSummary.Url;
                        }
                    }

                    if (ClubLinkUrl != "")
                    {
                        ltrClubLink.Text = @"<li><a href=""" + ClubLinkUrl + @"""><span class=""arrow"">" + HtmlRemoval.StripTagsCharArray(club.Clubname.Text) + @"</span></a></li>";
                    }
                }
            }
        }
Example #8
0
    //Timetable UI Item Deletion/FadeOut
    public void OnTrainEnterStation(TimetableItem timetableItem)
    {
        TimetableItemUIObject timetableItemUIObject;

        timetableUITracker.TryGetValueBySecond(timetableItem, out timetableItemUIObject);
        if (timetableItemUIObject)
        {
            Button button = timetableItemUIObject.GetComponent <Button> ();
            button.interactable = false;
        }
    }
Example #9
0
    public void OnTrainOutOfStation(TimetableItem timetableItem)
    {
        TimetableItemUIObject timetableItemUIObject;

        timetableUITracker.TryGetValueBySecond(timetableItem, out timetableItemUIObject);
        if (timetableItemUIObject)
        {
            Animator animator = timetableItemUIObject.GetComponent <Animator> ();
            animator.SetTrigger("FadeOutTrigger");
            Destroy(timetableItemUIObject.gameObject, animator.GetCurrentAnimatorStateInfo(0).length);
        }
    }
Example #10
0
        public NewItemPage()
        {
            InitializeComponent();

            Item = new TimetableItem
            {
                Text        = "Item name",
                Description = "This is an item description."
            };

            BindingContext = this;
        }
        public ItemDetailPage()
        {
            InitializeComponent();

            var item = new TimetableItem
            {
                Text        = "Item 1",
                Description = "This is an item description."
            };

            viewModel      = new ItemDetailViewModel(item);
            BindingContext = viewModel;
        }
Example #12
0
 public void OnEnterOutOfStationTrigger()            //reset most things apart from journey time etc.
 {
     if (status == TrainStatus.Departing)            //only want to trigger trains leaving station: Departing status will exclude trains that are inbound to station if they happen to hit the trigger
     {
         GameUIManager.instance.OnTrainOutOfStation(myCurrentTimetableItem);
         GameUIManager.instance.UpdateTrainStatus(this, "Travelling...");
         GameManager.instance.OnTrainOutOfStation(myCurrentTimetableItem);
         myCurrentTimetableItem = null;
         foreach (GameObject personGO in peopleOnBoard.Select(p => p.gameObject))
         {
             GameManager.instance.AddObjectToDeletionQueue(personGO);
         }
         status             = TrainStatus.Parked;
         rb.velocity        = Vector3.zero;
         transform.position = myDockingPoint;
     }
 }
Example #13
0
        private List <TimetableItem> Setup(List <TimetableTuple> timetable)
        {
            var sorted  = timetable.OrderBy(t => t.Time);
            var grouped = sorted.GroupBy(item => item.Time.Hours);
            var list    = new List <TimetableItem>();

            foreach (var group in grouped)
            {
                var timetableItem = new TimetableItem
                {
                    Hour    = group.Key,
                    Minutes = group.Select(it => new TimetableItem.TimetableItemMinutes {
                        Minutes = it.Time.Minutes, AdditionalInfo = it.AdditionalDescription?.ShortDescription
                    }).ToList()
                };
                list.Add(timetableItem);
            }
            return(list);
        }
Example #14
0
        private void btn_next_Click(object sender, EventArgs e)
        {
            bool buoiSang = true;

            foreach (RichTextBox i in listRtb)
            {
                int buoi = buoiSang ? 1 : 2;
                buoiSang = !buoiSang;
//                 string hoatDong = "";
//                 foreach(string j in i.Lines)
//                 {
//                     hoatDong += j ;
//                 }
                TimetableItem ttb = new TimetableItem(i.Text, buoi.ToString(), cb_tuan.SelectedItem.ToString());
                thoiKhoaBieu.Add(ttb);
            }
            rt_s_t2.Focus();
            cb_tuan.SelectedIndex = (cb_tuan.SelectedIndex + 1) % 52;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder();

            //Redirect to club home
            Sitecore.Links.UrlOptions urlOptions = new Sitecore.Links.UrlOptions();
            urlOptions.AlwaysIncludeServerUrl = true;
            urlOptions.AddAspxExtension = false;
            urlOptions.LanguageEmbedding = LanguageEmbedding.Never;

            if(club != null)
            {
                //Get opening hours
                if (club.Openinghours.Rendered.Trim() != "")
                {
                    //add opening hours details
                    markupBuilder.Append(@"<p class=""openingtimes"">");
                    markupBuilder.Append(club.Openinghours.Rendered);
                    markupBuilder.Append(@"</p>");

                    openingHours = markupBuilder.ToString();
                }

                //Get address

                markupBuilder = new System.Text.StringBuilder();

                markupBuilder.Append(club.Addressline1.Text);
                markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline2.Text) ? "<br />" + club.Addressline2.Text : "");
                markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline3.Text) ? "<br />" + club.Addressline3.Text : "");
                markupBuilder.Append("<br />");
                markupBuilder.Append(!String.IsNullOrEmpty(club.Addressline4.Text) ? club.Addressline4.Text + " " : "");
                markupBuilder.Append(club.Postcode.Text);

                Address.Text = markupBuilder.ToString();

                //Get Club details

                ClubName = club.Clubname.Rendered;
                lng = club.Long.Raw;
                lat = club.Lat.Raw;

                //Get timetable link
                if (club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableItem.TemplateId)) != null)
                {
                    TimetableItem timetableItem = new TimetableItem(club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableItem.TemplateId)));
                    SectionContainerItem timetableSectionItem = new SectionContainerItem(timetableItem.InnerItem.Axes.SelectSingleItem(String.Format(@"..", SectionContainerItem.TemplateId)));
                    ClubTimetableUrl = Sitecore.Links.LinkManager.GetItemUrl(timetableSectionItem);
                }
                else
                {
                    if (club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableDownloadItem.TemplateId)) != null)
                    {
                        TimetableDownloadItem timetableDownloadItem = new TimetableDownloadItem(club.InnerItem.Axes.SelectSingleItem(String.Format(@"descendant-or-self::*[@@tid = '{0}']", TimetableDownloadItem.TemplateId)));
                        ClubTimetableUrl = Sitecore.Links.LinkManager.GetItemUrl(timetableDownloadItem);
                    }
                }

                //Get enquiries link
                PageSummaryItem enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm));
                if(enqForm != null)
                {
                    ClubEnquiriesUrl = enqForm.Url + "?sc_trk=enq&c=" + club.InnerItem.ID.ToShortID();
                }

                List<MediaItem> imageList;
                if (!String.IsNullOrEmpty(club.Imagegallery.Raw))
                {
                    imageList = club.Imagegallery.ListItems.ConvertAll(X => new MediaItem(X));
                    ImageList.DataSource = imageList;
                    ImageList.DataBind();
                }

                //Set club last visited
                User objUser = new User();
                if (Session["sess_User"] != null)
                {
                    objUser = (User)Session["sess_User"];
                }
                objUser.ClubLastVisitedID = club.ClubId.Rendered;
                Session["sess_User"] = objUser;

                //Set club last visited cookie
                CookieHelper.AddClubsLastVisitedCookie(CookieKeyNames.ClubLastVisited, club.ClubId.Rendered);

                //Add club name to page title
                string clubNameTitle = String.Format(" - {0}", club.Clubname.Raw);
                clubNameTitle = HtmlRemoval.StripTagsCharArray(clubNameTitle);

                Page.Title = Page.Title + clubNameTitle;

            }
        }
Example #16
0
 /*
  * add a timetable item to the timetable
  */
 public void addLessonToWeek(Grid week, int row, TimetableItem timetableItem)
 {
     week.Children.Add(timetableItem);
     // TODO: show an indicator that more than one lesson are at the same time
 }
 public ItemDetailViewModel(TimetableItem item = null)
 {
     Title = item?.Text;
     Item  = item;
 }
Example #18
0
 public void OnAssignedToTimetableItem(TimetableItem timetableItem)
 {
     myCurrentTimetableItem = timetableItem;
     CheckIfClearToEnterStation();
 }
Example #19
0
 public void OnRemovedFromTimetableItem(TimetableItem timetableItem)
 {
     myCurrentTimetableItem = null;
 }
Example #20
0
 public void SetSoonestTimetableItem(TimetableItem timetableItem)
 {
     soonestTimetableItem = timetableItem;
 }
Example #21
0
 public void OnAssignedToTimetableItem(TimetableItem timetableItem)
 {
     //TODO: MEDIUM PRIORITY change colour of text being displayed and also the name of destination
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            //This is a timetable item (or microsite timetable item -treated the same)
            timetableItem = new TimetableItem(Sitecore.Context.Item);

            List<PageSummaryItem> sectionTimetables = null;
            if (Sitecore.Context.Item.TemplateID.ToString() == TimetableItem.TemplateId.ToString())
            {
                //This is a timetable item
                currentClub = new ClubItem(Sitecore.Context.Item.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}"" or @@tid=""{1}""]", ClassicClubItem.TemplateId, LifeCentreItem.TemplateId)));
                ClubHomeUrl = currentClub != null ? LinkManager.GetItemUrl(currentClub.InnerItem) : "";

                sectionTimetables = timetableItem.InnerItem.Axes.SelectItems(String.Format("..//*[@@tid='{0}']", TimetableItem.TemplateId)).ToList().ConvertAll(x => new PageSummaryItem(x));
                sectionTimetables.RemoveAll(x => x.Hidefrommenu.Checked); //Remove all hidden items
            }
            else
            {
                //This is a microsoft timetable item
                MicrositeHomeItem micrositeHome = new MicrositeHomeItem(timetableItem.InnerItem.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}""]", MicrositeHomeItem.TemplateId)));
                ClubMicrositeLandingItem micrositeLanding = micrositeHome.InnerItem.Parent;
                currentClub = micrositeLanding.Club.Item;
                ClubHomeUrl = currentClub != null ? LinkManager.GetItemUrl(micrositeHome.InnerItem) : "";

                sectionTimetables = timetableItem.InnerItem.Axes.SelectItems(String.Format("..//*[@@tid='{0}']", MicrositeTimetableItem.TemplateId)).ToList().ConvertAll(x => new PageSummaryItem(x));
                sectionTimetables.RemoveAll(x => x.Hidefrommenu.Checked); //Remove all hidden items
            }

            //Set Navigation elements

            if (sectionTimetables != null && sectionTimetables.Count > 1)
            {
                sectionTimetables.First().IsFirst = true;
                sectionTimetables.Last().IsLast = true;

                //Set current
                foreach (PageSummaryItem child in sectionTimetables)
                {
                    Item current = child.InnerItem.Axes.SelectSingleItem(String.Format("descendant-or-self::*[@@id='{0}']", timetableItem.ID.ToString()));
                    if (current != null)
                    {
                        child.IsCurrent = true;
                    }
                }

                SecondLevelElements.DataSource = sectionTimetables;
                SecondLevelElements.DataBind();
            }

            PageSummaryItem timetableSectionItem = new PageSummaryItem(timetableItem.InnerItem.Parent);
            ClubTimetablesUrl = Sitecore.Links.LinkManager.GetItemUrl(timetableSectionItem);

            if (currentClub != null)
            {
                ClubName = currentClub.Clubname.Rendered;
                clubMemberPhone = currentClub.Memberstelephonenumber.Rendered;

                //Get enquiries link
                PageSummaryItem enqForm = new PageSummaryItem(Sitecore.Context.Database.GetItem(ItemPaths.EnquiryForm));
                if (enqForm != null)
                {
                    ClubEnquiriesUrl = enqForm.Url + "?sc_trk=enq&c=" + currentClub.InnerItem.ID.ToShortID();
                }

                //Set Book Online Link
                if (currentClub.GetCrmSystem() == ClubCrmSystemTypes.ClubCentric || currentClub.GetCrmSystem() == ClubCrmSystemTypes.Vision)
                {
                    //Show link
                    pnlBookOnline.Visible = true;
                    BookOnlineUrl = SitecoreHelper.GetMembershipLoginUrl(currentClub);
                }

                if (timetableItem.Showalert.Checked)
                {
                    string textToParse = timetableItem.Alerttext.Rendered;

                    Hashtable objTemplateVariables = new Hashtable();
                    objTemplateVariables.Add("SalesNumber", currentClub.Salestelephonenumber.Rendered);

                    Parser objParser = new Parser(objTemplateVariables);
                    objParser.SetTemplate(textToParse);
                    textToParse = objParser.Parse();

                    alert = @"<div class=""message""><p>" + textToParse + @"</p></div>";
                }
            }

            //What day are we rendering?
            int.TryParse(WebUtil.GetQueryString("day"), out day);

            timetableType = timetableItem.Type.Raw;

            Item settings = Sitecore.Context.Database.GetItem(ItemPaths.TimetableShared);
            if (settings != null)
            {
                TimetableSharedItem settingsItem = new TimetableSharedItem(settings);
                //TimetableUnavailableHeading.Text = settingsItem.Timetableunavailableheading.Text;
                TimetableUnavailableMessage.Text =
                    settingsItem.Mobiletimetableunavailabletext.Text.Replace("#clubMemberPhone#", clubMemberPhone);
            }

            try
            {
                //Only showing for one week from today (0)
                if (day >= 0 && day < 7)
                {

                    ClassContainer ClubClasses = Utility.GetClubTimetable(currentClub.ClubId.Raw);

                    if (ClubClasses != null)
                    {
                        //Set Previous Next Links
                        if (day == 0)
                        {
                            ltrNext.Text = @"<a href=""" + timetableItem.PageSummary.Url + @"?day=" + Convert.ToString(day + 1) + @""" class=""next"">" + Translate.Text("Tomorrow") + "</a>";
                        }
                        else if (day == 1)
                        {
                            ltrPrevious.Text = @"<a href=""" + timetableItem.PageSummary.Url + @"?day=" + Convert.ToString(day - 1) + @""" class=""previous"">" + Translate.Text("Today") + "</a>";
                            string nextDayName = DateTime.Now.AddDays(day + 1).DayOfWeek.ToString();
                            ltrNext.Text = @"<a href=""" + timetableItem.PageSummary.Url + @"?day=" + Convert.ToString(day + 1) + @""" class=""next"">" + Translate.Text(nextDayName) + "</a>";
                        }
                        else if (day == 6)
                        {

                            string previousDayName = DateTime.Now.AddDays(day - 1).DayOfWeek.ToString();
                            ltrPrevious.Text = @"<a href=""" + timetableItem.PageSummary.Url + @"?day=" + Convert.ToString(day - 1) + @""" class=""previous"">" + Translate.Text(previousDayName) + "</a>";
                        }
                        else
                        {
                            string previousDayName = DateTime.Now.AddDays(day - 1).DayOfWeek.ToString();
                            ltrPrevious.Text = @"<a href=""" + timetableItem.PageSummary.Url + @"?day=" + Convert.ToString(day - 1) + @""" class=""previous"">" + Translate.Text(previousDayName) + "</a>";
                            string nextDayName = DateTime.Now.AddDays(day + 1).DayOfWeek.ToString();
                            ltrNext.Text = @"<a href=""" + timetableItem.PageSummary.Url + @"?day=" + Convert.ToString(day + 1) + @""" class=""next"">" + Translate.Text(nextDayName) + "</a>";
                        }

                        //Set Date String
                        dateStr = StringHelper.GenerateDateStringMobile(DateTime.Now.AddDays(day));

                        foreach (Timetable item in ClubClasses.Timetables)
                        {
                            int classCount = 0;
                            if (item.Dayname != null)
                            {
                                //Check what day we are showing
                                if (item.Dayname.Equals(DateTime.Now.AddDays(day).DayOfWeek.ToString(), StringComparison.OrdinalIgnoreCase))
                                {

                                    //Check that classes exist for that timetable
                                    //Check which classes to display based on timetabletype
                                    switch (timetableType)
                                    {
                                        case TimetableTypes.General:
                                            venueHeading = Translate.Text("Studio");
                                            //Show everything apart from classes from Swim source
                                            foreach (Class classItem in item.Classes)
                                            {
                                                if (classItem.Source != TimetableSources.Swim)
                                                {

                                                    classCount++;
                                                    break;
                                                }
                                            }
                                            break;
                                        case TimetableTypes.Swim:
                                            //Do not show bookings panel if we are showing Swimming timetable
                                            pnlBookings.Visible = false;

                                            venueHeading = Translate.Text("Pool");
                                            //Only show classes from Swim source
                                            foreach (Class classItem in item.Classes)
                                            {
                                                if (classItem.Source == TimetableSources.Swim)
                                                {
                                                    classCount++;
                                                    break;
                                                }
                                            }
                                            break;
                                        default: break;
                                    }

                                    //Only add timetable to collection if classes exist
                                    if (classCount > 0)
                                    {
                                        //Bind Classes
                                        List<Class> tempItems = new List<Class>();

                                        //Check which classes to display based on timetabletype
                                        switch (timetableType)
                                        {
                                            case TimetableTypes.General:
                                                //Show everything apart from classes from Swim source
                                                foreach (Class classItem in item.Classes)
                                                {
                                                    if (classItem.Source != TimetableSources.Swim)
                                                    {
                                                        tempItems.Add(classItem);
                                                    }
                                                }
                                                break;
                                            case TimetableTypes.Swim:
                                                //Only show classes from Swim source
                                                foreach (Class classItem in item.Classes)
                                                {
                                                    if (classItem.Source == TimetableSources.Swim)
                                                    {
                                                        tempItems.Add(classItem);
                                                    }
                                                }
                                                break;
                                            default: break;
                                        }

                                        rptClass.DataSource = tempItems;
                                        rptClass.DataBind();

                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        pnlUnavailable.Visible = true;
                        pnlClasses.Visible = false;
                    }
                }

            }
            catch (Exception ex)
            {
                pnlUnavailable.Visible = true;
                pnlClasses.Visible = false;
            }

            //Set club last visited
            User objUser = new User();
            if (Session["sess_User"] != null)
            {
                objUser = (User)Session["sess_User"];
            }
            objUser.ClubLastVisitedID = currentClub.ClubId.Rendered;
            Session["sess_User"] = objUser;

            CookieHelper.AddClubsLastVisitedCookie(CookieKeyNames.ClubLastVisited, currentClub.ClubId.Rendered);

            //Add club name to page title
            string clubNameTitle = String.Format(" - {0}", currentClub.Clubname.Raw);
            clubNameTitle = HtmlRemoval.StripTagsCharArray(clubNameTitle);

            Page.Title = Page.Title + clubNameTitle;
        }
Example #23
0
 public void ConfirmCreatedTimetableItem(int destinationIndex, TimetableItem timetableItem)
 {
     //scheduled departure time of the timetableItem passed to us is already set as it is changed by GameUIManager in response to player input
     timetableItem.destination = destinations [destinationIndex];
     timetable.Add(timetableItem);
 }
Example #24
0
    void CheckForTimetableChanges()
    {
        if (desiredDestination.soonestTimetableItem != null)
        {
            if (myTargetTimetableItem != desiredDestination.soonestTimetableItem || (myTargetTimetableItem.platform != null && myTargetPlatform != myTargetTimetableItem.platform)) //if destination's soonest timetable item is different to this person's timetable item OR the target timetable item's platform has changed
            {
                switch (status)                                                                                                                                                     //only statuses where person is at waiting area, moving to platform, or waiting at platform- any other statuses mean Person is already boarding train or compromised
                {
                case PersonStatus.MovingToFoyer:
                case PersonStatus.AtFoyer:
                case PersonStatus.MovingToPlatform:
                    myTargetTimetableItem = desiredDestination.soonestTimetableItem;
                    myTargetPlatform      = myTargetTimetableItem.platform;
                    SetMovingToPlatform();
                    break;

                case PersonStatus.ReadyToBoard:
                    myTargetTimetableItem = desiredDestination.soonestTimetableItem;
                    myTargetPlatform      = myTargetTimetableItem.platform;
                    if (myTargetTimetableItem.platform.waitingArea.IsPersonRegistered(this))                            //if already at platform then perform the following inelegant reset
                    {
                        myTargetTimetableItem.platform.waitingArea.UnregisterPerson(this);
                        status = PersonStatus.MovingToPlatform;
                        OnWaitingAreaEnter(myTargetTimetableItem.platform.waitingArea);
                    }
                    else
                    {
                        SetMovingToPlatform();
                    }
                    break;
                }
            }
        }
        else                                                                          //else destination's soonest timetable item is null
        {
            if (status != PersonStatus.SatDown && status != PersonStatus.Compromised) //(people on train or compromised should ignore)
            {
                if (myTargetTimetableItem != null)                                    //...and this person has a timetableItem set then it means platform has been deselected or timetable item already satisfied before Person could reach the train
                {
                    myTargetTimetableItem = null;
                    if (GameManager.instance.foyer.IsPersonRegistered(this))                            //if person already in foyer then perform series of fairly inelegant resetting steps
                    {
                        GameManager.instance.foyer.UnregisterPerson(this);
                        status = PersonStatus.MovingToFoyer;
                        OnWaitingAreaEnter(GameManager.instance.foyer);
                    }
                    else                                //else person is outside the foyer so just retarget the foyer
                    {
                        SetMovingToFoyer();
                    }
                }
                else                                                                                    //destination soonest timetable item null and Person doesn't have one set so still waiting... (yawn)
                {
                    if (Time.time - arrivalTimeAtStation > (30 / GameManager.gameMinutesPerRealSecond)) //if waiting for more than 30 minutes
                    {
                        totalApprovalRating -= 1;
                    }
                }
            }
        }
    }
Example #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                TimetableItem currentItem = new TimetableItem(Sitecore.Context.Item);

                ClubItem club = new ClubItem(Sitecore.Context.Item.Axes.SelectSingleItem(String.Format(@"ancestor-or-self::*[@@tid=""{0}"" or @@tid=""{1}""]", ClassicClubItem.TemplateId, LifeCentreItem.TemplateId)));
                try
                {
                    clubMemberPhone = club.Memberstelephonenumber.Rendered;
                    clubId = club.ClubId.Rendered;
                    timetableType = currentItem.Type.Rendered;

                    Item settings = Sitecore.Context.Database.GetItem(ItemPaths.TimetableShared);
                    if (settings != null)
                    {
                        TimetableSharedItem settingsItem = new TimetableSharedItem(settings);
                        TimetableUnavailableHeading.Text = settingsItem.Timetableunavailableheading.Text;
                        TimetableUnavailableMessage.Text =
                            settingsItem.Timetableunavailabletext.Text.Replace("#clubMemberPhone#", clubMemberPhone);
                    }

                    if(currentItem.Showalert.Checked)
                    {
                        string textToParse = currentItem.Alerttext.Rendered;

                        Hashtable objTemplateVariables = new Hashtable();
                        objTemplateVariables.Add("SalesNumber", club.Salestelephonenumber.Rendered);

                        Parser objParser = new Parser(objTemplateVariables);
                        objParser.SetTemplate(textToParse);
                        textToParse = objParser.Parse();

                        alert = @"<div class=""club-alert-panel""><div class=""club-alert""><p>" + textToParse + @"</p></div></div>";
                    }

                    ClassContainer ClubClasses = Utility.GetClubTimetable(clubId);

                    ////Need to lookup the daterange from the timetable
                    //if (Cache[clubId] == null)
                    //{
                    //    //initialise webservice
                    //    //mm.virginactive.webservices.virginactive.classtimetable.Service vs = new mm.virginactive.webservices.virginactive.classtimetable.Service();
                    //    mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables vs = new mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables();
                    //    //mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables vs = new mm.virginactive.webservices.virginactive.classtimetable.VA_ClassTimetables();
                    //    ClubClasses = vs.Classes(clubId);

                    //    double cacheLiveTime = 20.0;
                    //    Double.TryParse(Settings.TimetableCacheMinutes, out cacheLiveTime);

                    //    Cache.Insert(clubId, ClubClasses, null, DateTime.Now.AddMinutes(cacheLiveTime), Cache.NoSlidingExpiration);
                    //}
                    //else //Fetch from cache
                    //{
                    //    ClubClasses = (struct_Classes)Cache[clubId];
                    //}

                    List<Timetable> tempItems = new List<Timetable>();

                    //Check each Timetable in collection is valid
                    foreach (Timetable item in ClubClasses.Timetables)
                    {
                        if (item.Dayname != null)
                        {
                            tempItems.Add(item);
                        }
                    }

                    if ((tempItems.Count > 0) && (currentItem.Type.Rendered != ""))
                    {
                        System.Text.StringBuilder markupBuilder = new System.Text.StringBuilder();
                        markupBuilder.Append(@"<span class=""bold"">");
                        markupBuilder.Append(StringHelper.GenerateDateString(tempItems[0].Date));
                        markupBuilder.Append(@"</span> to <span class=""bold"">");
                        markupBuilder.Append(StringHelper.GenerateDateString(tempItems[tempItems.Count - 1].Date));
                        markupBuilder.Append("</span>");

                        dateRangeStr = markupBuilder.ToString();
                        timetableNameStr = currentItem.PageSummary.DisplayName;

                        //create ajax controls
                        ClubTimetableResult timetableResult = this.Page.LoadControl("~/layouts/virginactive/ajax/ClubTimetableResult.ascx") as ClubTimetableResult;
                        ClubTimetableFilter timetableFilter = this.Page.LoadControl("~/layouts/virginactive/ajax/ClubTimetableFilter.ascx") as ClubTimetableFilter;

                        timetableResult.ClubId = clubId;
                        timetableResult.Type = timetableType;
                        timetableResult.ShowBookClassTooltip = currentItem.Showbookclasstooltip.Checked;

                        string textToParse = currentItem.Bookclasstooltip.Raw;

                        Hashtable objTemplateVariables = new Hashtable();
                        objTemplateVariables.Add("salesnumber", club.Salestelephonenumber.Rendered);

                        Parser objParser = new Parser(objTemplateVariables);
                        objParser.SetTemplate(textToParse);
                        textToParse = objParser.Parse();

                        timetableResult.BookClassTooltip = textToParse;

                        filterPh.Controls.Add(timetableFilter);
                        resultPh.Controls.Add(timetableResult);
                    }
                    else
                    {
                        ErrorMessage.Visible = true;
                        //hide print button
                        lstIcons.Visible = false;
                    }

                }
                catch (Exception ex)
                {
                    ErrorMessage.Visible = true;
                    //hide print button
                    lstIcons.Visible = false;
                    Log.Error(String.Format("Error retrieving timetable for club {1}: {0}", ex.Message, club.Clubname.Raw), this);
                    mm.virginactive.common.EmailMessagingService.ErrorEmailNotification.SendMail(ex);
                }
            }
        }
 public PregledTermina(TimetableItem item, Action refresh) : this()
 {
     this.item    = item;
     this.refresh = refresh;
     Init();
 }
Example #27
0
 public void OnRemovedFromTimetableItem(TimetableItem timetableItem)
 {
     //empty for now
 }
Example #28
0
 public void RemoveTrainFromTimetableItem(TimetableItem timetableItem)
 {
     //for future reference: do not need to RestoreOption for train or platform because they are restored when item is first selected for modification, if it is then wiped they will stay restored!
     timetableItem.train.OnRemovedFromTimetableItem(timetableItem);
     timetableItem.train = null;
 }
Example #29
0
    public TimetableItem CreateTimetableItem(float scheduledDepartureTime)
    {
        TimetableItem newTimetableItem = new TimetableItem(scheduledDepartureTime);

        return(newTimetableItem);
    }