public void addGroup() { login(); GroupInfo info = new GroupInfo(); info.description = "group"; info.groupName = "testgroup"; info.inputTime = DateTime.Today; //info.osType = "test"; DataLayerResult result = dataLayer.AddGroup(info); Assert.AreEqual(result, DataLayerResult.Success); logou(); }
private void button1_Click(object sender, EventArgs e) { //名称 if (textBox1.Text.Trim().Equals("")) { MessageBox.Show("名称不可以为空!"); return; } //操作系统 int osid = -1; if (comboBox1.SelectedIndex >= 0) { foreach (SysguardWS.OsTypeInfo info in osTypeInfo.Values) { if (info.osName.Equals(comboBox1.SelectedItem.ToString())) { osid = info.osId; break; } } if (osid < 0) { MessageBox.Show("未找到操作系统!"); return; } } else { MessageBox.Show("请选择操作系统!"); return; } sysguard.SysguardWS.GroupInfo group = new sysguard.SysguardWS.GroupInfo(); group.description = this.textBox2.Text; group.groupName = this.textBox1.Text; group.inputTime = DateTime.Today; group.osId = osid; DataLayerResult result = dataLayer.AddGroup(group); if (result == DataLayerResult.Success) { DialogResult resultDialo = MessageBox.Show("群组添加成功,是否退出?", "添加成功!", MessageBoxButtons.YesNo); if (resultDialo == DialogResult.Yes) { this.DialogResult = DialogResult.OK; this.Dispose(); } else { reset(); groupControl.Flush(); } } else if (result == DataLayerResult.GroupNameAlreadyExist) { MessageBox.Show("群组名已经存在无法添加!", "添加群组失败", MessageBoxButtons.OK); this.textBox1.Text = string.Empty; this.textBox1.Focus(); } }