public void linkSummarize_Click(object sender, EventArgs e) { TransitAccountEvent tav = SessionManager.EventService.GetAccountEventById( SessionManager.Ticket, RequestId, SessionManager.UtcOffset.Ticks); string imageuri = string.Format("AccountEventPictureThumbnail.aspx?id={0}", tav.PictureId); labelSummary.Text = string.Format( "<table cellpadding='4' cellspacing='4'>\n" + "<tr>\n" + "<td valign='middle'>\n" + "<a href='{2}'><img border='0' src='{0}'></a>\n" + "</td>\n" + "<td valign='middle'>\n" + "<p><a href='{2}'>{3}</a>\n" + "<br><b><font style='font-size: smaller;'>{4}</font></b>\n" + "<br><font style='font-size: smaller;'><a href='{6}'>{5}</a>, {7}</font></p>\n" + "<p>{1}</p>\n" + "</td>\n" + "</tr>\n" + "</table>", imageuri, Renderer.GetSummary(tav.Description), string.Format("AccountEventView.aspx?id={0}", RequestId), Renderer.Render(tav.Name), Renderer.Render(tav.Schedule), Renderer.Render(tav.PlaceName), string.Format("PlaceView.aspx?id={0}", tav.PlaceId), Renderer.Render(tav.PlaceCity) ); }
public void Page_Load(object sender, EventArgs e) { this.addFile.Attributes["onclick"] = this.files.GetAddFileScriptReference() + "return false;"; gridManage.OnGetDataSource += new EventHandler(gridManage_OnGetDataSource); if (!IsPostBack) { TransitAccountEvent p = SessionManager.EventService.GetAccountEventById( SessionManager.Ticket, RequestId, SessionManager.UtcOffset.Ticks); GetData(sender, e); SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(p.Name, Request, string.Format("AccountEventView.aspx?id={0}", p.Id))); sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url)); StackSiteMap(sitemapdata); } if (!SessionManager.HasVerified()) { ReportWarning("You don't have any verified e-mail addresses and/or profile photos.\n" + "You must add/confirm a valid e-mail address and upload a profile photo before uploading event pictures."); addFile.Enabled = false; } }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsToday.aspx")); if (RequestId > 0) { TransitAccountEvent evt = SessionManager.EventService.GetAccountEventById( SessionManager.Ticket, RequestId, SessionManager.UtcOffset.Ticks); this.Title = string.Format("{0} Pictures", Renderer.Render(evt.Name)); listView.DataSource = SessionManager.EventService.GetAccountEventPictures( SessionManager.Ticket, RequestId, null); listView.DataBind(); sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "AccountEventsToday.aspx", evt.PlaceCountry, evt.PlaceState, evt.PlaceCity, evt.PlaceNeighborhood, evt.AccountEventType)); sitemapdata.Add(new SiteMapDataAttributeNode(evt.Name, Request, string.Format("AccountEventView.aspx?id={0}", evt.Id))); sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url)); } StackSiteMap(sitemapdata); } }
void GetPictureData(object sender, EventArgs e) { TransitAccountEventPicture p = AccountEventPicture; inputPicture.Src = string.Format("AccountEventPicture.aspx?id={0}", p.Id); inputName.Text = Renderer.Render(p.Name); inputDescription.Text = Renderer.Render(p.Description); inputCreated.Text = Adjust(p.Created).ToString("d"); inputCounter.Text = p.Counter.Total.ToString(); TransitAccountEvent t = AccountEvent; labelAccountEventName.Text = this.Title = string.Format("{0}: {1}", Renderer.Render(t.Name), string.IsNullOrEmpty(p.Name) ? "Untitled" : Renderer.Render(p.Name)); linkBack.NavigateUrl = string.Format("AccountEventView.aspx?id={0}", t.Id); linkBack.Text = string.Format("» Back to {0}", Renderer.Render(t.Name)); linkComments.Visible = p.CommentCount > 0; linkComments.Text = string.Format("» {0} comment{1}", (p.CommentCount > 0) ? p.CommentCount.ToString() : "no", (p.CommentCount == 1) ? "" : "s"); linkPrev.Enabled = p.PrevId > 0; linkPrev.CommandArgument = p.PrevId.ToString(); linkNext.Enabled = p.NextId > 0; linkNext.CommandArgument = p.NextId.ToString(); labelIndex.Text = string.Format("{0} / {1}", p.Index + 1, p.Count); discussionComments.ReturnUrl = string.Format("AccountEventPictureView.aspx?id={0}", PictureId); discussionComments.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>( typeof(AccountEventPicture).Name, PictureId, SessionManager.DiscussionService.GetOrCreateDiscussionId); discussionComments.DataBind(); }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TransitAccountEvent p = SessionManager.EventService.GetAccountEventById( SessionManager.Ticket, AccountEventId, SessionManager.UtcOffset.Ticks); linkBack.NavigateUrl = string.Format("AccountEventPicturesManage.aspx?id={0}", p.Id); SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode(p.Name, Request, string.Format("AccountEventView.aspx?id={0}", p.Id))); sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request, string.Format("AccountEventPicturesManage.aspx?id={0}", p.Id))); if (RequestId > 0) { TransitAccountEventPicture t = SessionManager.EventService.GetAccountEventPictureById(SessionManager.Ticket, RequestId); inputName.Text = t.Name; inputDescription.Text = t.Description; imageFull.ImageUrl = string.Format("AccountEventPicture.aspx?id={0}&CacheDuration=0", t.Id); sitemapdata.Add(new SiteMapDataAttributeNode(t.Name, Request.Url)); } else { sitemapdata.Add(new SiteMapDataAttributeNode("New Picture", Request.Url)); } StackSiteMap(sitemapdata); } SetDefaultButton(manageAdd); }
public void doIntro() { mAccountEvent = new TransitAccountEvent(); mAccountEvent.Publish = true; mPlace = new TransitPlace(); mSchedule = new TransitSchedule(); }
public string GetDataObjectName() { switch (Feature.DataObjectName) { case "AccountFeed": { TransitAccountFeed t_instance = SessionManager.GetInstance <TransitAccountFeed, int>( Feature.DataRowId, SessionManager.SyndicationService.GetAccountFeedById); return(t_instance.Name); } case "AccountFeedItem": { TransitAccountFeedItem t_instance = SessionManager.GetInstance <TransitAccountFeedItem, int>( Feature.DataRowId, SessionManager.SyndicationService.GetAccountFeedItemById); return(t_instance.Title); } case "Account": { TransitAccount t_instance = SessionManager.GetInstance <TransitAccount, int>( Feature.DataRowId, SessionManager.AccountService.GetAccountById); return(t_instance.Name); } case "AccountEvent": { TransitAccountEvent t_instance = SessionManager.GetInstance <TransitAccountEvent, int, long>( Feature.DataRowId, 0, SessionManager.EventService.GetAccountEventById); return(t_instance.Name); } case "AccountGroup": { TransitAccountGroup t_instance = SessionManager.GetInstance <TransitAccountGroup, int>( Feature.DataRowId, SessionManager.GroupService.GetAccountGroupById); return(t_instance.Name); } case "Place": { TransitPlace t_instance = SessionManager.GetInstance <TransitPlace, int>( Feature.DataRowId, SessionManager.PlaceService.GetPlaceById); return(t_instance.Name); } } return(string.Empty); }
private static bool AddUnique(List <TransitAccountEvent> list, TransitAccountEvent evt) { foreach (TransitAccountEvent existing in list) { if (existing.Website == evt.Website) { return(false); } if (existing.Name == evt.Name) { return(false); } } list.Add(evt); return(true); }
public TransitAccountEvent GetAccountEventById(string ticket, int id, long utcoffsetTicks) { TransitAccountEvent t_instance = WebServiceImpl <TransitAccountEvent, ManagedAccountEvent, AccountEvent> .GetById( ticket, id); if (t_instance != null) { using (SnCore.Data.Hibernate.Session.OpenConnection()) { ISession session = SnCore.Data.Hibernate.Session.Current; ManagedSecurityContext sec = new ManagedSecurityContext(session, ticket); t_instance.CreateSchedule(session, new TimeSpan(utcoffsetTicks), sec); } } return(t_instance); }
public void Page_Load(object sender, EventArgs e) { picturesView.OnGetDataSource += new EventHandler(picturesView_OnGetDataSource); if (!IsPostBack) { mPictureId = RequestId; GetPictureData(sender, e); GetPicturesData(sender, e); TransitAccountEvent t = AccountEvent; TransitAccountEventPicture p = AccountEventPicture; SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsView.aspx")); sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "AccountEventsToday.aspx", t.PlaceCountry, t.PlaceState, t.PlaceCity, t.PlaceNeighborhood, t.AccountEventType)); sitemapdata.Add(new SiteMapDataAttributeNode(t.Name, Request, string.Format("AccountEventView.aspx?id={0}", t.Id))); sitemapdata.Add(new SiteMapDataAttributeNode("Pictures", Request.Url)); StackSiteMap(sitemapdata); } }
public void TestAccountEventInstances() { TransitAccountEvent t_instance = _event.GetTransitInstance(); ManagedAccountEvent m_instance = new ManagedAccountEvent(Session); m_instance.CreateOrUpdate(t_instance, AdminSecurityContext); Nullable <DateTime> previous_startdatetime = null; Assert.IsTrue(m_instance.Instance.Schedule.ScheduleInstances.Count > 0); foreach (ScheduleInstance schedule in m_instance.Instance.Schedule.ScheduleInstances) { if (previous_startdatetime.HasValue) { Assert.IsTrue(previous_startdatetime < schedule.StartDateTime); } Console.WriteLine(string.Format("{0}: {1}", schedule.Id, schedule.StartDateTime)); previous_startdatetime = schedule.StartDateTime; } m_instance.Delete(AdminSecurityContext); }
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (RequestId > 0) { TransitAccountEvent t = AccountEvent; if (t == null) { ReportWarning("Event does not exist."); pnlAccountEvent.Visible = false; return; } SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsView.aspx")); sitemapdata.AddRange(SiteMapDataAttribute.GetLocationAttributeNodes(Request, "AccountEventsToday.aspx", t.PlaceCountry, t.PlaceState, t.PlaceCity, t.PlaceNeighborhood, t.AccountEventType)); sitemapdata.Add(new SiteMapDataAttributeNode(t.Name, Request.Url)); StackSiteMap(sitemapdata); picturesView.AccountEventId = RequestId; this.Title = Renderer.Render(t.Name); labelDescription.Text = base.RenderEx(t.Description); panelDescription.Visible = !string.IsNullOrEmpty(labelDescription.Text); eventName.Text = Renderer.Render(t.Name); eventId.Text = "#" + t.Id.ToString(); linkEdit.NavigateUrl = string.Format("AccountEventEdit.aspx?id={0}", t.Id); eventWebsite.NavigateUrl = t.Website; if (!string.IsNullOrEmpty(t.Website)) { eventWebsite.NavigateUrl = t.Website; if (t.Website.Length < 64) { eventWebsite.Text = Renderer.Render(t.Website); } } eventWebsite.Visible = !string.IsNullOrEmpty(t.Website); eventPhone.Text = Renderer.Render(t.Phone); eventType.Text = Renderer.Render(t.AccountEventType); eventEmail.NavigateUrl = string.Format("mailto:{0}", Renderer.Render(t.Email)); eventEmail.Visible = !string.IsNullOrEmpty(t.Email); eventCost.Text = Renderer.Render(t.Cost); discussionAccountEvents.DiscussionId = SessionManager.GetCount <TransitDiscussion, string, int>( typeof(AccountEvent).Name, RequestId, SessionManager.DiscussionService.GetOrCreateDiscussionId); discussionAccountEvents.DataBind(); if (SessionManager.IsAdministrator) { linkFeature.Text = (LatestAccountEventFeature != null) ? string.Format("Feature » Last on {0}", Adjust(LatestAccountEventFeature.Created).ToString("d")) : "Feature » Never Featured"; } panelOwner.Visible = SessionManager.IsLoggedIn && (SessionManager.IsAdministrator || t.AccountId == SessionManager.Account.Id); TransitPlace pl = AccountEventPlace; placeImage.Src = string.Format("PlacePictureThumbnail.aspx?id={0}", pl.PictureId); placeLink2.HRef = placeLink.HRef = string.Format("PlaceView.aspx?id={0}", pl.Id); placeNeighborhood.Text = Renderer.Render(pl.Neighborhood); placeName.Text = Renderer.Render(pl.Name); placeCity.Text = Renderer.Render(pl.City); placeState.Text = Renderer.Render(pl.State); placeCountry.Text = Renderer.Render(pl.Country); labelSchedule.Text = Renderer.Render(t.Schedule); } } }
private static bool AddUnique(List<TransitAccountEvent> list, TransitAccountEvent evt) { foreach (TransitAccountEvent existing in list) { if (existing.Website == evt.Website) return false; if (existing.Name == evt.Name) return false; } list.Add(evt); return true; }
public void save_Click(object sender, EventArgs e) { if (!schedule.IsConfirmed) { schedule.ConfirmSchedule(sender, e); } if (!place.IsChosen) { place.SavePlace(sender, e); } panelReminder.Visible = false; panelReminderUpdate.Update(); TransitAccountEvent tav = new TransitAccountEvent(); tav.Name = inputName.Text; if (!string.IsNullOrEmpty(inputWebsite.Text) && !Uri.IsWellFormedUriString(inputWebsite.Text, UriKind.Absolute)) { inputWebsite.Text = "http://" + inputWebsite.Text; } if (string.IsNullOrEmpty(selectType.SelectedValue)) { throw new Exception("Please choose a type for this event."); } if (!schedule.IsConfirmed) { throw new Exception("Please confirm the schedule for this event."); } if (!place.IsChosen) { throw new Exception("Please choose a location where this event takes place."); } tav.Website = inputWebsite.Text; tav.Description = inputDescription.Text; tav.Email = inputEmail.Text; tav.Cost = inputCost.Text; tav.Phone = inputPhone.Text; tav.Publish = inputPublish.Checked; // create place if (place.Place.Id == 0) { place.Place.Id = SessionManager.CreateOrUpdate <TransitPlace>( place.Place, SessionManager.PlaceService.CreateOrUpdatePlace); } // create or update schedule tav.ScheduleId = schedule.Schedule.Id = SessionManager.CreateOrUpdate <TransitSchedule>( schedule.Schedule, SessionManager.ObjectService.CreateOrUpdateSchedule); tav.AccountId = SessionManager.Account.Id; tav.PlaceId = place.Place.Id; tav.Id = RequestId; tav.AccountEventType = selectType.SelectedValue; tav.Id = SessionManager.CreateOrUpdate <TransitAccountEvent>( tav, SessionManager.EventService.CreateOrUpdateAccountEvent); SessionManager.InvalidateCache <TransitAccountEventInstance>(); Redirect(string.Format("AccountEventView.aspx?id={0}", tav.Id)); }
public void save_Click(object sender, EventArgs e) { if (!schedule.IsConfirmed) schedule.ConfirmSchedule(sender, e); if (!place.IsChosen) place.SavePlace(sender, e); panelReminder.Visible = false; panelReminderUpdate.Update(); TransitAccountEvent tav = new TransitAccountEvent(); tav.Name = inputName.Text; if (!string.IsNullOrEmpty(inputWebsite.Text) && !Uri.IsWellFormedUriString(inputWebsite.Text, UriKind.Absolute)) inputWebsite.Text = "http://" + inputWebsite.Text; if (string.IsNullOrEmpty(selectType.SelectedValue)) throw new Exception("Please choose a type for this event."); if (!schedule.IsConfirmed) throw new Exception("Please confirm the schedule for this event."); if (!place.IsChosen) throw new Exception("Please choose a location where this event takes place."); tav.Website = inputWebsite.Text; tav.Description = inputDescription.Text; tav.Email = inputEmail.Text; tav.Cost = inputCost.Text; tav.Phone = inputPhone.Text; tav.Publish = inputPublish.Checked; // create place if (place.Place.Id == 0) { place.Place.Id = SessionManager.CreateOrUpdate<TransitPlace>( place.Place, SessionManager.PlaceService.CreateOrUpdatePlace); } // create or update schedule tav.ScheduleId = schedule.Schedule.Id = SessionManager.CreateOrUpdate<TransitSchedule>( schedule.Schedule, SessionManager.ObjectService.CreateOrUpdateSchedule); tav.AccountId = SessionManager.Account.Id; tav.PlaceId = place.Place.Id; tav.Id = RequestId; tav.AccountEventType = selectType.SelectedValue; tav.Id = SessionManager.CreateOrUpdate<TransitAccountEvent>( tav, SessionManager.EventService.CreateOrUpdateAccountEvent); SessionManager.InvalidateCache<TransitAccountEventInstance>(); Redirect(string.Format("AccountEventView.aspx?id={0}", tav.Id)); }
public void Page_Load(object sender, EventArgs e) { place.Choose += new EventHandler(event_Changed); schedule.Confirm += new EventHandler(event_Changed); if (!IsPostBack) { SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute(); sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx")); sitemapdata.Add(new SiteMapDataAttributeNode("Events", Request, "AccountEventsManage.aspx")); DomainClass cs = SessionManager.GetDomainClass("AccountEvent"); inputName.MaxLength = cs["Name"].MaxLengthInChars; inputPhone.MaxLength = cs["Phone"].MaxLengthInChars; inputEmail.MaxLength = cs["Email"].MaxLengthInChars; inputWebsite.MaxLength = cs["Website"].MaxLengthInChars; inputCost.MaxLength = cs["Cost"].MaxLengthInChars; GetAccountEventTypes(sender, e); linkBack.NavigateUrl = ReturnUrl; linkDelete.Visible = linkSummarize.Visible = (RequestId > 0); if (RequestId > 0) { TransitAccountEvent tav = SessionManager.EventService.GetAccountEventById( SessionManager.Ticket, RequestId, SessionManager.UtcOffset.Ticks); inputName.Text = tav.Name; inputWebsite.Text = tav.Website; inputDescription.Text = tav.Description; inputPhone.Text = tav.Phone; inputEmail.Text = tav.Email; inputCost.Text = tav.Cost; inputPublish.Checked = tav.Publish; ListItemManager.TrySelect(selectType, tav.AccountEventType); schedule.Schedule = SessionManager.ObjectService.GetScheduleById(SessionManager.Ticket, tav.ScheduleId); place.Place = SessionManager.PlaceService.GetPlaceById(SessionManager.Ticket, tav.PlaceId); titleEvent.Text = Renderer.Render(tav.Name); sitemapdata.Add(new SiteMapDataAttributeNode(tav.Name, Request.Url)); } else if (!string.IsNullOrEmpty(Request["ical"])) { TransitAccountEventICALEmitter emitter = TransitAccountEventICALEmitter.Parse( Request["ical"], SessionManager.UtcOffset, SessionManager.GetCachedConfiguration("SnCore.Web.UserAgent", "SnCore/1.0")); inputName.Text = emitter.AccountEvent.Name; inputWebsite.Text = emitter.AccountEvent.Website; inputDescription.Text = emitter.AccountEvent.Description; inputPhone.Text = emitter.AccountEvent.Phone; inputEmail.Text = emitter.AccountEvent.Email; inputCost.Text = emitter.AccountEvent.Cost; inputPublish.Checked = emitter.AccountEvent.Publish; ListItemManager.TrySelect(selectType, emitter.AccountEvent.AccountEventType); schedule.Schedule = emitter.Schedule; place.Place = emitter.Place; titleEvent.Text = Renderer.Render(emitter.AccountEvent.Name); sitemapdata.Add(new SiteMapDataAttributeNode("New ICal Event", Request.Url)); } else { sitemapdata.Add(new SiteMapDataAttributeNode("New Event", Request.Url)); } StackSiteMap(sitemapdata); } SetDefaultButton(manageAdd); if (!SessionManager.HasVerified()) { ReportWarning("You don't have any verified e-mail addresses and/or profile photos.\n" + "You must add/confirm a valid e-mail address and upload a profile photo before posting."); manageAdd.Enabled = false; } }
public int CreateOrUpdateAccountEvent(string ticket, TransitAccountEvent evt) { return(WebServiceImpl <TransitAccountEvent, ManagedAccountEvent, AccountEvent> .CreateOrUpdate( ticket, evt)); }
public int CreateOrUpdateAccountEvent(string ticket, TransitAccountEvent evt) { return WebServiceImpl<TransitAccountEvent, ManagedAccountEvent, AccountEvent>.CreateOrUpdate( ticket, evt); }