Esempio n. 1
0
 public ApiResult <List <Department> > addDept(Department department)
 {
     if (departmentDao.addDepartment(department) == 1)
     {
         apiResult.code    = 200;
         apiResult.message = "添加成功";
         apiResult.data    = departmentDao.getDept(null, 1, 10);
         apiResult.total   = departmentDao.getDept(null, 1, 1000000).Count;
     }
     else
     {
         apiResult.code    = 199;
         apiResult.message = "添加失败";
         apiResult.data    = null;
     }
     return(apiResult);
 }
Esempio n. 2
0
        private void childClose(object sender, EventArgs e)
        {
            DepartmentAddForm form = (DepartmentAddForm)sender;

            // 点击x关闭
            if (!(bool)form.Tag)
            {
                return;
            }
            Department d   = form.department;
            string     tag = (string)this.Tag;

            if (tag.Equals(tag_insert))
            {
                d.DepartmentId = dao.getLastId() + 1;
                dao.addDepartment(d);
            }
            else
            {
                dao.updateDepartment(d);
            }
            initData();
        }