protected void btn_Click(object sender, ImageClickEventArgs e) { EmpolyeeOR user; try { user = new EmpolyeeDA().sp_UserLogin(tbxUserCode.Text, tbxPassword.Text); } catch (Exception ex) { Alert(ex.Message.Replace("'", "").Replace("\r\n", "")); return; } Session["CurrentUser"] = user; HttpCookie cookieGuid = new HttpCookie("CurrentUser"); cookieGuid.Expires = DateTime.Now.AddHours(9); cookieGuid.Values.Add("UserID", user.EmpolyeeId); cookieGuid.Values.Add("LoginName", user.EmpolyeeCode); cookieGuid.Values.Add("UserName", user.EmpolyeeName); cookieGuid.Values.Add("Password", user.UserPwd); cookieGuid.Path = "/"; Response.AppendCookie(cookieGuid); ObservableCollection<VHC_USER_PERMISSIONS> _Permissions = new UserPermissionsDA().GetListByUserID(user.EmpolyeeId); if (_Permissions.Count == 0) { Alert("未授权,无法访问该系统。"); return; } Session["UserPermissions"] = _Permissions; Response.Redirect("~/Main/Default.aspx"); }
private void LoadData() { try { EmpolyeeOR m_Base = new EmpolyeeDA().selectARowDateByGuid(Request.QueryString["id"]); txtEmpolyeeCode.Text = m_Base.EmpolyeeCode;//员工编号 txtEmpolyeeRfid.Text = m_Base.EmpolyeeRfid;//员工RFID txtEmpolyeeName.Text = m_Base.EmpolyeeName;//员工名称 txtEmpolyeePy.Text = m_Base.EmpolyeePy;//员工拼音缩写 dpdEmpolyeeSex.Text = m_Base.EmpolyeeSex;//员工性别 txtEmpolyeeBirth.Text = m_Base.EmpolyeeBirth.HasValue ? m_Base.EmpolyeeBirth.Value.ToString("yyyy-MM-dd") : "";//员工出生日期 txtEmpolyeeEntryDate.Text = m_Base.EmpolyeeEntryDate.HasValue ? m_Base.EmpolyeeEntryDate.Value.ToString("yyyy-MM-dd") : "";//员工入职日期 txtEmpolyeePhone.Text = m_Base.EmpolyeePhone;//员工手机号 txtEmpolyeeEmail.Text = m_Base.EmpolyeeEmail;//员工电子邮箱 txtEmpolyeeAddress.Text = m_Base.EmpolyeeAddress;//员工联系地址 txtEmpolyeeHometown.Text = m_Base.EmpolyeeHometown;//员工籍贯 txtEmpolyeeCardId.Text = m_Base.EmpolyeeCardId;//员工身份证号 txtUserId.Text = m_Base.UserId;//用户ID txtUserPwd.Text = m_Base.UserPwd;//用户密码 } catch (Exception e) { Alert(e); } }
private void InitUserInfo() { if (Request.QueryString["userid"] != null) { EmpolyeeOR obj = new EmpolyeeDA().selectARowDateByGuid(Request.QueryString["userid"]); if (obj != null) { this.txt_ShowName.Text = obj.EmpolyeeName; this.txt_LoginCode.Text = obj.EmpolyeeCode; } } }