protected void login(UcUserArgs args)
 {
     if (LoggedIn != null)
     {
         LoggedIn(this, args);
     }
 }
 protected void logout(UcUserArgs args)
 {
     if (LoggingOut != null)
     {
         LoggingOut(this, args);
     }
 }
        protected void ucLogin_LoggingOut(object sender, UcUserArgs e)
        {
            switch (e.UserRoleId)
            {
            case 3:     // Manager
                killCookies();
                break;

            default:
                break;
            }
        }
Exemple #4
0
        protected void Logout()
        {
            UcUserArgs args = new UcUserArgs();

            args.UserName   = "";
            args.Password   = "";
            args.UserId     = this.UcPage.UserId;
            args.UserRoleId = this.UcPage.UserRoleId;
            OnLoggingOut(args);

            FormsAuthentication.SignOut();

            UserPool userPool = (UserPool)Application["UserPool"];

            userPool.RemoveUser(Page.User.Identity.Name);
        }
        protected void ucLogin_LoggedIn(object sender, UcUserArgs e)
        {
            switch (e.UserRoleId)
            {
            case 3:     // Manager
                setCookies(e.UserName, e.Password);

                break;

            default:
                e.Cancel  = true;
                e.Message = "Invalid username/password";

                break;
            }
        }
        protected bool doLogin(String username, String password)
        {
            bool result = false;

            UserPool userPool = (UserPool)Application["UserPool"];

            if (userPool.RegisterUser(username, password))
            {
                ltMessage.Text = "";

                FormsAuthentication.SignOut();
                FormsAuthentication.SetAuthCookie(username, false);


                Int32 userId     = userPool.GetUserId(username);
                Int32 userRoleId = userPool.GetUserRoleId(username);


                //----------------------------------------
                UcUserArgs args = new UcUserArgs();
                args.UserName   = username;
                args.Password   = password;
                args.UserId     = userId;
                args.UserRoleId = userRoleId;
                login(args);
                //----------------------------------------

                if (!args.Cancel)
                {
                    result = true;
                }
                else
                {
                    result = false;
                    doLogout(args.Message);
                }
            }
            else
            {
            }

            return(result);
        }
        protected void doLogout(string message)
        {
            //----------------------------------------
            UcUserArgs args = new UcUserArgs();

            args.UserName   = "";
            args.Password   = "";
            args.UserId     = this.UcPage.UserId;
            args.UserRoleId = this.UcPage.UserRoleId;
            logout(args);
            //----------------------------------------


            FormsAuthentication.SignOut();

            UserPool userPool = (UserPool)Application["UserPool"];

            userPool.RemoveUser(ltUsername.Text);

            ltMessage.Text = message;
        }
        protected void ucLogOn_LoggingOut(object sender, UcUserArgs e)
        {
            switch (e.UserRoleId)
            {
            case 1:     // Admin
                break;

            case 2:     // Agent
                Int32     agentId   = ProxyHelper.GetUserAgentId(e.UserId);
                AgentPool agentPool = (AgentPool)Application["AgentPool"];
                agentPool.UnRegisterAgent(agentId);
                break;

            case 3:     // Manager
                break;

            case 5:     // Supervisor
                break;

            default:
                break;
            }
        }
Exemple #9
0
        private bool DoLogin(String username, String password)
        {
            UserPool userPool = (UserPool)Application["UserPool"];

            if (userPool.RegisterUser(username, password))
            {
                FormsAuthentication.SignOut();
                FormsAuthentication.SetAuthCookie(username, false);

                Int32 userId     = userPool.GetUserId(username);
                Int32 userRoleId = userPool.GetUserRoleId(username);

                UcUserArgs args = new UcUserArgs();
                args.UserName   = username;
                args.Password   = password;
                args.UserId     = userId;
                args.UserRoleId = userRoleId;
                login(args);

                return(true);
            }

            return(false);
        }