Пример #1
0
        // GET api/charter/5
        public CharterDto GetById(CharterType charterType, CharterStateTypeEnum charterStateTypeEnum, long id)
        {
            var res = new CharterDto();
            if (charterType == CharterType.In)
            {
                if (charterStateTypeEnum == CharterStateTypeEnum.Start)
                {
                    res = this._charterInFacadeService.GetById(id);
                }
                else
                {
                    res = this._charterInFacadeService.GetCharterEnd(id);
                }

            }
            else
            {
                if (charterStateTypeEnum == CharterStateTypeEnum.Start)
                {
                    res = this._charterOutFacadeService.GetById(id);
                }
                else
                {
                    res = this._charterOutFacadeService.GetCharterEnd(id);
                }
            }

            return res;
        }
Пример #2
0
        public CharterIn CreateCharterIn(long id, long chartererId, long ownerId, long vesselInCompanyId, long currencyId,
                            DateTime actionDate,
                            List<CharterItem> charterItems,
                            List<InventoryOperation> inventoryOperationItems
                           , CharterType charterType, CharterEndType charterEndType, OffHirePricingType offHirePricingType)
        {
            var charterIn = new CharterIn(id, chartererId, ownerId, vesselInCompanyId,
                               currencyId, actionDate,
                               charterItems, inventoryOperationItems
                              , charterType, charterEndType, offHirePricingType,
                              _charterInDomainService, _charterOutDomainService,
                              _eventPublisher);

            var init = this._workflowRepository.Single(c => c.WorkflowEntity == WorkflowEntities.CharterIn && c.CurrentWorkflowStage == WorkflowStages.Initial);
            if (init == null)
                throw new ObjectNotFound("CharterInitialStep");

            var charterWorkflowLog = new CharterWorkflowLog(charterIn, WorkflowEntities.CharterIn, DateTime.Now, WorkflowActions.Init,
                //TODO: Fake ActorId
                1101, "", init.Id, true);

            charterIn.ApproveWorkflows.Add(charterWorkflowLog);

            return charterIn;
        }
Пример #3
0
        public CharterOut(long id, long chartererId, long ownerId, long vesselInCompanyId, long CurrencyId,
                          DateTime actionDate, List<CharterItem> charterItems,
                          List<InventoryOperation> inventoryOperationItems,
                          CharterType charterType, CharterEndType charterEndType,
                          OffHirePricingType offHirePricingType, ICharterInDomainService charterInDomainService
            , ICharterOutDomainService charterOutDomainService, IEventPublisher eventPublisher)
            : base(id, chartererId, ownerId, vesselInCompanyId, CurrencyId,
                  actionDate, charterItems, inventoryOperationItems,
                  charterType, charterEndType, charterInDomainService, charterOutDomainService, eventPublisher)
        {
            this.OffHirePricingType = offHirePricingType;
            this._eventPublisher.RegisterHandler<CharterOutApproveArg>(new InventorySubscriber());
            this._eventPublisher.RegisterHandler<CharterOutFinalApproveArg>(new InventorySubscriber());
            this._eventPublisher.RegisterHandler<CharterOutDisApproveArg>(new InventorySubscriber());

            #region bz

            if (this.CharterType == CharterType.Start)
            {

                //B74
                IsNotSameChatererOwner(ownerId, chartererId);
                //B29
                IsValidateCharterOutStartProp();
                //B23
                IsValidStartDate();
                //B2
                IsValidCharterInStartDate();
                //B22
                IsVesselOwnedOrCharterIn();
                //B28
                HasVesselCharterOutStart(vesselInCompanyId);
                //B59
                CompareOffhirePricing();

            }
            else
            {
                //B36
                CheckPeriodCharterInValid();
                //B37
                IsNextCharterStartDateGreaterThanActionDate();
                //B31
                ExistFinalApprove();
                //B35
                IsNotVesselCharterIn(VesselInCompanyId.Value);
                //B43
                HasVesselCharterOutEnd(VesselInCompanyId.Value);
                //B45
                IsValidEndDate();
                //51
                IsValidateCharterEnd(actionDate, CurrencyId, charterEndType);

                //B34

            }
            #endregion
        }
