Exemple #1
0
        //================================================================================
        private void submitActionCallback(ScrapDto result, Exception exception)
        {
            this.fuelMainController.BeginInvokeOnDispatcher(() =>
            {
                this.HideBusyIndicator();

                if (exception == null)
                {
                    this.fuelMainController.Publish(new ScrapListChangedArg());

                    this.fuelMainController.ShowMessage(SUCCESSFUL_OPERATION_MESSAGE);

                    this.fuelMainController.Close(this);
                }
                else
                {
                    this.fuelMainController.HandleException(exception);
                }
            });
        }
Exemple #2
0
 //================================================================================
 public void Edit(ScrapDto scrapDto)
 {
     this.isInEditMode = true;
     initialize(scrapDto);
 }
Exemple #3
0
        //================================================================================
        private void initialize(ScrapDto scrapDto)
        {
            loadOwningCompanies();

            loadSecondPartyCompanies();

            this.Entity = scrapDto;
        }
        //================================================================================
        private void setEditProperties(Scrap scrap, ScrapDto scrapDto)
        {
            scrapDto.IsScrapEditPermitted = scrapDomainService.IsScrapEditPermitted(scrap);
            scrapDto.IsScrapDeletePermitted = scrapDomainService.IsScrapDeletePermitted(scrap);

            scrapDto.IsScrapAddDetailPermitted = scrapDomainService.IsScrapDetailAddPermitted(scrap);
            scrapDto.IsScrapEditDetailPermitted = scrapDomainService.IsScrapDetailEditPermitted(scrap);
            scrapDto.IsScrapDeleteDetailPermitted = scrapDomainService.IsScrapDetailDeletePermitted(scrap);

            scrapDto.IsGoodEditable = scrapDomainService.IsGoodEditable(scrap);
            scrapDto.IsTankEditable = scrapDomainService.IsTankEditable(scrap);
        }
        //================================================================================
        public void AddScrap(Action<ScrapDto, Exception> action, ScrapDto dto)
        {
            var url = string.Format(this.scrapAddressFormatString, string.Empty);

            WebClientHelper.Post(ApiServiceAddressHelper.BuildUri(url), action, dto, WebClientHelper.MessageFormat.Json,ApiConfig.Headers);
        }
        //================================================================================
        //private PageResultDto<FuelReportInventoryOperationDto> mapPageResult(PageResult<InventoryOperation> pageResult, GoodDto good)
        //{
        //    var result = new PageResultDto<FuelReportInventoryOperationDto>()
        //    {
        //        CurrentPage = pageResult.CurrentPage,
        //        PageSize = pageResult.PageSize,
        //        TotalCount = pageResult.TotalCount,
        //        TotalPages = pageResult.TotalPages,
        //        Result = inventoryOperationDtoMapper.MapToModel(pageResult.Result).ToList()
        //    };
        //    result.Result.ToList().ForEach(invDto => invDto.Good = good);
        //    return result;
        //}
        //================================================================================
        private PageResultDto<FuelReportInventoryOperationDto> mapPageResult(PageResult<InventoryOperation> pageResult, ScrapDto scrap)
        {
            var invOperationDtos = new List<FuelReportInventoryOperationDto>();

            foreach (var invOpr in pageResult.Result)
            {
                foreach (var detailDto in scrap.ScrapDetails)
                {
                    var invOprDto = inventoryOperationDtoMapper.MapToModel(invOpr);

                    invOprDto.Good = detailDto.Good;

                    invOperationDtos.Add(invOprDto);
                }
            }

            var result = new PageResultDto<FuelReportInventoryOperationDto>()
            {
                CurrentPage = pageResult.CurrentPage,
                PageSize = pageResult.PageSize,
                TotalCount = pageResult.TotalCount * scrap.ScrapDetails.Count,
                Result = invOperationDtos
            };

            return result;
        }
        //================================================================================
        public ScrapDto Update(ScrapDto dto)
        {
            var result = scrapApplicationService.UpdateScrap(dto.Id, dto.Vessel.Id, dto.SecondParty.Id, dto.ScrapDate);

            return scrapDtoMapper.MapToModel(result, this.setEditProperties);
        }
 public void EditScrapDetail(ScrapDto scrapDto, ScrapDetailDto scrapDetailDto)
 {
     var view = this.ViewManager.ShowInDialog<IScrapDetailView>();
     (view.ViewModel as ScrapDetailVM).Edit(scrapDto, scrapDetailDto);
 }
 public void Edit(ScrapDto scrapDto)
 {
     var view = this.ViewManager.ShowInDialog<IScrapView>();
     (view.ViewModel as ScrapVM).Edit(scrapDto);
 }
 public void AddScrapDetail(ScrapDto scrapDto)
 {
     var view = this.ViewManager.ShowInDialog<IScrapDetailView>();
     (view.ViewModel as ScrapDetailVM).Load(scrapDto);
 }