Exemplo n.º 1
0
        // For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
        public void ConfigureAuth(IAppBuilder app)
        {
            // Enable the application to use a cookie to store information for the signed in user
            app.UseCookieAuthentication(new CookieAuthenticationOptions
            {
                AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
                LoginPath          = new PathString("/Account/Login")
            });
            // Use a cookie to temporarily store information about a user logging in with a third party login provider
            app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
            app.MapSignalR();

            RegisterChanges.RegisterDependency();

            // Uncomment the following lines to enable logging in with third party login providers
            //app.UseMicrosoftAccountAuthentication(
            //    clientId: "",
            //    clientSecret: "");

            //app.UseTwitterAuthentication(
            //   consumerKey: "",
            //   consumerSecret: "");

            //app.UseFacebookAuthentication(
            //   appId: "",
            //   appSecret: "");

            //app.UseGoogleAuthentication();
        }
Exemplo n.º 2
0
        public ActionResult GetAllNotifications()
        {
            string UserName = User.Identity.Name;

            var temp = RegisterChanges.GetAllNotifications(UserName);

            return(View("~/Views/Shared/Notifications.cshtml", temp));
        }
Exemplo n.º 3
0
        public ActionResult NotificationRequest(int id)//NotificationId
        {
            var DefaultUrl = HttpContext.Request.UrlReferrer.ToString();

            string RetUrl = RegisterChanges.SetReadDate(id);

            if (string.IsNullOrEmpty(RetUrl))
            {
                return(Redirect(DefaultUrl));
            }

            Uri rU = new Uri(RetUrl);

            string[] QueryParameters = HttpUtility.ParseQueryString(rU.Query).AllKeys;

            if (QueryParameters.Contains("SiteId") && QueryParameters.Contains("DivisionId"))
            {
                int SiteId     = Int32.Parse(HttpUtility.ParseQueryString(rU.Query).Get("SiteId"));
                int DivisionId = Int32.Parse(HttpUtility.ParseQueryString(rU.Query).Get("DivisionId"));


                if (SiteId != 0)
                {
                    System.Web.HttpContext.Current.Session["SiteId"] = SiteId;
                    System.Web.HttpContext.Current.Session[SessionNameConstants.SiteShortName] = _notificationService.GetSite(SiteId).SiteCode;
                }
                if (DivisionId != 0)
                {
                    System.Web.HttpContext.Current.Session["DivisionId"] = DivisionId;
                    System.Web.HttpContext.Current.Session[SessionNameConstants.DivisionName] = _notificationService.GetDivision(DivisionId).DivisionName;
                }

                var ParamCollection = HttpUtility.ParseQueryString(rU.Query);
                ParamCollection.Remove("SiteId");
                ParamCollection.Remove("DivisionId");

                UriBuilder r = new UriBuilder(RetUrl);
                r.Query = ParamCollection.ToString();

                RetUrl = r.ToString();
            }

            return(Redirect(RetUrl));
        }