コード例 #1
0
 public void Submit(Scrap scrap, SubmittedState submittedState)
 {
     scrap.Submit(submittedState,
         vesselDomainService, inventoryOperationNotifier,
         tankDomainService, currencyDomainService,
         goodDomainService, goodUnitDomainService);
 }
コード例 #2
0
 public ScrapWorkflowLog(
     Scrap scrap,
     WorkflowEntities actionEntity,
     DateTime actionDate,
     WorkflowActions? workflowAction,
     long actorUserId,
     string remark, long currentWorkflowStepId, bool active)
     : base(actionEntity, workflowAction, actorUserId, actionDate, remark, currentWorkflowStepId, active)
 {
     Scrap = scrap;
 }
コード例 #3
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
        internal ScrapDetail(double rob, double price, Currency currency, Good good, GoodUnit unit, Tank tank, Scrap scrap,
            IScrapDomainService scrapDomainService, ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService,
            IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
            : this()
        {
            this.validateScrap(scrap, scrapDomainService);

            this.validateValues(rob, price, currency, good, unit, tank, scrap,
                tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);

            this.ROB = rob;
            this.Price = price;
            this.Currency = currency;
            this.Good = good;
            this.Unit = unit;
            this.Tank = tank;
            this.Scrap = scrap;
        }
コード例 #4
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
        //================================================================================
        private ScrapDetail(
            double rob,
            double price,
            Currency currency,
            Good good,
            GoodUnit unit,
            Tank tank,
            Scrap scrap)
        {
            //This constructor added to be used for insert into DB.
            this.ROB = rob;
            this.Price = price;
            this.Currency = currency;
            this.Good = good;
            this.Unit = unit;
            this.Tank = tank;
            this.Scrap = scrap;

            this.isScrapSubmitRejected = new IsScrapSubmitRejected();

            //this.InventoryOperations = new List<InventoryOperation>();
        }
コード例 #5
0
 //================================================================================
 public void Delete(Scrap scrap)
 {
     scrapRepository.Delete(scrap);
 }
コード例 #6
0
        public List<InventoryOperation> NotifySubmittingScrap(Scrap source)
        {
            //var scrapDto = scrapToScrapDtoMapper.MapToModel(source);

            ////TODO: svc.NotifySubmittingScrapDetail must be renamed to NotifySubmittingScrap
            ////TODO: The argument Type must be changed from ScrapDetailDto to ScrapDto.
            //var inventoryOperationDtosResult = svc.NotifySubmittingScrapDetail(scrapDto).ToList();

            //var result = inventoryOperationDtosResult.Select(mapInventoryOperationDtoToInventoryOperation);

            //return result.ToList();

            return null;
        }
コード例 #7
0
        //================================================================================
        public List<InventoryOperation> ManageScrap(Scrap scrap, int userId)
        {
            using (var dbContext = new InventoryDbContext())
            {
                using (var transaction = new TransactionScope())
                {
                    var reference = findInventoryOperationReference(dbContext, InventoryOperationType.Issue, CHARTER_IN_START_RECEIPT, scrap.Id.ToString());

                    //if (reference.OperationId == INVALID_ID)
                    if (reference == null)
                    {

                    }
                    else
                    {
                        var transactionItems = dbContext.TransactionItems.Where(ti => ti.TransactionId == reference.OperationId);

                    }
                }
            }
            return null;
        }
コード例 #8
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
        //================================================================================
        private void validateValues(double rob, double price, Currency currency, Good good, GoodUnit unit, Tank tank, Scrap scrap, ITankDomainService tankDomainService, ICurrencyDomainService currencyDomainService, IGoodDomainService goodDomainService, IGoodUnitDomainService goodUnitDomainService)
        {
            this.validateTank(tank, scrap, tankDomainService);

            this.validateGood(good, goodDomainService);
            this.validateGoodInTank(tank, good, scrap);
            this.validateGoodToBeUniqueInDetails(good, scrap);

            this.validateROB(rob);
            this.validatePrice(price);
            this.validateCurrency(currency, currencyDomainService);

            this.validateUnit(unit, goodUnitDomainService);
            this.validateGoodUnitInCompany(scrap.VesselInCompany.Company, good, unit);
        }
コード例 #9
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
 //================================================================================
 private void validateTankForVesselWithTanks(Tank tank, Scrap scrap)
 {
     if (scrap.VesselInCompany.Tanks.Count > 0 && tank == null)
         throw new BusinessRuleException("", "Tank must be selected.");
 }
コード例 #10
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
        //================================================================================
        private void validateScrap(Scrap scrap, IScrapDomainService scrapDomainService)
        {
            if (scrap == null)
                throw new InvalidArgument("Scrap");

            if (scrapDomainService.Get(scrap.Id) == null)
                throw new ObjectNotFound("Scrap", scrap.Id);
        }
コード例 #11
0
 public void ValidateMiddleApprove(Scrap scrap)
 {
     scrap.ValidateMiddleApprove(vesselDomainService, tankDomainService, currencyDomainService,
         goodDomainService, goodUnitDomainService);
 }
コード例 #12
0
 public void RejectSubmittedState(Scrap scrap, SubmitRejectedState submitRejectedState)
 {
     scrap.RejectSubmittedState(submitRejectedState);
 }
コード例 #13
0
 public void Close(Scrap scrap, ClosedState closedState)
 {
     scrap.Close(closedState);
 }
コード例 #14
0
 public void Cancel(Scrap scrap, CancelledState cancelledState)
 {
     scrap.Cancel(cancelledState, inventoryOperationNotifier);
 }
コード例 #15
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
        //================================================================================
        private void validateGoodInTank(Tank tank, Good good, Scrap scrap)
        {
            if (good == null)
                throw new InvalidArgument("Good");

            if (tank != null)
            {
                var registeredTanksForGoodCount = scrap.ScrapDetails.Count(sd => sd.Id != this.Id && sd.Tank != null && sd.Tank.Id == tank.Id && sd.Good.Id == good.Id);

                if (registeredTanksForGoodCount > 0)
                    throw new BusinessRuleException("", string.Format("The same Good '{0}' in Tank is already defined.", good.Name));
            }
        }
コード例 #16
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
 //================================================================================
 private void validateGoodToBeUniqueInDetails(Good good, Scrap scrap)
 {
     if (scrap.ScrapDetails.Count(sd => sd.Good.Id == good.Id && sd.Id != this.Id) != 0)
         throw new BusinessRuleException("", string.Format("The Good '{0}' has other records in Scrap Details.", good.Name));
 }
コード例 #17
0
        public List<InventoryOperation> NotifySubmittingScrap(Scrap source)
        {
            var scrapDto = scrapToScrapDtoMapper.MapToModel(source);

            ////TODO: svc.NotifySubmittingScrapDetail must be renamed to NotifySubmittingScrap
            ////TODO: The argument Type must be changed from ScrapDetailDto to ScrapDto.
            //var inventoryOperationDtosResult = svc.NotifySubmittingScrapDetail(scrapDto).ToList();

            //var result = inventoryOperationDtosResult.Select(mapInventoryOperationDtoToInventoryOperation);

            //return result.ToList();

            var syncEvent = new AutoResetEvent(false);

            List<InventoryOperation> callResult = null;
            Exception callException = null;

            ClientHelper.Post<List<FuelReportInventoryOperationDto>, ScrapDto>
                //(new Uri("http://localhost:65234/api/fuelevents", UriKind.Absolute),
                //(new Uri("http://evaluation-srv:9090/api/fuelevents", UriKind.Absolute),
                (MessageBrokerApiUri, (result, exp) =>
                {
                    callException = exp;
                    if (result != null)
                        callResult = result.Select(mapInventoryOperationDtoToInventoryOperation).ToList();

                    syncEvent.Set();
                },
                scrapDto, ClientHelper.MessageFormat.Json, new Dictionary<string, string>(), "ScrapDto");

            syncEvent.WaitOne();

            if (callException != null)
                throw callException;

            return callResult;
        }
コード例 #18
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
        //================================================================================
        private void validateTank(Tank tank, Scrap scrap, ITankDomainService tankDomainService)
        {
            this.validateTankExistance(tank, tankDomainService);

            validateTankForVesselWithTanks(tank, scrap);

            validateTankForVesselWithoutTanks(tank, scrap);

            validateTankToBeInVesselTanks(tank, scrap);
        }
コード例 #19
0
 //================================================================================
 public bool IsScrapDetailDeletePermitted(Scrap scrap)
 {
     return isScrapOpen.IsSatisfiedBy(scrap);
 }
コード例 #20
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
 //================================================================================
 private void validateTankForVesselWithoutTanks(Tank tank, Scrap scrap)
 {
     if (scrap.VesselInCompany.Tanks.Count == 0 && tank != null)
         throw new BusinessRuleException("", "Tank should not be selected for Vessel.");
 }
コード例 #21
0
 //================================================================================
 public bool IsScrapDetailEditPermitted(Scrap scrap)
 {
     return isScrapOpen.IsSatisfiedBy(scrap) || isScrapSubmitRejected.IsSatisfiedBy(scrap);
 }
コード例 #22
0
ファイル: ScrapDetail.cs プロジェクト: hatefi-arman/Modules
 //================================================================================
 private void validateTankToBeInVesselTanks(Tank tank, Scrap scrap)
 {
     if (scrap.VesselInCompany.Tanks.Count > 0 && tank != null && scrap.VesselInCompany.Tanks.Count(t => t.Id == tank.Id) == 0)
         throw new BusinessRuleException("", "Selected Tank is not defined for Vessel.");
 }
コード例 #23
0
 //================================================================================
 public bool IsScrapEditPermitted(Scrap scrap)
 {
     return isScrapOpen.IsSatisfiedBy(scrap);
 }
コード例 #24
0
 //================================================================================
 public bool IsTankEditable(Scrap scrap)
 {
     return isScrapOpen.IsSatisfiedBy(scrap);
 }
コード例 #25
0
 //================================================================================
 public void SetInventoryResults(InventoryResultCommand resultCommand, Scrap scrap)
 {
 }
コード例 #26
0
 public List<InventoryOperation> NotifySubmittingScrap(Scrap source)
 {
     return new List<InventoryOperation>(new InventoryOperation[]
             {
              new InventoryOperation(
                  312,
              "INV# - " +DateTime.Now.Ticks,
                 DateTime.Now,
                 InventoryActionType.Issue,
                 (long? )null,
                 (long? )null)});
 }
コード例 #27
0
        //================================================================================
        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);
        }