Exemple #1
0
        public ActionResult GetColectivos()
        {
            var res = ActionResult.NoAction;

            res.SetSuccess(Colectivo.JsonList(Colectivo.AllASPAD));
            return(res);
        }
    /// <summary>Page's load event</summary>
    /// <param name="sender">Loaded page</param>
    /// <param name="e">Event's arguments</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["Navigation"] = null;
        if (this.Request.UserLanguages != null)
        {
            this.languageBrowser = this.Request.UserLanguages[0];
        }

        ServicePointManager.Expect100Continue = true;
        ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls11 | SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls12;
        var           url     = ConfigurationManager.AppSettings["SalesForceUrl"].ToString();
        SforceService binding = new SforceService(url);

        try
        {
            var user        = ConfigurationManager.AppSettings["SalesForceUser"].ToString();
            var token       = ConfigurationManager.AppSettings["SalesForceToken"].ToString();
            var loginResult = binding.login(user, token);
            Session["SForceSessionId"] = loginResult.sessionId;
            Session["SForceWsUrl"]     = loginResult.serverUrl;
            binding.Url = loginResult.serverUrl;
            binding.SessionHeaderValue = new SessionHeader
            {
                sessionId = loginResult.sessionId
            };

            Session["SForceConnection"] = binding;
        }
        catch (Exception ex)
        {
            ExceptionManager.Trace(ex, "Salesforce login");
        }

        this.ip = this.GetUserIP();
        Session["ColectivosASPAD"]     = Colectivo.AllASPAD;
        Session["ColectivosASPADJson"] = Colectivo.JsonList(Session["ColectivosASPAD"] as ReadOnlyCollection <Colectivo>);
        Session["ProductosASPAD"]      = Producto.AllASPAD;
        Session["PreciosASPAD"]        = AspadLandFramework.Item.Acto.AllASPAD;
    }