/// <summary> /// /// </summary> /// <param name="departmentId"></param> /// <param name="name"></param> /// <param name="description"></param> public void CreateDepartment(Guid departmentId, String name, String description) { try { Department department = new Department(); department.Department_Id = departmentId; department.Department_Name = name; department.Department_Description = description; department.Department_IsDelete = false; int result = DD.CreateDepartment(department); if (result == -1) { throw new Exception("An error occurred while executing this operation."); } } catch (Exception ex) { throw new Exception(ex.Message); } }
/// <summary> /// Delete a department. /// </summary> /// <param name="department">Department that you want to delete.</param> /// <returns>Return the number of rows affected or return -1 if occur exception.</returns> public int DeleteDepartment(Department department) { return DBHelper.Instance.Delete("Department", String.Format("Department_Id = '{0}'", department.Department_Id.ToString())); }
/// <summary> /// Create new a department. /// </summary> /// <param name="isDelete">True if department is removed, false otherwise.</param> /// <param name="department">Department that you want to create.</param> /// <returns>Return the number of rows affected or return -1 if occur exception.</returns> public int CreateDepartment(Department department) { return DBHelper.Instance.Insert(department); }