Ejemplo n.º 1
0
 public static Department MapFromDTO(DepartmentDTO dto)
 {
     Department Department = new Department();
     Department.DepartmentID = dto.DepartmentID;
     Department.DepartmentName = dto.DepartmentName;
     Department.ParentDepartment = dto.ParentDepartmentId == null ? null : ManagerFactory.DepartmentManager.GetDepartment(dto.ParentDepartmentId);
     return Department;
 }
Ejemplo n.º 2
0
 public Department SaveDepartment(Department Department)
 {
     Department Depart = GetDepartment(Department.DepartmentID);
     if (Depart != null)
     {
         throw new Exception("该部门号的部门已存在,请重新指定部门号。");
     }
     return DepartmentDao.Save(Department);
 }
Ejemplo n.º 3
0
 public static DepartmentDTO MapToDTO(Department model)
 {
     DepartmentDTO  dto = new DepartmentDTO();
     dto.DepartmentID = model.DepartmentID;
     dto.DepartmentName = model.DepartmentName;
     dto.ParentDepartmentId = model.ParentDepartment ==null?null:model.ParentDepartment.DepartmentID;
     dto.ParentDepartmentName = model.ParentDepartment==null?null:model.ParentDepartment.DepartmentName;
     return dto;
 }
Ejemplo n.º 4
0
 public IList GetByCondition(Department depart)
 {
     ArrayList param = new ArrayList();
     string queryStr = "from Department t where 1=1";
     if (depart.DepartmentID != "")
     {
         queryStr += " and t.DepartmentID=?";
         param.Add(depart.DepartmentID);
     }
     if (depart.DepartmentName != "")
     {
         queryStr += " and t.DepartmentName like ?";
         param.Add("%" + depart.DepartmentName + "%");
     }
     if (depart.ParentDepartment != null)
     {
         queryStr += " and t.ParentDepartment=?";
         param.Add(depart.ParentDepartment.DepartmentID);
     }
     return HibernateTemplate.Find(queryStr, param.ToArray());
 }
Ejemplo n.º 5
0
 public Department UpdateDepartment(Department Department)
 {
     return DepartmentDao.SaveOrUpdate(Department);
 }
Ejemplo n.º 6
0
 public IList GetByCondition(Department dept)
 {
     return DepartmentDao.GetByCondition(dept);
 }
Ejemplo n.º 7
0
 public Department SaveOrUpdate(Department department)
 {
     HibernateTemplate.SaveOrUpdate(department);
     return department;
 }
Ejemplo n.º 8
0
 public void Delete(Department department)
 {
     HibernateTemplate.Delete(department);
 }