Esempio n. 1
0
 //Listo
 #region Modifiar Tratamiento
 public void ModificarTratamiento(Tratamiento tratamientoPrimario, List <Implemento> listaImplementos, List <Tratamiento> listaTratamiento)
 {
     try
     {
         bool modificarTratamientoDetalle = new DAOTratamiento().SqlModificarTratamiento(tratamientoPrimario);
         EliminarTratamientoAsociado(tratamientoPrimario);
         AgregarTratamientoAsociado(tratamientoPrimario, listaTratamiento);
         bool implementosAgregados = new LogicaImplemento().EliminarImplementos(tratamientoPrimario);
         bool ImplementosAgregados = new LogicaImplemento().AgregarImplemento(listaImplementos);
     }
     catch (ExcepcionTratamiento e)
     {
         throw e;
     }
     catch (ArgumentException e)
     {
         throw new ExcepcionTratamiento("Parametros invalidos", e);
     }
     catch (NullReferenceException e)
     {
         throw new ExcepcionTratamiento("Tratamiento incorrecto", e);
     }
     catch (Exception e)
     {
         throw new ExcepcionTratamiento("Error en la consulta de los Tratamientos", e);
     }
 }
Esempio n. 2
0
        //Agrega El tratamiento con sus Implementos y Tratamientos Asociados
        #region Agregar Tratamiento
        public void AgregarTratamiento(Tratamiento tratamientoPrimario, List <Implemento> listaImplementos, List <Tratamiento> listaTratamiento)
        {
            try
            {
                bool TratamientoAgregado   = new DAOTratamiento().SqlAgregarTratamiento(tratamientoPrimario);
                int  IdTratamientoAgregado = new DAOTratamiento().SqlIdTratmientoNuevo();
                tratamientoPrimario.Id = Convert.ToInt16(IdTratamientoAgregado);
                AgregarTratamientoAsociado(tratamientoPrimario, listaTratamiento);

                for (int i = 0; i < listaImplementos.Count; i++)
                {
                    listaImplementos[i].IdTratamiento = Convert.ToInt16(IdTratamientoAgregado);
                }

                bool ImplementosAgregados = new LogicaImplemento().AgregarImplemento(listaImplementos);
            }
            catch (ExcepcionTratamiento e)
            {
                throw e;
            }
            catch (ArgumentException e)
            {
                throw new ExcepcionTratamiento("Parametros invalidos", e);
            }
            catch (NullReferenceException e)
            {
                throw new ExcepcionTratamiento("Tratamientos vacios", e);
            }
            catch (Exception e)
            {
                throw new ExcepcionTratamiento("Error en agregar Tratamiento", e);
            }
        }
Esempio n. 3
0
        public void AgregarTratamiento(Tratamiento tratamientoPrimario, List<Implemento> listaImplementos, List<Tratamiento> listaTratamiento)
        {
            try
            {
                bool TratamientoAgregado = new DAOTratamiento().SqlAgregarTratamiento(tratamientoPrimario);
                int IdTratamientoAgregado = new DAOTratamiento().SqlIdTratmientoNuevo();
                tratamientoPrimario.Id = Convert.ToInt16(IdTratamientoAgregado);
                AgregarTratamientoAsociado(tratamientoPrimario,listaTratamiento);

                for (int i = 0; i < listaImplementos.Count; i++)
                {
                    listaImplementos[i].IdTratamiento = Convert.ToInt16(IdTratamientoAgregado);
                }

                bool ImplementosAgregados = new LogicaImplemento().AgregarImplemento(listaImplementos);
            }
            catch (ExcepcionTratamiento e)
            {
                throw e;
            }
            catch (ArgumentException e)
            {
                throw new ExcepcionTratamiento("Parametros invalidos", e);
            }
            catch (NullReferenceException e)
            {
                throw new ExcepcionTratamiento("Tratamientos vacios", e);
            }
            catch (Exception e)
            {
                throw new ExcepcionTratamiento("Error en agregar Tratamiento", e);
            }
        }
 //
 protected List<Implemento> GetDataProductoNoImplemento()
 {
     List<Implemento> datos;
     try
     {
         //datos = null;
         datos = new LogicaImplemento().CargarListaProductoNoImplemento(tratamiento);
     }
     catch (Exception e)
     {
         datos = null;
         error.Text = e.Message;
     }
     return datos;
 }
 //
 protected List<Implemento> GetDataImplemento()
 {
     List<Implemento> datos;
     try
     {
         datos = new LogicaImplemento().ConsultarImplemento(tratamiento);
     }
     catch (Exception e)
     {
         datos = null;
         error.Text = e.Message;
     }
     return datos;
 }
Esempio n. 6
0
 public void ModificarTratamiento(Tratamiento tratamientoPrimario, List<Implemento> listaImplementos, List<Tratamiento> listaTratamiento)
 {
     try
     {
         bool modificarTratamientoDetalle = new DAOTratamiento().SqlModificarTratamiento(tratamientoPrimario);
         EliminarTratamientoAsociado(tratamientoPrimario);
         AgregarTratamientoAsociado(tratamientoPrimario, listaTratamiento);
         bool implementosAgregados = new LogicaImplemento().EliminarImplementos(tratamientoPrimario);
         bool ImplementosAgregados = new LogicaImplemento().AgregarImplemento(listaImplementos);
     }
     catch (ExcepcionTratamiento e)
     {
         throw e;
     }
     catch (ArgumentException e)
     {
         throw new ExcepcionTratamiento("Parametros invalidos", e);
     }
     catch (NullReferenceException e)
     {
         throw new ExcepcionTratamiento("Tratamiento incorrecto", e);
     }
     catch (Exception e)
     {
         throw new ExcepcionTratamiento("Error en la consulta de los Tratamientos", e);
     }
 }