示例#1
0
        public DataTable GetTablaRelesOperador(OperacionInterruptores opInterruptor)
        {
            string sql =
                @"SELECT * 
            FROM F_GF_RELES_OPER 
            WHERE 
            pk_cod_componente=:pk_cod_componente AND 
            pk_cod_falla=:pk_cod_falla AND 
            pk_d_cod_tipoinforme=:pk_d_cod_tipoinforme AND 
            PK_ORIGEN_INFORME=:PK_ORIGEN_INFORME AND
            FEC_APERTURA=:FEC_APERTURA";
            OracleCommand cmd = CrearCommand();

            cmd.CommandText = sql;
            cmd.Parameters.Add(RelesOperados.C_PK_COD_COMPONENTE, OracleDbType.Decimal, opInterruptor.PkCodComponente, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(RelesOperados.C_PK_COD_FALLA, OracleDbType.Int64, opInterruptor.PkCodFalla, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(RelesOperados.C_PK_D_COD_TIPOINFORME, OracleDbType.Int64, opInterruptor.PkDCodInforme, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(RelesOperados.PK_ORIGEN_INFORME, OracleDbType.Int64, opInterruptor.PkOrigenInforme, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(RelesOperados.C_FEC_APERTURA, OracleDbType.TimeStamp, opInterruptor.FechaApertura, System.Data.ParameterDirection.Input);
            cmd.BindByName = true;

            DataTable tabla = EjecutarCmd(cmd);

            return(tabla);
        }
示例#2
0
 public DialogResult Editar(OperacionInterruptores opInterruptor, List <long> listaInterruptoresUsados)
 {
     _regFalla      = Sesion.Instancia.GetObjetoGlobal <RegFalla>("Principal.FallaActual");
     _opInterruptor = opInterruptor;
     _ctrlComponenteComprometido.SetComponenteNoSeleccionables(listaInterruptoresUsados);
     VisualizarInterruptor();
     return(ShowDialog());
 }
        public void Guardar(OperacionInterruptores obj)
        {
            OracleCommand cmd = null;
            string        sql = string.Empty;

            if (obj.EsNuevo)
            {
                //Pista p = PistaMgr.Instance.Info("DALSisFalla", obj.GetEstadoString());
                //obj.SecLog = (long)p.PK_SecLog;
                sql = "INSERT INTO {0} ({1},{2},{3},{4},{5},{6},{7},{8},{9},{10})" +
                      "VALUES(:{1},:{2},:{3},:{4},:{5},:{6},:{7},:{8},:{9},:{10})";
            }
            else
            {
                sql = "UPDATE {0} SET " +
                      "{6}=:{6} ," +
                      "{7}=:{7} ," +
                      "{8}=:{8} ," +
                      "{9}=:{9}, " +
                      "{10}=:{10} " +
                      "WHERE " +
                      "{1}=:{1} AND " +
                      "{2}=:{2} AND " +
                      "{3}=:{3} AND " +
                      "{4}=:{4} AND " +
                      "{5}=:{5} ";
            }

            sql = string.Format(sql, OperacionInterruptores.NOMBRE_TABLA,
                                OperacionInterruptores.C_PK_COD_FALLA,
                                OperacionInterruptores.C_PK_ORIGEN_INFORME,
                                OperacionInterruptores.C_PK_D_COD_INFORME,
                                OperacionInterruptores.C_PK_COD_COMPONENTE,
                                OperacionInterruptores.C_FECHA_APERTURA,
                                OperacionInterruptores.C_PK_D_COD_TIPO_OPER_APER,
                                OperacionInterruptores.C_FECHA_CIERRE,
                                OperacionInterruptores.C_PK_D_COD_TIPO_OPER_CIERRE,
                                OperacionInterruptores.C_RECONECTADO,
                                OperacionInterruptores.C_SINC_VER);
            cmd             = CrearCommand();
            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(OperacionInterruptores.C_PK_COD_FALLA, OracleDbType.Int64, obj.PkCodFalla, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_ORIGEN_INFORME, OracleDbType.Int64, obj.PkOrigenInforme, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_D_COD_INFORME, OracleDbType.Int64, obj.PkDCodInforme, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_COD_COMPONENTE, OracleDbType.Decimal, obj.PkCodComponente, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_FECHA_APERTURA, OracleDbType.TimeStamp, obj.FechaApertura, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_D_COD_TIPO_OPER_APER, OracleDbType.Int64, obj.PkDCodTipoOperAper, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_FECHA_CIERRE, OracleDbType.TimeStamp, obj.FechaCierre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_D_COD_TIPO_OPER_CIERRE, OracleDbType.Int64, obj.PkDCodTipoOperCierre, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_RECONECTADO, OracleDbType.Int16, obj.Reconectado, System.Data.ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_SINC_VER, OracleDbType.Int64, obj.SincVer, System.Data.ParameterDirection.Input);

            if (Actualizar(cmd))
            {
                obj.EsNuevo = false;
            }
        }
示例#4
0
        private void _tspIngresarInterruptor_Click(object sender, EventArgs e)
        {
            OperacionInterruptores opInterruptor = _informe.CrearNuevoOpInterruptor();
            FormInterruptor        frm           = new FormInterruptor();

            if (frm.Editar(opInterruptor, GetListaInterruptores()) == DialogResult.OK)
            {
                Visualizar();
            }
        }
        public void Copiar(DataRow row, InformeFalla informeDestino)
        {
            OperacionInterruptores opInterrup = new OperacionInterruptores(row);

            opInterrup.PkOrigenInforme = informeDestino.PkOrigenInforme;
            opInterrup.PkDCodInforme   = informeDestino.PkDCodTipoinforme;
            opInterrup.EsNuevo         = true;
            Guardar(opInterrup);
            CopiarReles(new OperacionInterruptores(row), informeDestino);
        }
示例#6
0
        public BindingList <RelesOperados> GetLista(OperacionInterruptores opInterruptor)
        {
            BindingList <RelesOperados> resultado = new BindingList <RelesOperados>();
            DataTable tablaAgentes = GetTablaRelesOperador(opInterruptor);

            foreach (DataRow row in tablaAgentes.Rows)
            {
                resultado.Add(new RelesOperados(row));
            }
            return(resultado);
        }
 private void _dgvInterruptor_SelectionChanged(object sender, EventArgs e)
 {
     if (_dgvInterruptor.SelectedRows.Count > 0)
     {
         DataRowView drView = (DataRowView)_dgvInterruptor.SelectedRows[0].DataBoundItem;
         _rowSeleccionado         = drView.Row;
         _interruptorSeleccionado = new OperacionInterruptores(_rowSeleccionado);
         _dgvReles.DataSource     = ModeloMgr.Instancia.RelesOperadosMgr.GetTablaRelesOperador(_interruptorSeleccionado);
         BaseForm.VisualizarColumnas(_dgvReles, ColumnStyleManger.GetEstilos("CtrlInterruptoresReles", "_dgvReles"));
     }
 }
        private void CopiarReles(OperacionInterruptores opInterrup, InformeFalla informeDestino)
        {
            DataTable tablaReles = ModeloMgr.Instancia.RelesOperadosMgr.GetTablaRelesOperador(opInterrup);

            foreach (DataRow row in tablaReles.Rows)
            {
                RelesOperados rele = new RelesOperados(row);
                rele.PkOrigenFalla     = informeDestino.PkOrigenInforme;
                rele.PkDCodTipoinforme = informeDestino.PkDCodTipoinforme;
                rele.EsNuevo           = true;
                ModeloMgr.Instancia.RelesOperadosMgr.Guardar(rele);
            }
        }
示例#9
0
 private void AsegurarInterruptorSeleccionado()
 {
     if (_rowSeleccionado == null)
     {
         _dgvReles.DataSource     = null;
         _interruptorSeleccionado = null;
     }
     else
     {
         _interruptorSeleccionado = new OperacionInterruptores(_rowSeleccionado);
         _dgvReles.DataSource     = ModeloMgr.Instancia.RelesOperadosMgr.GetTablaRelesOperador(_interruptorSeleccionado);
         BaseForm.VisualizarColumnas(_dgvReles, ColumnStyleManger.GetEstilos("CtrlInterruptoresReles", "_dgvReles"));
     }
 }
        public bool SolapaTiempos(OperacionInterruptores obj)
        {
            bool   resultado = false;
            string sql       =
                @"SELECT *
            FROM F_GF_OP_INTERRUPTOR
            WHERE PK_COD_FALLA         = :PK_COD_FALLA
            AND PK_ORIGEN_INFORME      = :PK_ORIGEN_INFORME
            AND RowId                  <> :Row_Id
            AND PK_D_COD_TIPOINFORME   = :PK_D_COD_TIPOINFORME
            AND PK_COD_COMPONENTE      = :PK_COD_COMPONENTE
            AND 
            (
                (FECHA_APERTURA          >= :FECHA_APERTURA
                 AND FECHA_APERTURA      <= :FECHA_CIERRE OR 
                 FECHA_CIERRE            >= :FECHA_APERTURA
                 AND FECHA_CIERRE        <= :FECHA_CIERRE
                ) 
                OR
                (:FECHA_APERTURA         >= FECHA_APERTURA
                 AND :FECHA_APERTURA     <= FECHA_CIERRE OR 
                 :FECHA_CIERRE           >= FECHA_APERTURA
                 AND :FECHA_CIERRE       <= FECHA_CIERRE
                )
            )";

            OracleCommand cmd = CrearCommand();

            cmd.CommandText = sql;
            cmd.Parameters.Add(OperacionInterruptores.C_PK_COD_FALLA, OracleDbType.Int32, obj.PkCodFalla, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_ORIGEN_INFORME, OracleDbType.Int64, obj.PkOrigenInforme, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_D_COD_INFORME, OracleDbType.Int64, obj.PkDCodInforme, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_COD_COMPONENTE, OracleDbType.Int64, obj.PkCodComponente, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_FECHA_APERTURA, OracleDbType.TimeStamp, obj.FechaApertura, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_FECHA_CIERRE, OracleDbType.TimeStamp, obj.FechaCierre, ParameterDirection.Input);
            cmd.Parameters.Add("Row_Id", OracleDbType.Varchar2, obj.RowId, ParameterDirection.Input);
            cmd.BindByName = true;

            DataTable tabla = EjecutarCmd(cmd);

            if (tabla.Rows.Count > 0)
            {
                resultado = true;
            }
            return(resultado);
        }
        public void Refrescar(OperacionInterruptores interruptor, DataRow row)
        {
            string sql =
                @"SELECT A.*,A.RowId,
            B.DESCRIPCION_DOMINIO TIPO_APERTURA,C.DESCRIPCION_DOMINIO TIPO_CIERRE,
            D.NOMBRE_COMPONENTE, D.Descripcion_componente 
            FROM 
            F_GF_OP_INTERRUPTOR A ,p_def_dominios B , p_def_dominios C,F_AC_COMPONENTE D 
            WHERE 
            A.PK_D_COD_TIPO_OPER_APER = b.cod_dominio 
            AND A.PK_D_COD_TIPO_OPER_CIERRE =C.cod_dominio 
            AND B.d_cod_tipo='D_COD_TIPO_OPERACION' 
            AND C.d_cod_tipo='D_COD_TIPO_OPERACION'  
            AND A.pk_cod_componente=D.PK_COD_COMPONENTE  
            AND A.PK_COD_FALLA=:PK_COD_FALLA 
            AND A.PK_ORIGEN_INFORME=:PK_ORIGEN_INFORME
            AND A.PK_D_COD_TIPOINFORME=:PK_D_COD_TIPOINFORME 
            AND A.PK_COD_COMPONENTE=:PK_COD_COMPONENTE
            AND A.FECHA_APERTURA=:FECHA_APERTURA";

            OracleCommand cmd = CrearCommand();

            cmd.CommandText = sql;
            cmd.BindByName  = true;
            cmd.Parameters.Add(OperacionInterruptores.C_PK_COD_FALLA, OracleDbType.Int32, interruptor.PkCodFalla, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_ORIGEN_INFORME, OracleDbType.Int64, interruptor.PkOrigenInforme, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_D_COD_INFORME, OracleDbType.Int64, interruptor.PkDCodInforme, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_PK_COD_COMPONENTE, OracleDbType.Int64, interruptor.PkCodComponente, ParameterDirection.Input);
            cmd.Parameters.Add(OperacionInterruptores.C_FECHA_APERTURA, OracleDbType.TimeStamp, interruptor.FechaApertura, ParameterDirection.Input);
            DataTable resultado = EjecutarCmd(cmd);

            if (resultado.Rows.Count > 0)
            {
                foreach (DataColumn col in resultado.Columns)
                {
                    row[col.ColumnName] = resultado.Rows[0][col.ColumnName];
                }
            }
        }
        public void Borrar(OperacionInterruptores interruptor)
        {
            string sql =
                @"DELETE FROM F_GF_OP_INTERRUPTOR
            WHERE 
            PK_COD_FALLA = :PK_COD_FALLA 
            AND PK_ORIGEN_INFORME = :PK_ORIGEN_INFORME 
            AND PK_D_COD_TIPOINFORME = :PK_D_COD_TIPOINFORME 
            AND PK_COD_COMPONENTE = :PK_COD_COMPONENTE
            AND FECHA_APERTURA = :FECHA_APERTURA";
            OracleCommand cmd = CrearCommand();

            cmd.CommandText = sql;
            cmd.Parameters.Add("PK_COD_FALLA", OracleDbType.Int32, interruptor.PkCodFalla, ParameterDirection.Input);
            cmd.Parameters.Add("PK_ORIGEN_INFORME", OracleDbType.Int64, interruptor.PkOrigenInforme, ParameterDirection.Input);
            cmd.Parameters.Add("PK_D_COD_TIPOINFORME", OracleDbType.Int64, interruptor.PkDCodInforme, ParameterDirection.Input);
            cmd.Parameters.Add("PK_COD_COMPONENTE", OracleDbType.Int64, interruptor.PkCodComponente, ParameterDirection.Input);
            cmd.Parameters.Add("FECHA_APERTURA", OracleDbType.TimeStamp, interruptor.FechaApertura, ParameterDirection.Input);
            cmd.BindByName = true;

            Actualizar(cmd);
        }