Ejemplo n.º 1
0
 public void save_Click(object sender, EventArgs e)
 {
     TransitAccountAddress tw = new TransitAccountAddress();
     tw.Name = inputName.Text;
     tw.Street = inputStreet.Text;
     tw.Apt = inputApt.Text;
     tw.City = inputCity.Text;
     tw.Country = inputCountry.SelectedValue;
     tw.State = inputState.SelectedValue;
     tw.Zip = inputZip.Text;
     tw.Id = RequestId;
     SessionManager.CreateOrUpdate<TransitAccountAddress>(
         tw, SessionManager.AccountService.CreateOrUpdateAccountAddress);
     Redirect("AccountAddressesManage.aspx");
 }
Ejemplo n.º 2
0
    public void save_Click(object sender, EventArgs e)
    {
        TransitAccountAddress tw = new TransitAccountAddress();

        tw.Name    = inputName.Text;
        tw.Street  = inputStreet.Text;
        tw.Apt     = inputApt.Text;
        tw.City    = inputCity.Text;
        tw.Country = inputCountry.SelectedValue;
        tw.State   = inputState.SelectedValue;
        tw.Zip     = inputZip.Text;
        tw.Id      = RequestId;
        SessionManager.CreateOrUpdate <TransitAccountAddress>(
            tw, SessionManager.AccountService.CreateOrUpdateAccountAddress);
        Redirect("AccountAddressesManage.aspx");
    }
Ejemplo n.º 3
0
        public void CreateManyAccounts(int count)
        {
            ManagedSecurityContext sec = ManagedAccount.GetAdminSecurityContext(Session);

            TransitCountry tc = new TransitCountry();

            tc.Name = Guid.NewGuid().ToString();
            TransitState ts = new TransitState();

            ts.Name    = Guid.NewGuid().ToString();
            ts.Country = tc.Name;

            ManagedCountry c = new ManagedCountry(Session);

            c.CreateOrUpdate(tc, sec);

            ManagedState s = new ManagedState(Session);

            s.CreateOrUpdate(ts, sec);

            TransitAccountAddress ta = new TransitAccountAddress();

            ta.Apt     = "123";
            ta.City    = "New York";
            ta.Country = tc.Name;
            ta.Name    = "My Address";
            ta.State   = ts.Name;
            ta.Street  = "Houston St.";
            ta.Zip     = "10001";

            for (int i = 0; i < count; i++)
            {
                ManagedAccount a    = new ManagedAccount(Session);
                string         name = Guid.NewGuid().ToString();
                a.Create(
                    name,
                    "password",
                    string.Format("{0}@localhost.com", name),
                    DateTime.UtcNow,
                    sec);

                ManagedAccountAddress ma = new ManagedAccountAddress(Session);
                ma.CreateOrUpdate(ta, a.GetSecurityContext());
            }
        }
Ejemplo n.º 4
0
        public void CreateManyAccounts(int count)
        {
            ManagedSecurityContext sec = ManagedAccount.GetAdminSecurityContext(Session);

            TransitCountry tc = new TransitCountry();
            tc.Name = Guid.NewGuid().ToString();
            TransitState ts = new TransitState();
            ts.Name = Guid.NewGuid().ToString();
            ts.Country = tc.Name;

            ManagedCountry c = new ManagedCountry(Session);
            c.CreateOrUpdate(tc, sec);

            ManagedState s = new ManagedState(Session);
            s.CreateOrUpdate(ts, sec);

            TransitAccountAddress ta = new TransitAccountAddress();
            ta.Apt = "123";
            ta.City = "New York";
            ta.Country = tc.Name;
            ta.Name = "My Address";
            ta.State = ts.Name;
            ta.Street = "Houston St.";
            ta.Zip = "10001";

            for (int i = 0; i < count; i++)
            {

                ManagedAccount a = new ManagedAccount(Session);
                string name = Guid.NewGuid().ToString();
                a.Create(
                    name,
                    "password",
                    string.Format("{0}@localhost.com", name),
                    DateTime.UtcNow, 
                    sec);

                ManagedAccountAddress ma = new ManagedAccountAddress(Session);
                ma.CreateOrUpdate(ta, a.GetSecurityContext());
            }
        }
