Ejemplo n.º 1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                string user = userName.Text;
                string pwd = password.Text;
                string guid = new BLL.User().Login(user, pwd);
                if (string.IsNullOrEmpty(guid))
                {
                    ShowMsg("用户名或密码不正确。");
                }
                else
                {
                    string url = string.Format("MainFrame/Default.aspx?guid={0}", guid);
                    Response.Redirect(url, false);
                }
            }
            catch (Exception ex)
            {
                Log(ex);
            }

        }
Ejemplo n.º 2
0
 private void BindList()
 {
     IList<UserInfo> list = new User().GetList(false, true);
     gvUserList.DataSource = list;
     gvUserList.DataBind();
 }
Ejemplo n.º 3
0
        protected void rbSel_CheckedChanged(object sender, EventArgs e)
        {
            try
            {
                string id = lbID.Value;
                if (string.IsNullOrEmpty(id) == true)
                {
                    return;
                }
                divUser.Visible = true;
                UserInfo uInfo = new User().GetByID(id);
                tbName.Text = uInfo.Name;
                ddlDepartment.SelectedValue = uInfo.DepartmentID;

                BindRoles();
                IList<RoleInfo> rList = new Role().GetListByUserID(id);
                foreach (RoleInfo rInfo in rList)
                {
                    string roleID = rInfo.ID;
                    cblRoles.Items.FindByValue(roleID).Selected = true;
                }
            }
            catch (ArgumentNullException aex)
            {
                ShowMsg(aex.Message);
            }
            catch (Exception ex)
            {
                ShowMsg(ex.Message);
                Log(ex);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 处理用户未登录,判断当前页是否需要跳转到登录页
 /// </summary>
 /// <returns>True:跳转到登陆页;False:用户已经登录或者无需登录</returns>
 private bool NeedToLogin()
 {
     // 用户是否登录过
     if (string.IsNullOrEmpty(this.UserCacheInfo.GUID))
     {
         // 若用户在默认栏目无权限要求,则不跳转
         if (this.MenuID == DEFAULT_MENUID)
         {
             return false;
         }
         string guid = GetRequest("guid");
         if (string.IsNullOrEmpty(guid))
         {
             // 要求权限并且无凭据
             return true;
         }
         else
         {
             // 要求权限,则通过凭据获取用户信息
             UserInfo uInfo = new BLL.User().GetUserInfoByGuid(guid);
             this.UserCacheInfo = uInfo;
             return false;
         }
     }
     return false;
 }