Ejemplo n.º 1
0
        //新添加分组
        private void newGroupButton_Click(object sender, EventArgs e)
        {
            string groupName = groupComboBox.Text.Trim();
            bool   isExist   = groupBll.isGroupByName(currUser.UId, groupName);

            if (isExist)
            {
                MessageBox.Show("分组已经存在");
                return;
            }
            else
            {
                if (groupName.Length <= 0 || groupComboBox.SelectedIndex == 0)
                {
                    return;
                }
                Group group = new Group();
                group.UId  = currUser.UId;
                group.Name = groupName;
                group.GId  = groupID;

                if (groupBll.addGroup(group))
                {
                    try
                    {
                        groupID = groupBll.getGroupID(group.UId, group.Name);
                    }
                    catch {
                        Console.WriteLine("GroupID Exception ");
                    }
                    MessageBox.Show("创建新分组成功");
                    groupComboBox.Text = groupName;
                }
                else
                {
                    MessageBox.Show("创建失败");
                }
            }
        }