Exemplo n.º 1
0
        public virtual void Login(bool Force, string IpAddress, string SessionId)
        {
            if (this.IsValidIp(IpAddress) == false)
            {
                throw new Exception("Permission denied from address " + IpAddress);
            }

            if (this.IsLoggedIn && this.SessionId != SessionId && Force == false)
            {
                this._isLoggedIn = false;
                throw new Exception("User is already logged in");
            }

            // login
            this._isLoggedIn = true;
            this._ipAddress  = IpAddress;
            this._sessionId  = SessionId;
            FI.DataAccess.Users dacObj = DataAccessFactory.Instance.GetUsersDA();
            dacObj.UpdateUserSession(this.ID, this.IPAddress, this.SessionId, this.IsLoggedIn);
        }
Exemplo n.º 2
0
        public virtual void Logout()
        {
            if (CheckSessionValidity())
            {
                FI.DataAccess.Users dacObj = DataAccessFactory.Instance.GetUsersDA();
                dacObj.UpdateUserSession(this.ID, this.IPAddress, this.SessionId, false);
            }

            // dispose
            this.Dispose();

            // logout
            this._isLoggedIn       = false;
            this._id               = 0;
            this._logon            = "";
            this._password         = "";
            this._name             = "";
            this._companyId        = 0;
            this._companyNameShort = "";
            this._companyNameLong  = "";
            this._oltpDatabase     = "";
        }