public OtherExpense SoftDeleteObject(OtherExpense otherExpense, ISalaryItemService _salaryItemService)
 {
     if (_validator.ValidDeleteObject(otherExpense))
     {
         SalaryItem salaryItem = _salaryItemService.GetObjectById(otherExpense.SalaryItemId.GetValueOrDefault());
         _repository.SoftDeleteObject(otherExpense);
         if (salaryItem != null)
         {
             _salaryItemService.SoftDeleteObject(salaryItem);
         }
     }
     return(otherExpense);
 }
Beispiel #2
0
 public SalarySlip SoftDeleteObject(SalarySlip salarySlip, ISalaryItemService _salaryItemService)
 {
     if (_validator.ValidDeleteObject(salarySlip))
     {
         SalaryItem salaryItem = _salaryItemService.GetObjectById(salarySlip.SalaryItemId.GetValueOrDefault());
         _repository.SoftDeleteObject(salarySlip);
         if (salaryItem != null)
         {
             _salaryItemService.SoftDeleteObject(salaryItem);
         }
     }
     return(salarySlip);
 }
Beispiel #3
0
 public THR SoftDeleteObject(THR thr, ISalaryItemService _salaryItemService)
 {
     if (_validator.ValidDeleteObject(thr))
     {
         SalaryItem salaryItem = _salaryItemService.GetObjectById(thr.SalaryItemId.GetValueOrDefault());
         _repository.SoftDeleteObject(thr);
         if (salaryItem != null)
         {
             _salaryItemService.SoftDeleteObject(salaryItem);
         }
     }
     return(thr);
 }
        public dynamic Delete(SalaryItem model)
        {
            try
            {
                if (!AuthenticationModel.IsAllowed("Delete", Core.Constants.Constant.MenuName.SalaryItems, Core.Constants.Constant.MenuGroupName.Setting))
                {
                    Dictionary <string, string> Errors = new Dictionary <string, string>();
                    Errors.Add("Generic", "You are Not Allowed to Delete Record");

                    return(Json(new
                    {
                        Errors
                    }, JsonRequestBehavior.AllowGet));
                }

                var data = _salaryItemService.GetObjectById(model.Id);
                model = _salaryItemService.SoftDeleteObject(data);
            }

            catch (Exception ex)
            {
                LOG.Error("Delete Failed", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Errors
            }));
        }