Exemplo n.º 1
0
        public ResultBM Delete(object entity)
        {
            try
            {
                StockDAL    stockDal    = new StockDAL();
                DonationBLL donationBll = new DonationBLL();
                StockBM     stockBm     = entity as StockBM;

                if (!stockDal.IsInUse(stockBm.id))
                {
                    stockDal.DeleteStock(stockBm.id);
                    donationBll.UpdateToReceivedStatus(stockBm.donation.id);
                    return(new ResultBM(ResultBM.Type.OK, "Se ha eliminado el registro.", stockBm));
                }
                else
                {
                    return(new ResultBM(ResultBM.Type.FAIL, SessionHelper.GetTranslation("STOCK_UNDELETEABLE_ERROR"), stockBm));
                }
            }
            catch (Exception exception)
            {
                return(new ResultBM(ResultBM.Type.EXCEPTION, SessionHelper.GetTranslation("DELETING_ERROR") + " " + exception.Message, exception));
            }
        }
Exemplo n.º 2
0
        //No está bueno esto, pero me permite recuperar el voluntario. Poco performante... pero no hay tiempo.
        private DonationBM GetDonation(StockDTO stock)
        {
            ResultBM donationResult = new DonationBLL().GetDonation(stock.donationId);

            return(donationResult.GetValue <DonationBM>());
        }