Esempio n. 1
0
        public virtual JsonResult SavePep(string operationNumber, PepTransactionDto records)
        {
            var response = new IDB.Architecture.Services.BaseResponse {
                IsValid = true
            };
            var result = new JsonResult();

            try
            {
                bool permission = IDBContext.Current.HasPermission(Permission.PEP_POA_WRITE);
                if (permission)
                {
                    if (records.IsUploadExcel)
                    {
                        _pepService.ObtainDiferencesInUpload(operationNumber, ref records);
                    }

                    response = _pepService.SaveInPep(operationNumber, IDBContext.Current.UserLoginName, records);
                    if (response.IsValid)
                    {
                        if (records.IsUploadExcel)
                        {
                            _pepService.DeleteUploadExcelFile(operationNumber);
                        }

                        _cacheData.Remove(_outputsPhysicalCacheName, System.Web.Caching.CacheItemRemovedReason.DependencyChanged);
                        _cacheData.Remove(_outputsFinancialCacheName, System.Web.Caching.CacheItemRemovedReason.DependencyChanged);

                        result.MaxJsonLength = int.MaxValue;
                        result = Json(response, JsonRequestBehavior.AllowGet);
                    }
                    else
                    {
                        result = Json(response, JsonRequestBehavior.AllowGet);
                    }

                    UnlockRegister(operationNumber, IDB.MW.Domain.Values.PepGlobalValues.ConcurrenceUrl);
                }
                else
                {
                    response.IsValid      = false;
                    response.ErrorMessage = Localization.GetText("PEP.Save.Not.Permissions");
                    result = Json(response, JsonRequestBehavior.AllowGet);
                }
            }
            catch (Exception e)
            {
                response.IsValid      = false;
                response.ErrorMessage = e.Message;
                result = Json(response, JsonRequestBehavior.AllowGet);
            }

            return(result);
        }
 public static void UpdatePepTaskViewModel(
     this PepTransactionDto viewModel)
 {
 }