private void OnChangeRoleID() { try { LoginView2 logView2 = new LoginView2(); if (DialogResult.OK == logView2.ShowDialog()) { string tempUserName = ""; int tempRoleID = logView2.GetLoginRole(ref tempUserName); if (tempRoleID < 1) { return; } this.roleID = tempRoleID; this.userName = tempUserName; this.labelUser.Text = "当前用户:" + this.userName; foreach (BaseChildView childView in childViews) { childView.ChangeRoleID(this.roleID); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void 切换用户ToolStripMenuItem_Click(object sender, EventArgs e) { try { LoginView2 logView2 = new LoginView2(); if (DialogResult.OK == logView2.ShowDialog()) { string tempUserName = ""; int tempRoleID = logView2.GetLoginRole(ref tempUserName); if (tempRoleID < 1) { return; } this.roleID = tempRoleID; this.userName = tempUserName; this.labelUser.Text = "当前用户:" + this.userName; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }