示例#1
0
        public static WFExchangeData PostModirAction(ActionMethodParams actionMethodParams)
        {
            int contractId = actionMethodParams.InitialExchangeData[WfConstants.RelatedRecordIdKey].ConvertTo <int>();

            WFExchangeData ex = (WFExchangeData)actionMethodParams.WorkflowInstanceState.ExchangeData;

            ContractRule contractRule = new ContractRule(UnitOfWork);

            DomainClasses.Contract.Contract contract = contractRule.Find(contractId);



            if (contract == null)
            {
                throw new OMFValidationException($" قرارداد با شناسه ثبت شده یافت نشد. شناسه: {contractId}");
            }


            if (actionMethodParams.ContinueInfo.ActionId == (int)WorkFlowActionType.Taeed)
            {
                contract.Status = Status.ConfirmationContract;
                contractRule.Update(contract);
                contractRule.SaveChanges();

                InvoiceRule invoiceRule = new InvoiceRule(UnitOfWork);
                invoiceRule.ConvertContractToInvoice(contract.ID, NoeFactor.RentFrom);
            }
            return(ex);
        }
示例#2
0
        public static WFExchangeData PostModirAction(ActionMethodParams actionMethodParams)
        {
            int contractSazeId = actionMethodParams.InitialExchangeData[WfConstants.RelatedRecordIdKey].ConvertTo <int>();

            WFExchangeData ex = (WFExchangeData)actionMethodParams.WorkflowInstanceState.ExchangeData;

            Contract_SazeRule contract_SazeRule = new Contract_SazeRule(UnitOfWork);
            Contract_Saze     contract_Saze     = contract_SazeRule.Find(contractSazeId);



            if (contract_Saze == null)
            {
                throw new OMFValidationException($"رسانه قرارداد با شناسه ثبت شده یافت نشد. شناسه: {contractSazeId}");
            }

            ContractRule contractRule = new ContractRule(UnitOfWork);

            DomainClasses.Contract.Contract contract = contractRule.Find(contract_Saze.ContractID);


            if (actionMethodParams.ContinueInfo.ActionId == (int)WorkFlowActionType.TaeedVaKhateme)
            {
                contract_Saze.Status = Status.ConfirmationContract;
                contract_SazeRule.Update(contract_Saze);
                contract_SazeRule.SaveChanges();

                if (contract.Contract_Sazes.All(x => x.Status == Status.ConfirmationContract))
                {
                    contract.Status = Status.ConfirmationContract;
                    contractRule.Update(contract);
                    contractRule.SaveChanges();
                }
            }
            return(ex);
        }