Пример #1
0
        public ResultBM GetReleaseOrder(int releaseOrderId)
        {
            try
            {
                BeneficiaryBLL        beneficiaryBll           = new BeneficiaryBLL();
                ResultBM              beneficiaryResult        = null;
                ReleaseOrderDAL       releaseOrderDal          = new ReleaseOrderDAL();
                ReleaseOrderDTO       releaseOrderDto          = releaseOrderDal.GetReleaseOrder(releaseOrderId);
                ReleaseOrderBM        releaseOrderBm           = null;
                ReleaseOrderDetailBLL releaseOrderDetailBll    = new ReleaseOrderDetailBLL();
                ResultBM              releaseOrderDetailResult = null;

                //Si la orden de salida existe, deben existir beneficiario y detalles
                if (releaseOrderDto != null)
                {
                    beneficiaryResult = beneficiaryBll.GetBeneficiary(releaseOrderDto.beneficiaryId);
                    if (!beneficiaryResult.IsValid())
                    {
                        return(beneficiaryResult);
                    }
                    if (beneficiaryResult.GetValue() == null)
                    {
                        throw new Exception(SessionHelper.GetTranslation("RETRIEVING_ERROR") + " beneficiaryId " + releaseOrderDto.beneficiaryId);
                    }

                    releaseOrderDetailResult = releaseOrderDetailBll.GetReleaseOrderDetail(releaseOrderId);
                    if (!releaseOrderDetailResult.IsValid())
                    {
                        return(releaseOrderDetailResult);
                    }
                    if (releaseOrderDetailResult.GetValue() == null)
                    {
                        throw new Exception(SessionHelper.GetTranslation("RETRIEVING_ERROR") + " releaseOrderId " + releaseOrderId);
                    }
                }

                releaseOrderBm = new ReleaseOrderBM(releaseOrderDto, beneficiaryResult.GetValue <BeneficiaryBM>(), releaseOrderDetailResult.GetValue <List <ReleaseOrderDetailBM> >());
                return(new ResultBM(ResultBM.Type.OK, "Operación exitosa.", releaseOrderBm));
            }
            catch (Exception exception)
            {
                return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("RETRIEVING_ERROR") + " " + exception.Message, exception));
            }
        }
Пример #2
0
        //No está bueno esto, pero me permite recuperar los beneficiarios. Poco performante... pero no hay tiempo.
        private BeneficiaryBM GetBeneficiary(ReleaseOrderDTO releaseOrderDto)
        {
            ResultBM beneficiaryResult = new BeneficiaryBLL().GetBeneficiary(releaseOrderDto.beneficiaryId);

            return(beneficiaryResult.GetValue <BeneficiaryBM>());
        }