Ejemplo n.º 1
0
        public string SaveDepartment(Department aDepartment)
        {
            if (aDepartment.Code.Length > 3)
            {
                bool isDepartmentCodeExist = CheckDepartmentCode(aDepartment);

                if (isDepartmentCodeExist)
                {
                    return("This Code number is already exist! Please use another Code number");
                }
                else
                {
                    var rowAffected = gateway.AddDepartment(aDepartment);

                    if (rowAffected > 0)
                    {
                        return("Saved Successfully!");
                    }
                    else
                    {
                        return("Save Failed!");
                    }
                }
            }
            else
            {
                return("Invalid Department Code! it must be at least 4 characters.");
            }
        }
Ejemplo n.º 2
0
 public string AddDepartment(Department aDepartment)
 {
     if (aDepartmentGateway.SearchDepartment(aDepartment))
     {
         return("Duplicate Department");
     }
     aDepartmentGateway.AddDepartment(aDepartment);
     return("Insert Succesfull");
 }
Ejemplo n.º 3
0
 public bool AddDepartment(Department department)
 {
     return(_departmentGateway.AddDepartment(department));
 }