コード例 #1
0
        protected void btnLogIn_Click(object sender, EventArgs e)
        {
            UsersClass user = new UsersClass();


            if (Session["USER_ACCOUNT"] != null)
            {
                Redirector.Redirect("~/Accounting/DashBoardPanel.aspx");
            }
            else
            {
                lblErrorMessage.Text = string.Empty;

                user = UM.CheckUserAccount(txtUsername.Text, txtPassword.Text);

                if (user == null)
                {
                    pnlError.Visible     = true;
                    lblErrorMessage.Text = "ERROR : USER ACCOUNT DOESN'T EXIST!";
                    return;
                }

                if (user.IsOnline == true)
                {
                    UM.UpdateOnlineStatus(user.ID, false);
                    //pnlError.Visible = true;
                    //lblErrorMessage.Text = "WARNING : USER ACCOUNT ALREADY ONLINE!";
                    //return;
                }
                Session["USER_ACCOUNT"] = user;
                Session["USER_ID"]      = user.ID;
                Session["USER_NAME"]    = user.Username;
                UM.UpdateOnlineStatus(user.ID, true);
                Session.Timeout       = 30;
                Session["USER_ROLES"] = UserRoleManager.GetUserRolesByUserId((int)user.ID);

                #region init log action
                UM.SaveTransactionLog(user, TransactionType.LOGIN);
                #endregion
                Redirector.Redirect("~/Accounting/DashBoardPanel.aspx");
            }
            //Session["CURRENT_DATE"] = DateTime.Now;
            //Session["NET_SESSION_ID"] = Session.SessionID;
            //Session["CLASSIC_SESSION_ID"] = "";
            //Session["SHOW_CLASSIC_WINDOW"] = "FALSE";

            //SendToBridge(ref user);
        }