Пример #4
0
        internal CharterIn(long id, long chartererId, long ownerId, long vesselInCompanyId, long CurrencyId,
                       DateTime actionDate, List<CharterItem> charterItems,
                       List<InventoryOperation> inventoryOperationItems,
                       CharterType charterType, CharterEndType charterEndType,
                       OffHirePricingType offHirePricingType,
            ICharterInDomainService charterInDomainService,
            ICharterOutDomainService charterOutDomainService,
            IEventPublisher eventPublisher
            )
            : base(id, chartererId, ownerId, vesselInCompanyId, CurrencyId,
                  actionDate, charterItems, inventoryOperationItems,
                  charterType, charterEndType, charterInDomainService, charterOutDomainService, eventPublisher)
        {
            this.OffHirePricingType = offHirePricingType;
            this._eventPublisher.RegisterHandler<CharterInApproveArg>(new InventorySubscriber());
            this._eventPublisher.RegisterHandler<CharterInFinalApproveArg>(new InventorySubscriber());
            this._eventPublisher.RegisterHandler<CharterInDisApproveArg>(new InventorySubscriber());

            #region BZ

            if (CharterType == CharterType.Start)
            {

                //B74
                IsNotSameChatererOwner(ownerId, chartererId);
                //B4
                IsValidateCharterInStartProp();
                //B17
                HasVesselCharterInStart();
                //B2
                IsValidCharterInStartDate();
                //B59
                CompareOffhirePricing();

            }
            else
            {
                //B45
                IsValidEndDate();

                //B48
                ExistFinalApprove();

                //B58
                HasVesselCharterInEnd();
                //B55
                IsVesselCharterOut();

                //B49

                //B56
                IsEndDateGreaterThanLastCharterOutEndDate();

            }
            #endregion
        }
Пример #5
0
 // DELETE api/charteritem/5
 public void Delete(CharterType charterType, int id,int charterItemId)
 {
     if (charterType == CharterType.In)
     {
         this._charterInFacadeService.DeleteItem(id, charterItemId);
     }
     else
     {
         this._charterOutFacadeService.DeleteItem(id, charterItemId);
     }
 }
Пример #6
0
 // DELETE api/charter/5
 public void Delete(long id, CharterType charterType)
 {
     if (charterType == CharterType.In)
     {
         this._charterInFacadeService.Delete(id);
     }
     else
     {
         this._charterOutFacadeService.Delete(id);
     }
 }
Пример #7
0
 public PageResultDto<CharterDto> Get(CharterType charterType, long companyId, int pageIndex, int pageSize)
 {
     var res = new PageResultDto<CharterDto>();
     if (charterType == CharterType.In)
     {
         res = this._charterInFacadeService.GetAll(companyId, pageIndex, pageSize);
     }
     else
     {
         res = this._charterOutFacadeService.GetAll(companyId, pageIndex, pageSize);
     }
     return res;
 }
 public VesselDto GetById(CharterType charterType,  long id,bool flag)
 {
     var res = new VesselDto();
     if (charterType == CharterType.In)
     {
         res = this._vesselFacadeService.GetById(id);
     }
     else
     {
         // todo bzcomment
         res = this._vesselFacadeService.GetById(id);
     }
     return res;
 }
 public PageResultDto<VesselDto> Get(CharterType charterType, long companyId)
 {
     var res = new PageResultDto<VesselDto>();
     if (charterType == CharterType.In)
     {
         res.Result = this._vesselFacadeService.GetOwnedVessels(companyId) as IList<VesselDto>;
     }
     else
     {
         // todo bzcomment
         res.Result = this._vesselFacadeService.GetOwnedOrCharterInVessels(companyId) as IList<VesselDto>;
     }
     return res;
 }
Пример #10
0
        public CharterItemDto GetById(long id, long charterItemId, CharterType charterType)
        {
            var res = new CharterItemDto();
            if (charterType==CharterType.In)
            {
                res= this._charterInFacadeService.GetItemById(id,charterItemId);
            }
            else
            {
                res = this._charterOutFacadeService.GetItemById(id, charterItemId);
            }

            return res;
        }
