public bool AddDepartment(Department department) //增加部门 { bool judge = false; if (dDAO.SelectDepartment(department.DepartmentNumber) == null) //如果数据库中没有有该部门 { dDAO.AddDepartment(department); judge = true; } else //数据库内存在该公司 { judge = false; } return(judge); }
private void buttonAdd_Click(object sender, EventArgs e) { if (!CheckData()) { return; } DataRow[] matches = tabData.Select("Name='" + name + "'"); if (matches.Length > 0) { MessageBox.Show("该部门已经存在", "信息提示", MessageBoxButtons.OK); return; } int parentId = 0; if (comboBoxEditParent.SelectedItem != null) { matches = tabData.Select("Name='" + comboBoxEditParent.Text + "'"); if (matches.Length == 0) { return; } parentId = (int)matches[0]["Id"]; } DepartmentBean b = new DepartmentBean(); b.Name = name; b.ParentId = parentId; b.Code = code; DepartmentDAO dao = new DepartmentDAO(); dao.AddDepartment(b); LoadData(); }
public static void AddDepartment(DEPARTMENT department) { DepartmentDAO.AddDepartment(department); }
public bool AddDept(Department dept) { return(DepartmentDAO.AddDepartment(dept)); }
public static void AddDepartment(Department department) { DepartmentDAO.AddDepartment(department); }