public SlipGajiDetail2A VHasSlipGajiDetail(SlipGajiDetail2A slipGajiDetail2A, ISlipGajiDetailService _slipGajiDetailService)
        {
            SlipGajiDetail slipGajiDetail = _slipGajiDetailService.GetObjectById(slipGajiDetail2A.SlipGajiDetailId);

            if (slipGajiDetail == null)
            {
                slipGajiDetail2A.Errors.Add("Generic", "SlipGajiDetail Tidak valid");
            }
            return(slipGajiDetail2A);
        }
        public string PrintError(SlipGajiDetail2A 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);
        }
 public SlipGajiDetail2A CreateOrUpdateObject(SlipGajiDetail2A slipGajiDetail2A, ISlipGajiDetailService _slipGajiDetailService)
 {
     slipGajiDetail2A.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(slipGajiDetail2A, _slipGajiDetailService))
     {
         //SlipGajiDetail2A slipGajiDetail2A2 = GetObjectByEmployeeMonth(slipGajiDetail.EmployeeId, slipGajiDetail.MONTH);
         if (slipGajiDetail2A.Id > 0)
         {
             _repository.UpdateObject(slipGajiDetail2A);
         }
         else
         {
             _repository.CreateObject(slipGajiDetail2A);
         }
     }
     return(slipGajiDetail2A);
 }
 public SlipGajiDetail2A UpdateObject(SlipGajiDetail2A slipGajiDetail2A, ISlipGajiDetailService _slipGajiDetailService)
 {
     return(slipGajiDetail2A = _validator.ValidUpdateObject(slipGajiDetail2A, _slipGajiDetailService) ? _repository.UpdateObject(slipGajiDetail2A) : slipGajiDetail2A);
 }
 public SlipGajiDetail2A CreateObject(SlipGajiDetail2A slipGajiDetail2A, ISlipGajiDetailService _slipGajiDetailService)
 {
     slipGajiDetail2A.Errors = new Dictionary <String, String>();
     return(_validator.ValidCreateObject(slipGajiDetail2A, _slipGajiDetailService) ? _repository.CreateObject(slipGajiDetail2A) : slipGajiDetail2A);
 }
        public bool isValid(SlipGajiDetail2A obj)
        {
            bool isValid = !obj.Errors.Any();

            return(isValid);
        }
 public bool ValidDeleteObject(SlipGajiDetail2A slipGajiDetail2A)
 {
     slipGajiDetail2A.Errors.Clear();
     return(isValid(slipGajiDetail2A));
 }
 public bool ValidUpdateObject(SlipGajiDetail2A slipGajiDetail2A, ISlipGajiDetailService _slipGajiDetailService)
 {
     slipGajiDetail2A.Errors.Clear();
     ValidCreateObject(slipGajiDetail2A, _slipGajiDetailService);
     return(isValid(slipGajiDetail2A));
 }
 public bool ValidCreateObject(SlipGajiDetail2A slipGajiDetail2A, ISlipGajiDetailService _slipGajiDetailService)
 {
     VHasSlipGajiDetail(slipGajiDetail2A, _slipGajiDetailService);
     return(isValid(slipGajiDetail2A));
 }