コード例 #1
0
ファイル: ReceiptDocController.cs プロジェクト: rec2020/REC
        public IActionResult SnadReceiveIndex(int contractId, int contractType)
        {
            var contract_Value             = new Contract();
            var specContr                  = new SpecificContract();
            ReceiptDocViewModel receiptDoc = new ReceiptDocViewModel();

            if (contractType <= (int)EnumHelper.ContractType.Substitute)
            {
                contract_Value = _contrat.GetContractById(contractId);
                if (contract_Value != null)
                {
                    receiptDoc.CustomerId = contract_Value.CustomerId;
                }
            }
            else
            {
                specContr = _spec_contract.GetSpecificContractById(contractId);
                if (specContr != null)
                {
                    receiptDoc.CustomerId = specContr.CustomerId;
                }
            }
            receiptDoc.ContractTypeId = contractType;
            receiptDoc.ContractId     = contractId;
            var ReceiptDocList = _receipt.GetReceiptDocs().Where(x => x.ContractId == contractId &&
                                                                 x.ReceiptdocTypeId == (int)EnumHelper.ReceiptdocType.SnadReceive && x.ContractTypeId == receiptDoc.ContractType);

            ViewBag.ReceiptDocs = ReceiptDocList;

            receiptDoc.ReceiptdocTypeId = (int)EnumHelper.ReceiptdocType.SnadReceive;
            ViewBag.PaymentMethodId     = new SelectList(_payment_Method.GetPaymentMethods(), "Id", "Name");
            ViewBag.ReceiptdocTypeId    = new SelectList(_type.GetReceiptDocTypes().Where(x => x.Id == receiptDoc.ReceiptdocTypeId), "Id", "Name");
            ViewBag.CustomerId          = new SelectList(_customer.GetCustomers().Where(x => x.Id == receiptDoc.CustomerId), "Id", "FirstName", receiptDoc.CustomerId);
            return(View(receiptDoc));
        }
コード例 #2
0
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }
            var contract = _Contract.GetSpecificContractById((int)id);

            //var contractViewModels = _mapper.Map<SpecificContractViewModel>(contract);
            if (contract == null)
            {
                return(NotFound());
            }
            ViewBag.ReceiptDocs = _receipt.GetReceiptDocs().Where(x => x.ContractId == contract.Id &&
                                                                  x.ContractTypeId == contract.ContractTypeId && x.CustomerId == contract.CustomerId &&
                                                                  x.ReceiptdocTypeId == (int)EnumHelper.ReceiptdocType.SnadReceive);
            ViewBag.TakingDocs = _receipt.GetReceiptDocs().Where(x => x.ContractId == contract.Id &&
                                                                 x.ContractTypeId == contract.ContractTypeId && x.CustomerId == contract.CustomerId &&
                                                                 x.ReceiptdocTypeId == (int)EnumHelper.ReceiptdocType.SnadTaking);
            return(View(contract));
        }