public bool AddDepartment(Department department)       //增加部门
        {
            bool judge = false;

            if (dDAO.SelectDepartment(department.DepartmentNumber) == null)      //如果数据库中没有有该部门
            {
                dDAO.AddDepartment(department);
                judge = true;
            }
            else       //数据库内存在该公司
            {
                judge = false;
            }
            return(judge);
        }
示例#2
0
        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);
 }
示例#4
0
 public bool AddDept(Department dept)
 {
     return(DepartmentDAO.AddDepartment(dept));
 }
示例#5
0
 public static void AddDepartment(Department department)
 {
     DepartmentDAO.AddDepartment(department);
 }