Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         if (Session["User"] == null)
         {
             ibooksLocked.Attributes.Add("class", "locked");
             level1Locked.Attributes.Add("class", "locked");
             booksLocked.Attributes.Add("class", "locked");
             storiesLocked.Attributes.Add("class", "locked");
             worksheetsLocked.Attributes.Add("class", "locked");
             teacherLocked.Attributes.Add("class", "locked");
             controlPanel.Visible = false;
             BtnLogOut.Visible    = false;
             lblFullName.Visible  = false;
             btnLogin.Visible     = true;
             hdnUserType.Value    = "";
         }
         else
         {
             BtnLogOut.Visible   = true;
             lblFullName.Visible = true;
             loginBtn.Visible    = false;
             DA.Users.User oUser = Session["User"] as DA.Users.User;
             lblFullName.Text  = oUser.FullName + " أهلا ";
             hdnUserType.Value = oUser.UserType;
             ShowHideLock(oUser.UserType);
         }
     }
 }
Exemplo n.º 2
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            DataTable dtUser = DA.Users.Login(txtUserName.Text.Trim(), txtPassword.Text);

            if (dtUser.Rows.Count == 1)
            {
                DA.Users.User oUser = new DA.Users.User();
                oUser.UserID      = Convert.ToInt32(dtUser.Rows[0]["UserID"].ToString());
                oUser.UserName    = dtUser.Rows[0]["UserName"].ToString();
                oUser.UserEmail   = dtUser.Rows[0]["UserEmail"].ToString();
                oUser.UserType    = dtUser.Rows[0]["Type"].ToString();
                oUser.FullName    = dtUser.Rows[0]["FullName"].ToString();
                Session["User"]   = oUser;
                hdnUserType.Value = oUser.UserType;
                ShowHideLock(oUser.UserType);
                lblFullName.Text    = oUser.FullName + " أهلا ";
                BtnLogOut.Visible   = true;
                lblFullName.Visible = true;
                loginBtn.Visible    = false;
            }
        }