Esempio n. 1
0
 public override void Cancel(Offhire offhire)
 {
     ApprovableDomainService.Cancel(offhire, (CancelledState)this.OffhireStateFactory.CreateCancelledState());
 }
Esempio n. 2
0
        public Offhire CreateOffhire(
            long referenceNumber,
            DateTime startDateTime,
            DateTime endDateTime,
            Company introducer,
            VesselInCompany vesselInCompany,
            Voyage voyage,
            ActivityLocation offhireLocation,
            DateTime voucherDate,
            Currency voucherCurrency)
        {
            var offhire = new Offhire(
                referenceNumber,
                startDateTime,
                endDateTime,
                introducer,
                vesselInCompany,
                voyage,
                offhireLocation,
                voucherDate,
                voucherCurrency,
                this.offhireDomainService,
                this.offhireManagementSystemDomainService,
                this.vesselDomainService,
                this.voyageDomainService,
                this.companyDomainService,
                this.activityLocationDomainService,
                this.currencyDomainService);

            var init = this.workflowRepository.Single(c => c.WorkflowEntity == WorkflowEntities.Offhire && c.CurrentWorkflowStage == WorkflowStages.Initial);
            if (init == null)
                throw new ObjectNotFound("OffhireInitialStep");

            var offhireWorkflow = new OffhireWorkflowLog(offhire, WorkflowEntities.Offhire, DateTime.Now, WorkflowActions.Init,
                //TODO: Fake ActorId
                    1101, "", init.Id, true);

            offhire.ApproveWorkflows.Add(offhireWorkflow);

            offhireConfigurator.Configure(offhire);

            return offhire;
        }
Esempio n. 3
0
 public override void Approve(Offhire offhire)
 {
     ApprovableDomainService.Submit(offhire, (SubmittedState)this.OffhireStateFactory.CreateSubmittedState());
 }
Esempio n. 4
0
        public OffhireDetail CreateOffhireDetail(decimal quantity, decimal feeInVoucherCurrency, decimal feeInMainCurrency, Good good, GoodUnit unit, Tank tank, Offhire offhire)
        {
            var offhireDetail = new OffhireDetail(
                quantity, feeInVoucherCurrency, feeInMainCurrency, good, unit, tank, offhire, offhireDomainService,
                tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);

            return offhireDetail;
        }
Esempio n. 5
0
 public virtual void Reject(Offhire offhire)
 {
     throw new InvalidStateException("Reject", string.Format("Cannot Reject {0} State", offhire.State.ToString()));
 }
Esempio n. 6
0
 public virtual void Cancel(Offhire offhire)
 {
     throw new InvalidStateException("Cancel", string.Format("Cannot Cancel {0} State", offhire.State.ToString()));
 }
Esempio n. 7
0
 public virtual void Approve(Offhire offhire/*, IApprovableFuelReportDomainService approveService*/)
 {
     throw new InvalidStateException("Approve", string.Format("Cannot Approve {0} State", offhire.State.ToString()));
 }
Esempio n. 8
0
 public override void Approve(Offhire offhire)
 {
     ApprovableDomainService.Close(offhire, (ClosedState)this.OffhireStateFactory.CreateClosedState());
 }