public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            linkCancel.NavigateUrl = ReturnUrl;

            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 mad libs.");

                panelPost.Visible = false;
                post.Enabled      = false;
            }

            madLibInstance.MadLibId = MadLibId;
            madLibInstance.DataBind();

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode(ObjectName + "s", Request, string.Format("{0}View.aspx", ObjectName)));
            sitemapdata.Add(new SiteMapDataAttributeNode(InstanceName, Request, ReturnUrl));

            if (MadLibInstanceId > 0)
            {
                TransitMadLibInstance tmi = SessionManager.GetInstance <TransitMadLibInstance, int>(
                    MadLibInstanceId, SessionManager.MadLibService.GetMadLibInstanceById);
                madLibInstance.TextBind(tmi.Text);
            }

            sitemapdata.Add(new SiteMapDataAttributeNode("Mad Lib", Request.Url));
            StackSiteMap(sitemapdata);
        }

        SetDefaultButton(post);
    }
    public void post_Click(object sender, EventArgs e)
    {
        string text = string.Empty;

        if (madLibInstance.TryGetText(ref text))
        {
            TransitMadLibInstance madlib = new TransitMadLibInstance();
            madlib.Id              = RequestId;
            madlib.AccountId       = SessionManager.Account.Id;
            madlib.MadLibId        = MadLibId;
            madlib.ObjectId        = ObjectId;
            madlib.ObjectName      = ObjectName;
            madlib.Text            = text;
            madlib.ObjectUri       = ReturnUrl;
            madlib.ObjectAccountId = ObjectAccountId;
            SessionManager.CreateOrUpdate <TransitMadLibInstance>(
                madlib, SessionManager.MadLibService.CreateOrUpdateMadLibInstance);
            Redirect(linkCancel.NavigateUrl);
        }
    }
示例#3
0
 public int CreateOrUpdateMadLibInstance(string ticket, TransitMadLibInstance madlibinstance)
 {
     return WebServiceImpl<TransitMadLibInstance, ManagedMadLibInstance, MadLibInstance>.CreateOrUpdate(
         ticket, madlibinstance);
 }
 public void post_Click(object sender, EventArgs e)
 {
     string text = string.Empty;
     if (madLibInstance.TryGetText(ref text))
     {
         TransitMadLibInstance madlib = new TransitMadLibInstance();
         madlib.Id = RequestId;
         madlib.AccountId = SessionManager.Account.Id;
         madlib.MadLibId = MadLibId;
         madlib.ObjectId = ObjectId;
         madlib.ObjectName = ObjectName;
         madlib.Text = text;
         madlib.ObjectUri = ReturnUrl;
         madlib.ObjectAccountId = ObjectAccountId;
         SessionManager.CreateOrUpdate<TransitMadLibInstance>(
             madlib, SessionManager.MadLibService.CreateOrUpdateMadLibInstance);
         Redirect(linkCancel.NavigateUrl);
     }
 }
示例#5
0
 public int CreateOrUpdateMadLibInstance(string ticket, TransitMadLibInstance madlibinstance)
 {
     return(WebServiceImpl <TransitMadLibInstance, ManagedMadLibInstance, MadLibInstance> .CreateOrUpdate(
                ticket, madlibinstance));
 }