Ejemplo n.º 1
0
        public void OpenSession(string url, bool forceSession)
        {
            string Login    = string.Empty;
            string Password = string.Empty;

            using (AvtoritetEntities ae = new AvtoritetEntities())
            {
                string  sql      = "SELECT        TOP (1) dbo.ProviderAccount.Login, dbo.ProviderAccount.Password\r\n                                            FROM dbo.Provider INNER JOIN\r\n                                            dbo.ProviderAccount ON dbo.Provider.ProviderId = dbo.ProviderAccount.ProviderId\r\n                                            WHERE(dbo.Provider.Uri LIKE N'%imtportal.gm.com/chevrolet%') AND(dbo.ProviderAccount.Enable = 1)";
                ProvAcc provider = ae.Database.SqlQuery <ProvAcc>(sql, new object[0]).FirstOrDefault <ProvAcc>();
                if (provider != null)
                {
                    Login    = provider.Login;
                    Password = provider.Password;
                }
            }
            //Login = "******";
            //Password = "******";
            this.requestHandler = RequestHandlerFactory.Create(url, Login, Password, null);
            HttpResponseMessage responseMessage = this.GetResponse(url, forceSession, this.requestHandler, ChevroletPortal.CookieContainer);

            if (responseMessage != null)
            {
                this.requestHandler.GetSessionResultAsync(responseMessage);
            }
        }
Ejemplo n.º 2
0
        public override void OpenSession(string url, long providerId, bool forceSession)
        {
            string url_session     = string.Empty;
            int    validateSession = -1;

            //uri = new Uri(url);
            //urlSession = string.Format("{0}://{1}/", uri.Scheme, uri.Host);
            url_session = url;

            if (!((validateSession = GetValidateSession(url_session, forceSession, ChevroletPortal.CookieContainer)) == 0))
            {
                string login    = string.Empty,
                       password = string.Empty;

                if (validateSession == -1)
                {
                    using (AvtoritetEntities ae = new AvtoritetEntities()) {
                        string sql =
                            //string.Format(
                            ////"SELECT        TOP (1) dbo.ProviderAccount.Login, dbo.ProviderAccount.Password\r\n                                            FROM dbo.Provider INNER JOIN\r\n                                            dbo.ProviderAccount ON dbo.Provider.ProviderId = dbo.ProviderAccount.ProviderId\r\n                                            WHERE(dbo.Provider.Uri LIKE N'%{0}%') AND(dbo.ProviderAccount.Enable = 1)"
                            ////, CatalogApi.UrlConstants.ChevroletOpelGroupRoot)
                            //"SELECT TOP (1) dbo.ProviderAccount.Login, dbo.ProviderAccount.Password{0}{1}"
                            //    + "FROM dbo.Provider{0}{1}"
                            //    + "INNER JOIN dbo.ProviderAccount ON dbo.Provider.ProviderId = dbo.ProviderAccount.ProviderId{0}{1}"
                            //    + "WHERE(dbo.Provider.Uri = N'{2}') AND (dbo.ProviderAccount.Enable = 1)"
                            //    , "\r\n", "                                            ", url_session)
                            GetQueryCreditionals(providerId)
                        ;

                        ProvAcc provider = ae.Database.SqlQuery <ProvAcc>(sql, new object[0]).FirstOrDefault <ProvAcc>();
                        if (provider != null)
                        {
                            login    = provider.Login;
                            password = provider.Password;
                        }
                    }

                    //uri = new Uri(url);
                    //urlSession = string.Format("{0}://{1}/", uri.Scheme, uri.Host);
                    url_session = url;

                    this.m_requestHandler = RequestHandlerFactory.Create(url_session, login, password, null);
                }
                else
                {
                    ;
                }
            }
            else
            {
                ;
            }
            HttpResponseMessage responseMessage = this.GetResponse(url_session, providerId, validateSession, this.m_requestHandler, ChevroletPortal.CookieContainer);

            if (responseMessage != null)
            {
                this.m_requestHandler.GetSessionResultAsync(responseMessage);
            }
        }
Ejemplo n.º 3
0
        public override void OpenSession(string url, long providerId, bool forceSession)
        {
            string url_session     = url;
            int    validateSession = -1;

            if (!((validateSession = GetValidateSession(url_session, forceSession, PeugeotPortal.CookieContainer)) == 0))
            {
                string login = string.Empty
                , password   = string.Empty;

                if (validateSession < 0)
                {
                    using (AvtoritetEntities ae = new AvtoritetEntities()) {
                        string sql =
                            //string.Format("SELECT TOP (1) dbo.ProviderAccount.Login, dbo.ProviderAccount.Password{0}"
                            //    + " FROM dbo.Provider{0}"
                            //    + " INNER JOIN dbo.ProviderAccount ON dbo.Provider.ProviderId = dbo.ProviderAccount.ProviderId{0}"
                            //    + " WHERE(dbo.Provider.Uri LIKE N'%peugeot%') AND(dbo.ProviderAccount.Enable = 1)"
                            //    , "\r\n")
                            GetQueryCreditionals(providerId)
                        ;

                        ProvAcc provider = ae.Database.SqlQuery <ProvAcc>(sql, new object[0]).FirstOrDefault <ProvAcc>();
                        login    = provider.Login;
                        password = provider.Password;
                    }

                    this.m_requestHandler = RequestHandlerFactory.Create(url_session, login, password, null);
                }
                else
                {
                    ;
                }
            }
            else
            {
                ;
            }

            HttpResponseMessage responseMessage = this.GetResponse(url_session, providerId, validateSession, this.m_requestHandler, PeugeotPortal.CookieContainer);

            if (responseMessage != null)
            {
                this.m_requestHandler.GetSessionResultAsync(responseMessage);
            }
            else
            {
                ;
            }
        }