private void TsmShowGroupVcard_Click(object sender, EventArgs e) { TreeNode node = treeView_Organization.SelectedNode; if (node != null) { exGroup group = node.Tag as exGroup; FormGroupVcard frm = getGroupVcardForm(group.GroupID); if (frm == null) { frm = new FormGroupVcard(); frmGroupVcards.Add(group.GroupID, frm); if (MyAuth.isAdmin)//如果是管理员,则添加更新事件 frm.UpdateVcard += delegate(object sender1, GroupVcard card) { UpdateGroup(card);//更新分组资料 }; else frm.RefreshVcard += delegate(object sender1, GroupVcard card) { //向服务器请求获得分组最新资料 //card.type = type.get; //SendMessageToServer(card); }; frm.FormClosed += delegate(object sender1, FormClosedEventArgs e1) { frm.Dispose(); frmGroupVcards.Remove(group.GroupID); }; GroupVcard vcard = new GroupVcard(); vcard.GroupID = group.GroupID; vcard.GroupName = group.GroupName; vcard.SuperiorID = group.SuperiorID; vcard.OrderID = group.OrderID; frm.GroupVcard = vcard; } if (MyAuth.isAdmin)//如果是管理员 frm.Text = "修改 " + group.GroupName + "(" + group.GroupID + ")的资料"; else frm.Text = "查看 " + group.GroupName + "(" + group.GroupID + ")的资料"; frm.isAdmin = MyAuth.isAdmin; frm.IsCreate = false; frm.Show(); } }
private void TsmCreateGroup_Click(object sender, EventArgs e) { if (!MyAuth.isAdmin) { IMLibrary3.Global.MsgShow("对不起,目前您没有此项管理权限!"); return; } if (frmGroupVcard == null || frmGroupVcard.IsDisposed) { frmGroupVcard = new FormGroupVcard(); frmGroupVcard.Create += delegate(object sender1, GroupVcard groupVcard) { CreateGroup(groupVcard); }; } frmGroupVcard.IsCreate = true;//操作为创建 frmGroupVcard.Show(); }