public static List <Customer> getCustomerList(RestProfile profile)
        {
            ServiceContext          serviceContext       = getServiceContext(profile);
            QueryService <Customer> customerQueryService = new QueryService <Customer>(serviceContext);

            return(customerQueryService.Select(c => c).ToList());
        }
Ejemplo n.º 2
0
        public static List <Customer> getCustomerList(RestProfile profile)
        {
            ServiceContext          serviceContext       = getServiceContext(profile);
            QueryService <Customer> customerQueryService = new QueryService <Customer>(serviceContext);

            return(customerQueryService.ExecuteIdsQuery("SELECT * FROM Customer").ToList <Customer>());
        }
 public static void clearProfile(RestProfile profile)
 {
     profile.OAuthAccessToken = "";
     profile.OAuthAccessTokenSecret = "";
     profile.RealmId = "";
     profile.DataSource = -1;
     profile.Save();
 }
 public static void clearProfile(RestProfile profile)
 {
     profile.OAuthAccessToken       = "";
     profile.OAuthAccessTokenSecret = "";
     profile.RealmId    = "";
     profile.DataSource = -1;
     profile.Save();
 }
        private static ServiceContext getServiceContext(RestProfile profile)
        {
            var consumerKey    = ConfigurationManager.AppSettings["consumerKey"].ToString();
            var consumerSecret = ConfigurationManager.AppSettings["consumerSecret"].ToString();
            OAuthRequestValidator oauthValidator = new OAuthRequestValidator(profile.OAuthAccessToken, profile.OAuthAccessTokenSecret, consumerKey, consumerSecret);

            return(new ServiceContext(profile.RealmId, (IntuitServicesType)profile.DataSource, oauthValidator));
        }
 protected void disconnect_Click(object sender, EventArgs e)
 {
     try
     {
         RestHelper.disconnectRealm(RestProfile.GetRestProfile());
     }
     catch
     {
     }
     finally { loadVisibleSections(); }
 }
 public void ToggleBlueDotMenuVisibility()
 {
     if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated && RestHelper.appTokensSet() && !Request.FilePath.Contains("OAuth"))
     {
         RestProfile profile = RestProfile.GetRestProfile();
         blueDotMenu.Visible = profile.OAuthAccessToken.Length > 0;
     }
     else
     {
         blueDotMenu.Visible = false;
     }
 }
Ejemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated || !RestHelper.appTokensSet() || RestProfile.GetRestProfile().OAuthAccessToken.Length == 0)
         {
             Response.Redirect("~/ManageConnection");
         }
         customersView.DataSource = RestHelper.getCustomerList(RestProfile.GetRestProfile());
         customersView.DataBind();
     }
     catch
     {
     }
 }
 private void loadVisibleSections()
 {
     notLoggedIn.Visible       = false;
     notConnected.Visible      = false;
     connected.Visible         = false;
     appTokensNotFound.Visible = false;
     if (!RestHelper.appTokensSet())
     {
         appTokensNotFound.Visible = true;
     }
     else if (!System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
     {
         notLoggedIn.Visible = true;
     }
     else
     {
         notConnected.Visible = RestProfile.GetRestProfile().OAuthAccessToken == "";
         connected.Visible    = RestProfile.GetRestProfile().OAuthAccessToken != "";
     }
     (this.Master as SiteMaster).ToggleBlueDotMenuVisibility();
 }
Ejemplo n.º 10
0
        public static string callPlatform(RestProfile profile, string url)
        {
            OAuthConsumerContext consumerContext = new OAuthConsumerContext
            {
                ConsumerKey     = ConfigurationManager.AppSettings["consumerKey"].ToString(),
                SignatureMethod = SignatureMethod.HmacSha1,
                ConsumerSecret  = ConfigurationManager.AppSettings["consumerSecret"].ToString()
            };

            OAuthSession oSession = new OAuthSession(consumerContext, Constants.OauthEndPoints.IdFedOAuthBaseUrl + Constants.OauthEndPoints.UrlRequestToken,
                                                     Constants.OauthEndPoints.AuthorizeUrl,
                                                     Constants.OauthEndPoints.IdFedOAuthBaseUrl + Constants.OauthEndPoints.UrlAccessToken);

            oSession.ConsumerContext.UseHeaderForOAuthParameters = true;
            if (profile.OAuthAccessToken.Length > 0)
            {
                oSession.AccessToken = new TokenBase
                {
                    Token       = profile.OAuthAccessToken,
                    ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(),
                    TokenSecret = profile.OAuthAccessTokenSecret
                };

                IConsumerRequest conReq = oSession.Request();
                conReq = conReq.Get();
                conReq = conReq.ForUrl(url);
                try
                {
                    conReq = conReq.SignWithToken();
                    return(conReq.ReadBody());
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return("");
        }
        public static string callPlatform(RestProfile profile, string url)
        {
            OAuthConsumerContext consumerContext = new OAuthConsumerContext
            {
                ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(),
                SignatureMethod = SignatureMethod.HmacSha1,
                ConsumerSecret = ConfigurationManager.AppSettings["consumerSecret"].ToString()
            };

            OAuthSession oSession = new OAuthSession(consumerContext, Constants.OauthEndPoints.IdFedOAuthBaseUrl + Constants.OauthEndPoints.UrlRequestToken,
                                  Constants.OauthEndPoints.AuthorizeUrl,
                                  Constants.OauthEndPoints.IdFedOAuthBaseUrl + Constants.OauthEndPoints.UrlAccessToken);

            oSession.ConsumerContext.UseHeaderForOAuthParameters = true;
            if (profile.OAuthAccessToken.Length > 0)
            {
                oSession.AccessToken = new TokenBase
                {
                    Token = profile.OAuthAccessToken,
                    ConsumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString(),
                    TokenSecret = profile.OAuthAccessTokenSecret
                };

                IConsumerRequest conReq = oSession.Request();
                conReq = conReq.Get();
                conReq = conReq.ForUrl(url);
                try
                {
                    conReq = conReq.SignWithToken();
                    return conReq.ReadBody();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            return "";
        }
 private static DataService getDataService(RestProfile profile)
 {
     ServiceContext serviceContext = getServiceContext(profile);
     return new DataService(serviceContext);
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            RestProfile profile = RestProfile.GetRestProfile();

            Response.Write(RestHelper.callPlatform(profile, Constants.IppEndPoints.BlueDotAppMenuUrl));
        }
 private static ServiceContext getServiceContext(RestProfile profile)
 {
     var consumerKey = ConfigurationManager.AppSettings["consumerKey"].ToString();
     var consumerSecret = ConfigurationManager.AppSettings["consumerSecret"].ToString();
     OAuthRequestValidator oauthValidator = new OAuthRequestValidator(profile.OAuthAccessToken, profile.OAuthAccessTokenSecret, consumerKey, consumerSecret);
     return new ServiceContext(profile.RealmId, (IntuitServicesType)profile.DataSource, oauthValidator);
 }
Ejemplo n.º 15
0
        private static DataService getDataService(RestProfile profile)
        {
            ServiceContext serviceContext = getServiceContext(profile);

            return(new DataService(serviceContext));
        }
Ejemplo n.º 16
0
 public static void disconnectRealm(RestProfile profile)
 {
     RestHelper.callPlatform(profile, Constants.IppEndPoints.DisconnectUrl);
     clearProfile(profile);
 }
 public static void disconnectRealm(RestProfile profile)
 {
     RestHelper.callPlatform(profile, Constants.IppEndPoints.DisconnectUrl);
     clearProfile(profile);
 }
 public static List<Customer> getCustomerList(RestProfile profile)
 {
     ServiceContext serviceContext = getServiceContext(profile);
     QueryService<Customer> customerQueryService = new QueryService<Customer>(serviceContext);
     return customerQueryService.Select(c => c).ToList();
 }