Esempio n. 1
0
        // **************************************
        // URL: /Account/LogOn
        // **************************************

        public ActionResult LogOn()
        {
            GDS.Communication.GDSLogin.LogOut();
            UserEnvironmentVariables uenv = new UserEnvironmentVariables();

            uenv.SetLogOut();
            return(View());
        }
Esempio n. 2
0
        public string GetEnvironmentVariable(string name)
        {
            if (UserEnvironmentVariables.ContainsKey(name))
            {
                return(UserEnvironmentVariables[name]);
            }

            var value = Environment.GetEnvironmentVariable(name);

            if (string.IsNullOrWhiteSpace(value))
            {
                return(null);
            }

            return(value); // We don't set the dictionary since it is used for user customized values
        }
Esempio n. 3
0
        // **************************************
        // URL: /Account/LogOff
        // **************************************

        public ActionResult LogOut()
        {
            TravelSession obj = (TravelSession)Session["TravelPortalSessionInfo"];

            if (obj != null)
            {
                MembershipUser usr = Membership.GetUser(obj.Id);
                LoginHistories lgh = new LoginHistories();
                lgh.LogedinDateTime  = usr.LastLoginDate;
                lgh.LogedoutDateTime = DateTime.Now;
                lgh.UserId           = obj.Id;
                generalProvider.Save_LoginHistory(lgh);
            }
            FormsService.SignOut();
            GDS.Communication.GDSLogin.LogOut();
            UserEnvironmentVariables uenv = new UserEnvironmentVariables();

            uenv.SetLogOut();
            return(RedirectToAction("logon", "account"));
        }
Esempio n. 4
0
        public ActionResult LogOn(LogOnModel model, string returnUrl)
        {
            if (ModelState.IsValid)
            {
                Guid userId = new Guid();

                if ((generalProvider.ValidateUser(model.UserName, model.Password) == true) &&
                    (generalProvider.ValidateUnameAndPassword(model.UserName, model.Password, out userId)) == true)
                {
                    FormsService.SignIn(model.UserName, model.RememberMe);
                    UserEnvironmentVariables uenv = new UserEnvironmentVariables();
                    uenv.SetLogOn(userId, model.RememberMe);
                    TravelSession obj = SessionStore.GetTravelSession();

                    GDS.Communication.GDSLogin.Login(new GDS.Communication.AgentInfo()
                    {
                        AgentId = 1
                    });

                    MembershipUser user = Membership.GetUser(model.UserName);
                    if (returnUrl == "/")
                    {
                        returnUrl = "";
                    }
                    if (IsLocalUrl(returnUrl))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        switch (obj.UserTypeId)
                        {
                        case (int)ATLTravelPortal.Helpers.UserTypes.SuperUser:
                        case (int)ATLTravelPortal.Helpers.UserTypes.User:
                        case (int)ATLTravelPortal.Helpers.UserTypes.MEs:
                        case (int)ATLTravelPortal.Helpers.UserTypes.BackofficeUser:
                            return(RedirectToAction("Index", "Home"));

                        case (int)ATLTravelPortal.Helpers.UserTypes.BranchUser:
                            return(RedirectToAction("Index", "BranchOfficeDashboard", new { area = "" }));

                        case (int)ATLTravelPortal.Helpers.UserTypes.DistributorUser:
                            return(RedirectToAction("Index", "DistributorDashboard", new { area = "" }));

                        case (int)ATLTravelPortal.Helpers.UserTypes.CRMUser:
                            return(RedirectToAction("Index", "CRMDashboard", new { area = "" }));

                        default:
                            return(RedirectToAction("logon", "account"));
                        }
                    }
                }
                else
                {
                    ModelState.AddModelError("", "The user name or password provided is incorrect.");
                    ViewData["message"] = "Invalid username or password!";
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }