Ejemplo n.º 1
0
 public bool ValidCreateObject(PensionCompensation pensionCompensation, IEmployeeService _employeeService)
 {
     VHasEmployee(pensionCompensation, _employeeService);
     if (!isValid(pensionCompensation))
     {
         return(false);
     }
     VHasPensionDate(pensionCompensation);
     if (!isValid(pensionCompensation))
     {
         return(false);
     }
     VIsValidPensionValue(pensionCompensation);
     if (!isValid(pensionCompensation))
     {
         return(false);
     }
     VIsValidPensionMultiply(pensionCompensation);
     if (!isValid(pensionCompensation))
     {
         return(false);
     }
     VIsValidMedAndHousing(pensionCompensation);
     return(isValid(pensionCompensation));
 }
Ejemplo n.º 2
0
 public PensionCompensation VIsValidMedAndHousing(PensionCompensation pensionCompensation)
 {
     if (pensionCompensation.MedAndHousing < 0)
     {
         pensionCompensation.Errors.Add("MedAndHousing", "Harus lebih besar atau sama dengan 0");
     }
     return(pensionCompensation);
 }
Ejemplo n.º 3
0
 public PensionCompensation VIsValidPensionMultiply(PensionCompensation pensionCompensation)
 {
     if (pensionCompensation.PensionMultiply < 0)
     {
         pensionCompensation.Errors.Add("PensionMultiply", "Harus lebih besar atau sama dengan 0");
     }
     return(pensionCompensation);
 }
Ejemplo n.º 4
0
 public PensionCompensation VHasPensionDate(PensionCompensation pensionCompensation)
 {
     if (pensionCompensation.PensionDate == null || pensionCompensation.PensionDate.Equals(DateTime.FromBinary(0)))
     {
         pensionCompensation.Errors.Add("PensionDate", "Tidak valid");
     }
     return(pensionCompensation);
 }
Ejemplo n.º 5
0
        public PensionCompensation VHasEmployee(PensionCompensation pensionCompensation, IEmployeeService _employeeService)
        {
            Employee employee = _employeeService.GetObjectById(pensionCompensation.EmployeeId);

            if (employee == null)
            {
                pensionCompensation.Errors.Add("Employee", "Tidak ada");
            }
            return(pensionCompensation);
        }
Ejemplo n.º 6
0
        public string PrintError(PensionCompensation obj)
        {
            string erroroutput = "";
            KeyValuePair <string, string> first = obj.Errors.ElementAt(0);

            erroroutput += first.Key + "," + first.Value;
            foreach (KeyValuePair <string, string> pair in obj.Errors.Skip(1))
            {
                erroroutput += Environment.NewLine;
                erroroutput += pair.Key + "," + pair.Value;
            }
            return(erroroutput);
        }
Ejemplo n.º 7
0
 public PensionCompensation SoftDeleteObject(PensionCompensation pensionCompensation)
 {
     return(pensionCompensation = _validator.ValidDeleteObject(pensionCompensation) ?
                                  _repository.SoftDeleteObject(pensionCompensation) : pensionCompensation);
 }
Ejemplo n.º 8
0
 public PensionCompensation UpdateObject(PensionCompensation pensionCompensation, IEmployeeService _employeeService)
 {
     return(pensionCompensation = _validator.ValidUpdateObject(pensionCompensation, _employeeService) ? _repository.UpdateObject(pensionCompensation) : pensionCompensation);
 }
Ejemplo n.º 9
0
 public PensionCompensation CreateObject(PensionCompensation pensionCompensation, IEmployeeService _employeeService)
 {
     pensionCompensation.Errors = new Dictionary <String, String>();
     return(_validator.ValidCreateObject(pensionCompensation, _employeeService) ? _repository.CreateObject(pensionCompensation) : pensionCompensation);
 }
Ejemplo n.º 10
0
        public bool isValid(PensionCompensation obj)
        {
            bool isValid = !obj.Errors.Any();

            return(isValid);
        }
Ejemplo n.º 11
0
 public bool ValidDeleteObject(PensionCompensation pensionCompensation)
 {
     pensionCompensation.Errors.Clear();
     return(isValid(pensionCompensation));
 }
Ejemplo n.º 12
0
 public bool ValidUpdateObject(PensionCompensation pensionCompensation, IEmployeeService _employeeService)
 {
     pensionCompensation.Errors.Clear();
     ValidCreateObject(pensionCompensation, _employeeService);
     return(isValid(pensionCompensation));
 }