Ejemplo n.º 1
0
        public void Agregar()
        {
            Entidad tratamiento1;

            try
            {
                if ((FabricaComando.CrearComandoValidarNumero(this._vista.Duracionp.Text).Ejecutar()) &&
                    (FabricaComando.CrearComandoValidarNumero(this._vista.Costop.Text).Ejecutar()) &&
                    (FabricaComando.CrearComandoValidaString(this._vista.Nombrep.Text).Ejecutar()) &&
                    (this._vista.Descripcionp.Text == String.Empty) && (this._vista.Explicacionp.Text == String.Empty))
                {
                    tratamiento1 = FabricaEntidad.NuevoTratamientoCompleto(0, this._vista.Nombrep.Text, Convert.ToInt16(this._vista.Duracionp.Text), Convert.ToInt16(this._vista.Costop.Text),
                                                                           this._vista.Descripcionp.Text, this._vista.Explicacionp.Text, "Activo");
                    //LogicaTratamiento logicatratamiento = new LogicaTratamiento();
                    // tratamiento1 = FabricaEntidad.NuevoTratamientoCompleto(0, "karen", 12, 23,
                    //  "asdfasdf", "sdafasdfasd", "Activo");
                    bool agrego = FabricaComando.CrearComandoAgregarTratamiento(tratamiento1, this._implementosAsociados, this._tratamientosAsociados).Ejecutar();
                }
                else
                {
                    this._vista.SetLabelFalla("Debe seleccionar un item de la lista");
                }
            }
            catch (ExcepcionTratamiento ex)
            {
                this._vista.SetLabelFalla(ex.Message + "Error  Agregar");
            }
            catch (NullReferenceException ex)
            {
                this._vista.SetLabelFalla(ex.Message + "NULL Agregar");
            }
            catch (IndexOutOfRangeException ex)
            {
                this._vista.SetLabelFalla(ex.Message + "Fuera de rango Agregar");
            }
            catch (Exception ex)
            {
                this._vista.SetLabelFalla(ex.Message + "Otro Agregar");
            }
        }