//
        // GET: /OAuthHandler/
        public ActionResult OAuthHandler()
        {
            string _oauthVerifyer, _realmid;

            SessionWrapper sessObj = new SessionWrapper();
            if (Request.QueryString.HasKeys())
            {
                // This value is used to Get Access Token.
                _oauthVerifyer = Request.QueryString["oauth_verifier"].ToString(CultureInfo.InvariantCulture);

                _realmid = Request.QueryString["realmId"].ToString(CultureInfo.InvariantCulture);
                Session["realm"] = _realmid;

                //If dataSource is QBO call QuickBooks Online Services, else call QuickBooks Desktop Services
                switch (Request.QueryString["dataSource"].ToString(CultureInfo.InvariantCulture))
                {
                    case "QBO":
                        SessionWrapper.IntuitServiceType = IntuitServicesType.QBO.ToString();
                        break;
                    default:
                        SessionWrapper.IntuitServiceType = IntuitServicesType.QBD.ToString();
                        break;
                }

                //Stored in a session for demo purposes.
                //Production applications should securely store the Access Token
                OauthHandlerWrapper.getAccessToken(_oauthVerifyer);

                // This value is used to redirect to Default.aspx from Cleanup page when user clicks on ConnectToInuit widget.
                SessionWrapper.RedirectToDefault = "true";
            }
            else
            {
                Response.Write("No OAuth token was received");
            }

            return View();
            //return RedirectToAction("About", "Home");
        }
        public ActionResult GetBlueDotMenu()
        {
            SessionWrapper sessObj = new SessionWrapper();
            GlobalVariablesWrapper glblObj = new GlobalVariablesWrapper();
            ApplicationUserAppValues usrAppObj = new ApplicationUserAppValues();

            SessionWrapper.ServiceEndPoint = Constants.IaEndPoints.BlueDotAppMenuUrl;
            OAuthConsumerContext consumerContext = new OAuthConsumerContext
            {
                ConsumerKey = ApplicationUserAppValues.ConsumerKey,
                SignatureMethod = SignatureMethod.HmacSha1,
                ConsumerSecret = ApplicationUserAppValues.ConsumerSecret
            };

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

            oSession.ConsumerContext.UseHeaderForOAuthParameters = true;

            oSession.AccessToken = new TokenBase
            {
                Token = SessionWrapper.accessToken,
                ConsumerKey = ApplicationUserAppValues.ConsumerKey,
                TokenSecret = SessionWrapper.accessTokenSecret
            };

            IConsumerRequest conReq = oSession.Request();
            conReq = conReq.Get();
            conReq = conReq.ForUrl(SessionWrapper.ServiceEndPoint);
            try
            {
                conReq = conReq.SignWithToken();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            string header = conReq.Context.GenerateOAuthParametersForHeader();
            try
            {

                GlobalVariablesWrapper.TxtServiceResponseForMenu = conReq.ReadBody();
                //check alternative but this should work nimisha
                Response.Write(GlobalVariablesWrapper.TxtServiceResponseForMenu);
            }
            catch (WebException we)
            {
                HttpWebResponse rsp = (HttpWebResponse)we.Response;
                if (rsp != null)
                {
                    try
                    {
                        using (StreamReader reader = new StreamReader(rsp.GetResponseStream()))
                        {
                            GlobalVariablesWrapper.TxtServiceResponseForMenu = GlobalVariablesWrapper.TxtServiceResponseForMenu + rsp.StatusCode + " | " + reader.ReadToEnd();
                        }
                    }
                    catch (Exception)
                    {
                        GlobalVariablesWrapper.TxtServiceResponseForMenu = GlobalVariablesWrapper.TxtServiceResponseForMenu + "Status code: " + rsp.StatusCode;
                    }
                }
                else
                {
                    GlobalVariablesWrapper.TxtServiceResponseForMenu = GlobalVariablesWrapper.TxtServiceResponseForMenu + "Error Communicating with Intuit Anywhere" + we.Message;
                }
            }

            return View("GetBlueDotMenu");
        }