private void InitUser() { alertForm = new Dialog_PendingAlert(this); if (SessionClass.CurrentSinoUser != null) { this.PendingAlertLib.Clear(); this.repositoryItemComboBox1.Items.Clear(); this.barCurrentUser.EditValue = SessionClass.CurrentSinoUser.UserName; int _selectpost = 0; foreach (SinoPost _sp in SessionClass.CurrentSinoUser.Posts) { PostListItem _pItem = new PostListItem(_sp); int _index = this.repositoryItemComboBox1.Items.Add(_pItem); if (_sp.PostID == SessionClass.CurrentSinoUser.CurrentPost.PostID) { _selectpost = _index; } } this.barCurrentPost.EditValue = new PostListItem(SessionClass.CurrentSinoUser.CurrentPost); RemotingUserCTX.SetCurUser(SessionClass.CurrentSinoUser); if (SessionClass.CurrentSinoUser.CurrentPost != null) { this.barCurrentOrg.EditValue = SessionClass.CurrentSinoUser.CurrentPost.PostDWMC; } this.timer_PandingAlert.Enabled = true; //是否启动待办提示小图标 } }
private void barCurrentPost_EditValueChanged(object sender, EventArgs e) { PostListItem _pItem = this.barCurrentPost.EditValue as PostListItem; SinoPost _selectPost = _pItem.Post; RemotingUserCTX.SetCurUser(SessionClass.CurrentSinoUser); SessionClass.CurrentSinoUser.CurrentPost = _selectPost; this.barCurrentOrg.EditValue = _selectPost.PostDWMC; InitMenu(); }
// 获得一个AppServer服务器提供的远程对象 // 入口参数: // Type interfaceType 接口类型 public static object GetAppSvrObj(Type interfaceType) { // 目前发现有时候如果服务器端抛出异常,客户端截获后, 当前线程的CallContext会丢失 // 由于目前目前程序是将用户当前身份放在CallContext中的, 所以导致问题 // 因此,在下面的代码中添加一行,每次GetAppSvrObj的时候强制将当前用户身份设置到CallContext中 // 此方案要求每次用户调用remoteObj之前都必须调用GetAppSvrObj,而不能GetAppSvrObj之后长期使用 RemotingUserCTX.SetCurUser(SessionClass.CurrentSinoUser); if (ConfigFile.ICS_Channel == Config_IcsChannel.Tcp) { return(RemotingUtils.GetObject(interfaceType, ConfigFile.ICS_UriPrefix_TCP)); } else { return(RemotingUtils.GetObject(interfaceType, ConfigFile.ICS_UriPrefix_HTTP)); } }