protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (IsLoginUser) { //链接为模拟用户页面 lbtnLogin.Visible = true; } string localName = HttpContext.Current.User.Identity.Name.ToLower(); lblUserInfo.Text = localName; string to = new SwitchUser().IsExist(fromUserCode); if (!string.IsNullOrEmpty(to)) { lblUserInfo.Text = "founder\\" + to; lblUserInfo.ForeColor = Color.Red; lbtnLogout.Visible = true; } to = new LoginUser().IsExist(fromUserCode); if (!string.IsNullOrEmpty(to)) { lblUserInfo.Text = localName + "模拟了" + to; lblUserInfo.ForeColor = Color.Red; } //映射用户 if (IsMappingUser) { Pkurg.PWorldBPM.Business.Sys.SYS_MappingUser model = ClassMappingUser.GetState(localName); if (model == null) { lbtnMapping.Visible = false; lbtnCancelMapping.Visible = false; } else if (model.State == 0) { lbtnMapping.Visible = true; lbtnCancelMapping.Visible = false; } else if (model.State == 1) { lblUserInfo.Text = localName + "映射了" + model.ToUserCode; lblUserInfo.ForeColor = Color.Red; lbtnMapping.Visible = false; lbtnCancelMapping.Visible = true; } } } }
void DoMapping() { string currentUserCode = HttpContext.Current.User.Identity.Name.ToLower().Replace("founder\\", ""); Pkurg.PWorldBPM.Business.Sys.SYS_MappingUser mapping = ClassMappingUser.UpdateState(currentUserCode, 1); if (mapping != null) { string toUserCode = mapping.ToUserCode; Pkurg.PWorldBPM.Common.Services.OrgService services = new Pkurg.PWorldBPM.Common.Services.OrgService(); Pkurg.PWorldBPM.Common.Info.UserInfo model = services.GetUserInfo(toUserCode); if (model != null) { _BPMContext.LoginId = toUserCode; } } Response.Redirect("~/Default.aspx"); }