예제 #1
0
    public void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            TransitAccount ta = SessionManager.AccountService.GetAccountById(
                SessionManager.Ticket, AccountId);

            SiteMapDataAttribute sitemapdata = new SiteMapDataAttribute();
            sitemapdata.Add(new SiteMapDataAttributeNode("People", Request, "AccountsView.aspx"));
            sitemapdata.Add(new SiteMapDataAttributeNode(ta.Name, Request, string.Format("AccountView.aspx?id={0}", ta.Id)));
            sitemapdata.Add(new SiteMapDataAttributeNode("Attributes", Request, string.Format("AccountAttributesManage.aspx?id={0}", ta.Id)));

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

            linkBack.NavigateUrl = string.Format("AccountAttributesManage.aspx?id={0}", AccountId);

            List <TransitAttribute> attributes = SessionManager.ObjectService.GetAttributes(
                SessionManager.Ticket, null);

            if (RequestId == 0)
            {
                attributes.Insert(0, new TransitAttribute());
            }

            listAttributes.DataSource = attributes;
            listAttributes.DataBind();

            if (RequestId > 0)
            {
                TransitAccountAttribute attribute = SessionManager.AccountService.GetAccountAttributeById(
                    SessionManager.Ticket, RequestId);
                inputValue.Text        = Renderer.Render(attribute.Value);
                inputUrl.Text          = Renderer.Render(attribute.Url);
                inputDefaultUrl.Text   = Renderer.Render(attribute.Attribute.DefaultUrl);
                inputDefaultValue.Text = Renderer.Render(attribute.Attribute.DefaultValue);
                ListItemManager.SelectAdd(listAttributes, attribute.AttributeId);
                listAttributes.Enabled = false;
                previewImage.ImageUrl  = string.Format("SystemAttribute.aspx?id={0}", attribute.AttributeId);
                previewImage.Visible   = true;
                sitemapdata.Add(new SiteMapDataAttributeNode(attribute.Attribute.Name, Request.Url));
            }
            else
            {
                sitemapdata.Add(new SiteMapDataAttributeNode("New Attribute", Request.Url));
            }

            StackSiteMap(sitemapdata);
        }

        SetDefaultButton(manageAdd);
    }
예제 #2
0
    public void save_Click(object sender, EventArgs e)
    {
        TransitAccountAttribute attribute = new TransitAccountAttribute();

        attribute.Url         = inputUrl.Text;
        attribute.Value       = inputValue.Text;
        attribute.Id          = RequestId;
        attribute.AttributeId = int.Parse(listAttributes.SelectedValue);
        attribute.AccountId   = AccountId;
        SessionManager.CreateOrUpdate <TransitAccountAttribute>(
            attribute, SessionManager.AccountService.CreateOrUpdateAccountAttribute);
        Redirect(linkBack.NavigateUrl);
    }
예제 #3
0
    public void save_Click(object sender, EventArgs e)
    {
        TransitAccountAttribute attribute = new TransitAccountAttribute();

        attribute.Url = inputUrl.Text;
        attribute.Value = inputValue.Text;
        attribute.Id = RequestId;
        attribute.AttributeId = int.Parse(listAttributes.SelectedValue);
        attribute.AccountId = AccountId;
        SessionManager.CreateOrUpdate<TransitAccountAttribute>(
            attribute, SessionManager.AccountService.CreateOrUpdateAccountAttribute);
        Redirect(linkBack.NavigateUrl);

    }
예제 #4
0
 public int CreateOrUpdateAccountAttribute(string ticket, TransitAccountAttribute attribute)
 {
     return WebServiceImpl<TransitAccountAttribute, ManagedAccountAttribute, AccountAttribute>.CreateOrUpdate(
         ticket, attribute);
 }