Ejemplo n.º 5
0
        public void CreateAccountAddress()
        {
            ManagedAccount a = new ManagedAccount(Session);
            ManagedCountry c = new ManagedCountry(Session);
            ManagedState   s = new ManagedState(Session);

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

                TransitCountry tc = new TransitCountry();
                tc.Name = GetNewString();
                TransitState ts = new TransitState();
                ts.Name    = GetNewString();
                ts.Country = tc.Name;

                c.CreateOrUpdate(tc, AdminSecurityContext);
                s.CreateOrUpdate(ts, AdminSecurityContext);

                TransitAccountAddress ta = new TransitAccountAddress();
                ta.Apt     = "123";
                ta.City    = "New York";
                ta.Country = tc.Name;
                ta.Name    = "My Address";
                ta.State   = ts.Name;
                ta.Street  = "Houston St.";
                ta.Zip     = "10001";

                ManagedAccountAddress m_a = new ManagedAccountAddress(Session);
                m_a.CreateOrUpdate(ta, new ManagedSecurityContext(a.Instance));
            }
            finally
            {
                a.Delete(AdminSecurityContext);
                s.Delete(AdminSecurityContext);
                c.Delete(AdminSecurityContext);
                Session.Flush();
            }
        }
Ejemplo n.º 6
0
        public void CreateAccountAddress()
        {
            ManagedAccount a = new ManagedAccount(Session);
            ManagedCountry c = new ManagedCountry(Session);
            ManagedState s = new ManagedState(Session);

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

                TransitCountry tc = new TransitCountry();
                tc.Name = GetNewString();
                TransitState ts = new TransitState();
                ts.Name = GetNewString();
                ts.Country = tc.Name;

                c.CreateOrUpdate(tc, AdminSecurityContext);
                s.CreateOrUpdate(ts, AdminSecurityContext);

                TransitAccountAddress ta = new TransitAccountAddress();
                ta.Apt = "123";
                ta.City = "New York";
                ta.Country = tc.Name;
                ta.Name = "My Address";
                ta.State = ts.Name;
                ta.Street = "Houston St.";
                ta.Zip = "10001";

                ManagedAccountAddress m_a = new ManagedAccountAddress(Session);
                m_a.CreateOrUpdate(ta, new ManagedSecurityContext(a.Instance));
            }
            finally
            {
                a.Delete(AdminSecurityContext);
                s.Delete(AdminSecurityContext);
                c.Delete(AdminSecurityContext);
                Session.Flush();
            }
        }
Ejemplo n.º 7
0
 public int CreateOrUpdateAccountAddress(string ticket, TransitAccountAddress t_instance)
 {
     return WebServiceImpl<TransitAccountAddress, ManagedAccountAddress, AccountAddress>.CreateOrUpdate(
         ticket, t_instance);
 }
Ejemplo n.º 8
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("Addresses", Request, "AccountAddressesManage.aspx"));

            DomainClass cs = SessionManager.GetDomainClass("AccountAddress");
            inputApt.MaxLength    = cs["Apt"].MaxLengthInChars;
            inputCity.MaxLength   = cs["City"].MaxLengthInChars;
            inputStreet.MaxLength = cs["Street"].MaxLengthInChars;
            inputZip.MaxLength    = cs["Zip"].MaxLengthInChars;
            inputName.MaxLength   = cs["Name"].MaxLengthInChars;

            TransitAccountAddress tw = null;

            int id = RequestId;

            if (id > 0)
            {
                tw               = SessionManager.AccountService.GetAccountAddressById(SessionManager.Ticket, id);
                inputName.Text   = Renderer.Render(tw.Name);
                inputApt.Text    = Renderer.Render(tw.Apt);
                inputStreet.Text = Renderer.Render(tw.Street);
                inputCity.Text   = Renderer.Render(tw.City);
                inputZip.Text    = Renderer.Render(tw.Zip);
                sitemapdata.Add(new SiteMapDataAttributeNode(tw.Name, Request.Url));
            }
            else
            {
                sitemapdata.Add(new SiteMapDataAttributeNode("New Address", Request.Url));
            }

            StackSiteMap(sitemapdata);

            List <TransitCountry> countries = new List <TransitCountry>();
            if (tw == null || tw.Country.Length == 0)
            {
                countries.Add(new TransitCountry());
            }
            string defaultcountry = SessionManager.GetCachedConfiguration("SnCore.Country.Default", "United States");
            countries.AddRange(SessionManager.GetCollection <TransitCountry, string>(
                                   defaultcountry, (ServiceQueryOptions)null, SessionManager.LocationService.GetCountriesWithDefault));

            List <TransitState> states = new List <TransitState>();
            if (tw == null || tw.State.Length == 0)
            {
                states.Add(new TransitState());
            }
            states.AddRange(SessionManager.GetCollection <TransitState>(
                                (ServiceQueryOptions)null, SessionManager.LocationService.GetStates));

            inputCountry.DataSource = countries;
            inputCountry.DataBind();

            inputState.DataSource = states;
            inputState.DataBind();

            if (tw != null)
            {
                ListItemManager.SelectAdd(inputCountry, tw.Country);
                ListItemManager.SelectAdd(inputState, tw.State);
            }
        }

        SetDefaultButton(manageAdd);
    }