Exemplo n.º 1
0
        public void Eliminar(int id_redactor)
        {
            try {
                if (this.bloqueo)
                {
                    throw new BloqueoException( );
                }

                using (var r = new sp_tipo_incidenteTableAdapter( )) {
                    using (var result = r.GetData(3, this.id, this.nombre, id_redactor)) {
                        var row = result.First( );

                        if (row.out_status != 200)
                        {
                            throw new NoSePuedeEliminarException("el tipo de incidente.");
                        }

                        this.id    = -1;
                        this.copia = null;
                    }
                }
            }
            catch (MySqlException ex) {
                var nex = Generador.GenerarDesdeMySqlException(ex);

                if (nex != null)
                {
                    throw nex;
                }
            }
        }
Exemplo n.º 2
0
        public void Insertar(int id_redactor)
        {
            try {
                if (this.copia != null)
                {
                    return;
                }

                using (var r = new sp_tipo_incidenteTableAdapter( ))
                    using (var s = r.GetData(1, null, this.nombre, id_redactor)) {
                        var ss = s.First( );

                        if (ss.out_status != 1)
                        {
                            throw new NoSePudoIngresarException("");
                        }

                        this.copia = base.MemberwiseClone( ) as TipoIncidente;
                        this.id    = ss.out_id;
                    }
            }
            catch (MySqlException ex) {
                var nex = Generador.GenerarDesdeMySqlException(ex);

                if (nex != null)
                {
                    throw nex;
                }
            }
        }