public virtual ActionResult LogOff()
        {
            var swapBranding = false;

            if (HttpContext.User.IsInRole("CompanyOwner"))
            {
                var userId = _currentUser == null ? Guid.Empty : (Guid)(_currentUser.ProviderUserKey ?? Guid.Empty);
                using (var ctx = new MembershipConnection())
                {
                    using (var db = new EightHundredEntities())
                    {
                        swapBranding = ctx.UserFranchise
                                       .Where(uf => uf.UserId == userId)
                                       .ToArray()
                                       .Select(uf => (from f in db.tbl_Franchise where f.FranchiseID == uf.FranchiseID select f).SingleOrDefault())
                                       .Any(f => f.FranchiseTypeID == 6);
                    }
                }
            }

            authenticationService.LogOff();
            SessionContainer.Remove();

            if (swapBranding)
            {
                Response.Redirect("http://www.1800plumber.com");
            }

            return(RedirectToAction("Index", "Home"));
        }
Ejemplo n.º 2
0
        private void DropStation(object sender, EventArgs e)
        {
            if (sender is IPort port)
            {
                var currentSession = _sessionContainer.GetByAny(port);
                if (currentSession != null)
                {
                    if (currentSession.State == SessionState.Connected)
                    {
                        currentSession.Source.StateCall = PortStateCall.Free;
                        currentSession.Target.StateCall = PortStateCall.Free;
                        currentSession.State            = SessionState.Close;

                        OnCallEnded(new ConnectInfo(currentSession.Source.Number, currentSession.Target.Number, currentSession.Start, DateTime.Now, ConnectInfoState.Accepted));

                        _sessionContainer.Remove(currentSession);

                        Console.WriteLine("Current call is completed");
                    }
                    else
                    {
                        currentSession.Source.StateCall = PortStateCall.Free;
                        currentSession.Target.StateCall = PortStateCall.Free;
                        currentSession.State            = SessionState.Close;

                        OnCallEnded(new ConnectInfo(currentSession.Source.Number, currentSession.Target.Number, currentSession.Start, currentSession.Start, ConnectInfoState.Unaccepted));

                        _sessionContainer.Remove(currentSession);

                        Console.WriteLine("Current dialing is interrupted");
                    }
                }
                else
                {
                    Console.WriteLine("Session not found");
                }
            }
        }
        public ActionResult Logout()
        {
            ConfigId.ClearStoreItem();
            //var cookieConfig = Request.Cookies["id_config"];
            //if (cookieConfig != null) cookieConfig.Expires = DateTime.Now;

            var cookieJob = Request.Cookies["id_job"];

            if (cookieJob != null)
            {
                cookieJob.Expires = DateTime.Now;
            }

            authenticationService.LogOff();
            SessionContainer.Remove();
            //var cookieFranchise = Request.Cookies["franchise_id"];
            //if (cookieFranchise != null) cookieFranchise.Expires = DateTime.Now.AddDays(7);

            return(Json(new { result = "success" }));
        }