public void CreateAccountWebsiteAccrossAccounts()
        {
            ManagedAccount a = new ManagedAccount(Session);
            ManagedAccount b = new ManagedAccount(Session);

            try
            {
                a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);
                b.Create("Test User 2", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);

                TransitAccountWebsite ta = new TransitAccountWebsite();
                ta.Name        = "My Website";
                ta.Description = "Lots of details.";
                ta.Url         = "http://www.dblock.org";

                ManagedAccountWebsite m_a = new ManagedAccountWebsite(Session);
                m_a.CreateOrUpdate(ta, a.GetSecurityContext());

                ManagedAccountWebsite m_b = new ManagedAccountWebsite(Session);
                m_b.CreateOrUpdate(ta, b.GetSecurityContext());
            }
            finally
            {
                a.Delete(a.GetSecurityContext());
                b.Delete(b.GetSecurityContext());
            }
        }
Beispiel #2
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("Me Me", Request, "AccountManage.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode("Websites", Request, "AccountWebsitesManage.aspx"));

            DomainClass cs = SessionManager.GetDomainClass("AccountWebsite");
            inputName.MaxLength = cs["Name"].MaxLengthInChars;
            inputUrl.MaxLength  = cs["Url"].MaxLengthInChars;

            int id = RequestId;

            if (id > 0)
            {
                TransitAccountWebsite tw = SessionManager.AccountService.GetAccountWebsiteById(SessionManager.Ticket, id);
                inputName.Text        = tw.Name;
                inputUrl.Text         = tw.Url;
                inputDescription.Text = tw.Description;
                sitemapdata.Add(new SiteMapDataAttributeNode(tw.Name, Request.Url));
            }
            else
            {
                sitemapdata.Add(new SiteMapDataAttributeNode("New Website", Request.Url));
            }

            StackSiteMap(sitemapdata);
        }

        SetDefaultButton(manageAdd);
    }
        public void CreateAccountWebsiteAccrossAccounts()
        {
            ManagedAccount a = new ManagedAccount(Session);
            ManagedAccount b = new ManagedAccount(Session);

            try
            {
                a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);
                b.Create("Test User 2", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);

                TransitAccountWebsite ta = new TransitAccountWebsite();
                ta.Name = "My Website";
                ta.Description = "Lots of details.";
                ta.Url = "http://www.dblock.org";

                ManagedAccountWebsite m_a = new ManagedAccountWebsite(Session);
                m_a.CreateOrUpdate(ta, a.GetSecurityContext());

                ManagedAccountWebsite m_b = new ManagedAccountWebsite(Session);
                m_b.CreateOrUpdate(ta, b.GetSecurityContext());
            }
            finally
            {
                a.Delete(a.GetSecurityContext());
                b.Delete(b.GetSecurityContext());
            }
        }
    public void save_Click(object sender, EventArgs e)
    {
        TransitAccountWebsite tw = new TransitAccountWebsite();
        tw.Name = inputName.Text;

        if (!Uri.IsWellFormedUriString(inputUrl.Text, UriKind.Absolute))
            inputUrl.Text = "http://" + inputUrl.Text;

        tw.Url = inputUrl.Text;
        tw.Description = inputDescription.Text;
        tw.Id = RequestId;
        SessionManager.CreateOrUpdate<TransitAccountWebsite>(
            tw, SessionManager.AccountService.CreateOrUpdateAccountWebsite);
        Redirect("AccountWebsitesManage.aspx");

    }
Beispiel #5
0
    public void save_Click(object sender, EventArgs e)
    {
        TransitAccountWebsite tw = new TransitAccountWebsite();

        tw.Name = inputName.Text;

        if (!Uri.IsWellFormedUriString(inputUrl.Text, UriKind.Absolute))
        {
            inputUrl.Text = "http://" + inputUrl.Text;
        }

        tw.Url         = inputUrl.Text;
        tw.Description = inputDescription.Text;
        tw.Id          = RequestId;
        SessionManager.CreateOrUpdate <TransitAccountWebsite>(
            tw, SessionManager.AccountService.CreateOrUpdateAccountWebsite);
        Redirect("AccountWebsitesManage.aspx");
    }
Beispiel #6
0
    public override TransitPicture GetPictureWithThumbnail(int id)
    {
        TransitAccountWebsite p = SessionManager.GetInstance <TransitAccountWebsite, int>(
            id, SessionManager.AccountService.GetAccountWebsiteById);

        if (p == null || p.Bitmap == null)
        {
            return(GetRandomPictureWithThumbnail());
        }

        TransitPicture result = new TransitPicture();

        result.Id       = p.Id;
        result.Bitmap   = p.Thumbnail;
        result.Created  = p.Created;
        result.Modified = p.Modified;
        result.Name     = p.Name;
        return(result);
    }
        public void CreateAccountWebsiteInvalid()
        {
            ManagedAccount a = new ManagedAccount(Session);

            try
            {
                a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);

                TransitAccountWebsite ta = new TransitAccountWebsite();
                ta.Name        = "My Website";
                ta.Description = "Lots of details.";
                ta.Url         = "<script>attack!</script>";

                ManagedAccountWebsite m_w = new ManagedAccountWebsite(Session);
                m_w.CreateOrUpdate(ta, a.GetSecurityContext());
            }
            finally
            {
                a.Delete(AdminSecurityContext);
            }
        }
        public void CreateAccountWebsiteInvalid()
        {
            ManagedAccount a = new ManagedAccount(Session);

            try
            {
                a.Create("Test User", "testpassword", "*****@*****.**", DateTime.UtcNow, AdminSecurityContext);

                TransitAccountWebsite ta = new TransitAccountWebsite();
                ta.Name = "My Website";
                ta.Description = "Lots of details.";
                ta.Url = "<script>attack!</script>";

                ManagedAccountWebsite m_w = new ManagedAccountWebsite(Session);
                m_w.CreateOrUpdate(ta, a.GetSecurityContext());
            }
            finally
            {
                a.Delete(AdminSecurityContext);
            }
        }
Beispiel #9
0
 public int CreateOrUpdateAccountWebsite(string ticket, TransitAccountWebsite t_instance)
 {
     return WebServiceImpl<TransitAccountWebsite, ManagedAccountWebsite, AccountWebsite>.CreateOrUpdate(
         ticket, t_instance);
 }