Пример #11
0
        // POST api/charteritem
        public CharterItemDto Post(long id, CharterType charterType, [FromBody]CharterItemDto value)
        {
            var res = new CharterItemDto();
            if (charterType == CharterType.In)
            {
                this._charterInFacadeService.AddItem(value);
            }
            else
            {
                this._charterOutFacadeService.AddItem(value);
            }

            return res;
        }
Пример #12
0
        // GET api/charteritem
        public PageResultDto<CharterItemDto> Get(long id,CharterType charterType)
        {
            var res = new PageResultDto<CharterItemDto>();
            if (charterType==CharterType.In)
            {
                res= this._charterInFacadeService.GetAllItem(id,0,0);
            }
            else
            {
                res = this._charterOutFacadeService.GetAllItem(id, 0, 0);
            }

            return res;
        }
Пример #13
0
 public Charter(long id, long chartererId, long ownerId, long vesselInCompanyId, long CurrencyId,
                    DateTime actionDate, List<CharterItem> charterItems,
                    List<InventoryOperation> inventoryOperationItems,
                    CharterType charterType, CharterEndType charterEndType,
     ICharterInDomainService charterInDomainService, ICharterOutDomainService charterOutDomainService
     , IEventPublisher eventPublisher)
     : this()
 {
     this.Id = id;
     this.ChartererId = chartererId;
     this.OwnerId = ownerId;
     this.VesselInCompanyId = vesselInCompanyId;
     this.CurrencyId = CurrencyId;
     this.ActionDate = actionDate;
     this.CharterItems = charterItems;
     this.InventoryOperationItems = inventoryOperationItems;
     this.CharterType = charterType;
     this.CharterEndType = charterEndType;
     _charterInDomainService = charterInDomainService;
     _charterOutDomainService = charterOutDomainService;
     _eventPublisher = eventPublisher;
 }
Пример #14
0
        public void SetCharterType(CharterType charterType)
        {
            if (charterType == CharterType.In)
            {
                this.DisplayName = "چارتر In";

            }
            else
            {
                this.DisplayName = "چارتر Out";
            }
            CurrentCharterType = charterType;
        }
Пример #15
0
 // PUT api/charter/5
 public CharterDto Put(CharterType charterType, long id, [FromBody]CharterDto value)
 {
     if (charterType == CharterType.In)
     {
         this._charterInFacadeService.Update(value);
     }
     else
     {
         this._charterOutFacadeService.Update(value);
     }
     return new CharterDto();
 }
Пример #16
0
        // PUT api/charteritem/5
        public CharterItemDto Put(int id, long charterItemId, CharterType charterType, [FromBody]CharterItemDto value)
        {
            var res = new CharterItemDto();
            if (charterType == CharterType.In)
            {
                this._charterInFacadeService.UpdateItem(value);
            }
            else
            {
                 this._charterOutFacadeService.UpdateItem(value);
            }

            return res;
        }
Пример #17
0
 // POST api/charter
 public CharterDto Post(CharterType charterType, [FromBody]CharterDto value)
 {
     if (charterType == CharterType.In)
     {
         this._charterInFacadeService.Add(value);
     }
     else
     {
         this._charterOutFacadeService.Add(value);
     }
     return new CharterDto();
 }
