예제 #1
0
        public ActionResult AnularComprobante(int id, string comentario)
        {
            if (!this.currentUser()) { return RedirectToAction("Ingresar"); }
            if (getCurrentUser().IdRol == 4) { return RedirectToAction("Comprobantes", "Admin"); }

            ComprobanteDTO dto;
            try
            {
                ComprobanteBL objBL = new ComprobanteBL();
                dto = objBL.getComprobanteEnEmpresa(getCurrentUser().IdEmpresa, id);
                if (objBL.ban(id, comentario))
                {
                    createResponseMessage(CONSTANTES.SUCCESS, CONSTANTES.SUCCESS_BAN);
                }
                else
                {
                    createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_BAN);
                }
            }
            catch (Exception e)
            {
                createResponseMessage(CONSTANTES.ERROR, CONSTANTES.ERROR_NO_BAN);
                throw;
            }
            string cadena = "Ingreso";
            if (dto != null) { cadena = dto.IdTipoComprobante == 1 ? "Ingreso" : "Egreso"; }
            return RedirectToAction("Comprobantes" + cadena, "Admin");
        }