private void AplicarMultiplicadores(ResultadoLectura res, ParametrosLectura parametros) { foreach (DataRow r in res.Tabla.Rows) { MC_RPuntoMedicionFormatoDetalle rmc = GetRMedidorCanal(parametros.DetalleMagElec, (long)r["CodInfCanal"]); r["Valor"] = (double)r["Valor"] * rmc.Kc * rmc.Kct * rmc.Kpt; } }
public List <MC_RPuntoMedicionFormatoDetalle> GetListaDefMagElec(long codRptoMedFto) { List <MC_RPuntoMedicionFormatoDetalle> resultado = new List <MC_RPuntoMedicionFormatoDetalle>(); DataTable tabla = GetMagnitudesElectricas(codRptoMedFto); foreach (DataRow r in tabla.Rows) { MC_RPuntoMedicionFormatoDetalle rmc = new MC_RPuntoMedicionFormatoDetalle(r); resultado.Add(rmc); } return(resultado); }
public MC_RPuntoMedicionFormatoDetalle GetNuevoRMedidorCanal() { MC_RPuntoMedicionFormatoDetalle resultado = new MC_RPuntoMedicionFormatoDetalle(); resultado.FkCodRPtoMedFto = this.PkCodRptoMedFto; resultado.EsNuevo = true; resultado.DCodEstado = "1"; resultado.Kc = 1; resultado.Kct = 1; resultado.Kpt = 1; return(resultado); }
private MC_RPuntoMedicionFormatoDetalle GetRMedidorCanal(List <MC_RPuntoMedicionFormatoDetalle> lista, long codInfCanal) { MC_RPuntoMedicionFormatoDetalle resultado = null; foreach (MC_RPuntoMedicionFormatoDetalle rmc in lista) { if (rmc.FkCodMagnitudElec == codInfCanal) { resultado = rmc; break; } } return(resultado); }
public bool Guardar(MC_RPuntoMedicionFormatoDetalle obj) { bool resultado = true; OracleCommand cmd = null; string sql = string.Empty; if (obj.EsNuevo) { Pista p = PistaMgr.Instance.Info("DALSisFalla", obj.GetEstadoString()); obj.SecLog = (long)p.PK_SecLog; obj.PkCodRPtoMedFtoDetalle = GetIdAutoNum("SEC_PK_RMED_CANAL"); 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 " + "{2}=:{2} ," + "{3}=:{3} ," + "{4}=:{4} ," + "{5}=:{5} ," + "{6}=:{6} ," + "{7}=:{7} ," + "{8}=:{8} ," + "{9}=:{9} ," + "{10}=:{10} " + "WHERE {1}=:{1}"; } sql = string.Format(sql, MC_RPuntoMedicionFormatoDetalle.NOMBRE_TABLA, MC_RPuntoMedicionFormatoDetalle.C_PK_RPTO_MED_FTO_DET, MC_RPuntoMedicionFormatoDetalle.C_FK_COD_RPTO_MED_FTO, MC_RPuntoMedicionFormatoDetalle.C_FK_COD_MAGNITUD_ELEC, MC_RPuntoMedicionFormatoDetalle.C_CANAL, MC_RPuntoMedicionFormatoDetalle.C_COL_ARCHIVO, MC_RPuntoMedicionFormatoDetalle.C_KC, MC_RPuntoMedicionFormatoDetalle.C_KCT, MC_RPuntoMedicionFormatoDetalle.C_KPT, MC_RPuntoMedicionFormatoDetalle.C_D_COD_ESTADO, MC_RPuntoMedicionFormatoDetalle.C_SEC_LOG); cmd = CrearCommand(); cmd.CommandText = sql; cmd.BindByName = true; cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_PK_RPTO_MED_FTO_DET, OracleDbType.Int64, obj.PkCodRPtoMedFtoDetalle, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_FK_COD_RPTO_MED_FTO, OracleDbType.Int64, obj.FkCodRPtoMedFto, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_FK_COD_MAGNITUD_ELEC, OracleDbType.Int64, obj.FkCodMagnitudElec, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_CANAL, OracleDbType.Int64, obj.Canal, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_COL_ARCHIVO, OracleDbType.Varchar2, obj.ColArchivo, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_KC, OracleDbType.Double, obj.Kc, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_KCT, OracleDbType.Double, obj.Kct, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_KPT, OracleDbType.Double, obj.Kpt, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_D_COD_ESTADO, OracleDbType.Varchar2, obj.DCodEstado, System.Data.ParameterDirection.Input); cmd.Parameters.Add(MC_RPuntoMedicionFormatoDetalle.C_SEC_LOG, OracleDbType.Int64, obj.SecLog, System.Data.ParameterDirection.Input); try { cmd.ExecuteNonQuery(); obj.EsNuevo = false; } catch (Exception exception) { PistaMgr.Instance.Error("DALSisFalla", exception); resultado = false; } finally { DisposeCommand(cmd); } return(resultado); }