Пример #18
0
        public void Update(long id, long chartererId, long ownerId, long vesselInCompanyId, long CurrencyId,
                       DateTime actionDate, List<CharterItem> charterItems,
                       List<InventoryOperation> inventoryOperationItems,
                       CharterType charterType, CharterEndType charterEndType, OffHirePricingType offHirePricingType)
        {
            #region bz
            if (CharterType == CharterType.Start)
            {

                //B74
                IsNotSameChatererOwner(ownerId, chartererId);
                //B18
                IsValidChangeOffhirePricing(offHirePricingType);

                //B19
                IsNotFinalApprove();

                //B22
                IsVesselOwnedOrCharterIn();

                //B23
                IsValidStartDate();

                //B29
                IsValidateCharterOutStartProp();

                //B2
                IsValidCharterInStartDate();

                //B59
                CompareOffhirePricing();

                //B30
                IsChangePropRejectSubmitted(chartererId, vesselInCompanyId, CurrencyId,
                                            actionDate);

            }
            else
            {
                //B31
                ExistFinalApprove();
                //B35
                IsNotVesselCharterIn(VesselInCompanyId.Value);
                //B36
                CheckPeriodCharterInValid();
                //B37
                IsNextCharterStartDateGreaterThanActionDate();
                //B45
                IsValidEndDate();
                //B51
                IsValidateCharterEnd(actionDate, CurrencyId, charterEndType);
                //B33
                IsNotFinalApprove();

                //B44
                IsChangeValidForSubmitRejectedCharter(actionDate, CurrencyId, charterEndType);

                //B34
            }

            #endregion
            this.OffHirePricingType = offHirePricingType;
            this.UpdatePrivateProp(id, chartererId, ownerId, vesselInCompanyId, CurrencyId,
                          actionDate, charterItems,
                         inventoryOperationItems,
                          charterType, charterEndType);
        }
Пример #19
0
        public void Update(long id, long chartererId, long ownerId, long vesselInCompanyId, long currencyId,
                       DateTime actionDate, List<CharterItem> charterItems,
                       List<InventoryOperation> inventoryOperationItems,
                       CharterType charterType, CharterEndType charterEndType, OffHirePricingType offHirePricingType)
        {
            #region bz

            if (CharterType == CharterType.Start)
            {

                //B74
                IsNotSameChatererOwner(ownerId, chartererId);
                //B4
                IsValidateCharterInStartProp();
                //B13
                IsChangePropRejectSubmitted(ownerId, vesselInCompanyId, currencyId, actionDate);
                //B1
                IsNotFinalApprove();

                //B2
                IsValidCharterInStartDate();
                //B18
                IsValidChangeOffhirePricing(offHirePricingType);
                //B59
                CompareOffhirePricing();
            }
            else
            {
                //B32
                IsValidateCharterEnd(actionDate, currencyId, charterEndType);

                //B45
                IsValidEndDate();

                //B46
                IsNotFinalApprove();

                //B48
                ExistFinalApprove();

                //B53
                IsChangeValidForSubmitRejectedCharter(actionDate, currencyId, charterEndType);
                //B55
                IsVesselCharterOut();

                //B56
                IsEndDateGreaterThanLastCharterOutEndDate();

            }

            #endregion

            this.OffHirePricingType = offHirePricingType;
            this.UpdatePrivateProp(id, chartererId, ownerId, vesselInCompanyId, currencyId,
                        actionDate, charterItems,
                       inventoryOperationItems,
                        charterType, charterEndType);
        }
Пример #20
0
        public void SetCharterType(CharterType charterType, CharterStateTypeEnum charterStateTypeEnum, long charterId, long charterItemId)
        {
            CurrentCharterType = charterType;
            CurrentStateTypeEnum = charterStateTypeEnum;
            CharterId = charterId;
            CharterItemId = charterItemId;
            if (charterType == CharterType.In)
            {
                this.DisplayName = "چارتر In";

            }
            else
            {
                this.DisplayName = "چارتر Out";
            }
        }
Пример #21
0
        protected void UpdatePrivateProp(long id, long chartererId, long ownerId, long vesselInCompanyId, long CurrencyId,
                         DateTime actionDate, List<CharterItem> charterItems,
                         List<InventoryOperation> inventoryOperationItems,
                         CharterType charterType, CharterEndType charterEndType
                         )
        {
            this.Id = id;
            this.ChartererId = chartererId;
            this.CurrencyId = CurrencyId;

            this.OwnerId = ownerId;
            this.VesselInCompanyId = vesselInCompanyId;
            this.ActionDate = actionDate;
            this.CharterType = charterType;
            this.CharterEndType = charterEndType;
        }