示例#1
0
        }       //end OnPreRender

        #endregion

        #region Button Event Handlers
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                this.m_errorList.Add(BaseBusiness.ERR_MSG_VALIDATION_FAILED);
                return;
            }

            if (m_objDA.CheckLogin(this.txtLoginName.Text, this.txtPassword.Text))
            {
                DataRow dr = m_objDA.UserDataDT.Rows[0];
                //if (dr["UserStatus"].ToString().CompareTo("Y") == 0)
                //{
                SessionManager.UserTypeID = m_objDA.ConvertUserType(Convert.ToInt16(dr["UserTypeID"]));
                SessionManager.UserID     = Convert.ToInt32(dr["UserID"]);
                SessionManager.SchoolName = Convert.ToString(dr["SchoolName"]);

                //below is just for debug
                //string strMsg = string.Format("user {0} just logged in", this.txtLoginName.Text);
                //Utilities.JustInfoNotification(strMsg, base.m_bSendInfoEmails);

                //redirection
                switch (SessionManager.UserTypeID)
                {
                case Enumerations.UserTypes.Admin:
                    SessionManager.AdminView = true;
                    Response.Redirect("~/Portal/Admin/MainControl.aspx", true);
                    break;

                case Enumerations.UserTypes.Student:
                    SessionManager.AdminView = false;
                    Response.Redirect("~/Portal/Scheduling.aspx", true);
                    break;
                }       //end switch
                //}
                //else
                //{
                //    this.m_errorList.Add("User status is not active");
                //}
            }
            else
            {
                this.m_errorList.Add("Login incorrect");
            }
        }