Exemplo n.º 1
0
        public List <TiposMedidores> TiposMedidoresGetAll()
        {
            List <TiposMedidores> lstTiposMedidores = new List <TiposMedidores>();

            try
            {
                ds = new DataSet();
                Conexion         oConexion = new Conexion();
                OracleConnection cn        = oConexion.getConexion();
                cn.Open();
                string sqlSelect = "select * from Tipos_Medidores ";
                cmd     = new OracleCommand(sqlSelect, cn);
                adapter = new OracleDataAdapter(cmd);
                cmd.ExecuteNonQuery();
                adapter.Fill(ds);
                DataTable dt = new DataTable();
                dt = ds.Tables[0];
                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; dt.Rows.Count > i; i++)
                    {
                        DataRow        dr     = dt.Rows[i];
                        TiposMedidores NewEnt = new TiposMedidores();
                        NewEnt = CargarTiposMedidores(dr);
                        lstTiposMedidores.Add(NewEnt);
                    }
                }
                return(lstTiposMedidores);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
 public bool TiposMedidoresUpdate(TiposMedidores oTMe)
 {
     try
     {
         Conexion         oConexion = new Conexion();
         OracleConnection cn        = oConexion.getConexion();
         cn.Open();
         ds  = new DataSet();
         cmd = new OracleCommand("update Tipos_Medidores " +
                                 "SET TME_DESCRIPCION='" + oTMe.TmeDescripcion + "', " +
                                 "TME_DESCRIPCION_CORTA='" + oTMe.TmeDescripcionCorta + "', " +
                                 "TME_FECHA_CARGA='" + oTMe.TmeFechaCarga.ToShortDateString() + "', " +
                                 "SRV_CODIGO='" + oTMe.SrvCodigo + "', " +
                                 "USR_NUMERO=" + oTMe.UsrNumero + ", " +
                                 "EST_CODIGO='" + oTMe.EstCodigo + "' " +
                                 "WHERE TME_CODIGO=" + oTMe.TmeCodigo, cn);
         adapter  = new OracleDataAdapter(cmd);
         response = cmd.ExecuteNonQuery();
         cn.Close();
         return(response > 0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public TiposMedidores TiposMedidoresGetById(string Id)
 {
     try
     {
         DataSet          ds        = new DataSet();
         Conexion         oConexion = new Conexion();
         OracleConnection cn        = oConexion.getConexion();
         cn.Open();
         string sqlSelect = "select * from Tipos_Medidores " +
                            "WHERE TME_CODIGO='" + Id + "'";
         cmd     = new OracleCommand(sqlSelect, cn);
         adapter = new OracleDataAdapter(cmd);
         cmd.ExecuteNonQuery();
         adapter.Fill(ds);
         DataTable dt;
         dt = ds.Tables[0];
         TiposMedidores NewEnt = new TiposMedidores();
         if (dt.Rows.Count > 0)
         {
             DataRow dr = dt.Rows[0];
             NewEnt = CargarTiposMedidores(dr);
         }
         return(NewEnt);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public bool EliminarMedidor(long idMedidor)
        {
            TiposMedidoresBus oSMeBus = new TiposMedidoresBus();
            TiposMedidores    oSMe    = oSMeBus.TiposMedidoresGetById(idMedidor.ToString());

            oSMe.EstCodigo = "B";
            return(oSMeBus.TiposMedidoresUpdate(oSMe));
        }
Exemplo n.º 5
0
        public int TiposMedidoresAdd(TiposMedidores oTMe)
        {
            try
            {
                Conexion         oConexion = new Conexion();
                OracleConnection cn        = oConexion.getConexion();
                cn.Open();
                ds = new DataSet();

                string query = " DECLARE IDTEMP NUMBER(10,0); " +
                               " BEGIN " +
                               " SELECT(PKG_SECUENCIAS.FNC_PROX_SECUENCIA('TME_CODIGO')) into IDTEMP from dual; " +
                               "insert into Tipos_Medidores(TME_CODIGO, TME_DESCRIPCION, " +
                               "TME_DESCRIPCION_CORTA, TME_FECHA_CARGA, SRV_CODIGO,EST_CODIGO, USR_NUMERO) " +
                               "values(IDTEMP,'" + oTMe.TmeDescripcion + "','" + oTMe.TmeDescripcionCorta + "','" +
                               oTMe.TmeFechaCarga.ToShortDateString() + "','" + oTMe.SrvCodigo + "','" + oTMe.EstCodigo + "'," + oTMe.UsrNumero + ")" + "RETURNING IDTEMP INTO :id;END;";



                /*
                 *              cmd = new OracleCommand("insert into Tipos_Medidores(TME_CODIGO, TME_DESCRIPCION, " +
                 *                      "TME_DESCRIPCION_CORTA, TME_FECHA_CARGA, SRV_CODIGO,EST_CODIGO, USR_NUMERO) " +
                 *                      "values('" + oTMe.TmeCodigo + "','" + oTMe.TmeDescripcion + "','" + oTMe.TmeDescripcionCorta + "','" +
                 *                      oTMe.TmeFechaCarga.ToShortDateString() + "','" + oTMe.SrvCodigo + "','"+oTMe.EstCodigo +"',"+ oTMe.UsrNumero + ")", cn);*/
                cmd     = new OracleCommand(query, cn);
                adapter = new OracleDataAdapter(cmd);
                cmd.Parameters.Add(new OracleParameter
                {
                    ParameterName = ":id",
                    OracleDbType  = OracleDbType.Int64,
                    Direction     = ParameterDirection.Output
                });
                adapter = new OracleDataAdapter(cmd);
                cmd.ExecuteNonQuery();
                response = int.Parse(cmd.Parameters[":id"].Value.ToString());
                cn.Close();
                return(response);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
 private TiposMedidores CargarTiposMedidores(DataRow dr)
 {
     try
     {
         TiposMedidores oObjeto = new TiposMedidores();
         oObjeto.TmeCodigo           = long.Parse(dr["TME_CODIGO"].ToString());
         oObjeto.TmeDescripcion      = dr["TME_DESCRIPCION"].ToString();
         oObjeto.TmeDescripcionCorta = dr["TME_DESCRIPCION_CORTA"].ToString();
         if (dr["TME_FECHA_CARGA"].ToString() != "")
         {
             oObjeto.TmeFechaCarga = DateTime.Parse(dr["TME_FECHA_CARGA"].ToString());
         }
         oObjeto.SrvCodigo = dr["SRV_CODIGO"].ToString();
         oObjeto.UsrNumero = int.Parse(dr["USR_NUMERO"].ToString());
         return(oObjeto);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public void Guardar()
        {
            long              rtdo;
            TiposMedidores    oSMedidor = new TiposMedidores();
            TiposMedidoresBus oSMeBus   = new TiposMedidoresBus();

            oSMedidor.UsrNumero           = _vista.usrNumero;
            oSMedidor.TmeDescripcion      = _vista.tmeDescripcion;
            oSMedidor.TmeDescripcionCorta = _vista.tmeDescripcionCorta;
            oSMedidor.SrvCodigo           = _vista.srvCodigo.SelectedValue.ToString();
            oSMedidor.TmeFechaCarga       = _vista.tmeFechaCarga;
            oSMedidor.TmeCodigo           = _vista.tmeCodigo;
            oSMedidor.EstCodigo           = _vista.estCodigo;

            if (_vista.tmeCodigo == 0)
            {
                rtdo = oSMeBus.TiposMedidoresAdd(oSMedidor);
            }
            else
            {
                oSMeBus.TiposMedidoresUpdate(oSMedidor);
            }
        }
        public void Inicializar()
        {
            ServiciosBus oServiciosBus = new ServiciosBus();

            _vista.srvCodigo.DataSource    = oServiciosBus.ServiciosGetAll();
            _vista.srvCodigo.DisplayMember = "SrvDescripcion";
            _vista.srvCodigo.ValueMember   = "SrvCodigo";

            if (_vista.tmeCodigo != 0)
            {
                TiposMedidores    oSMedidor    = new TiposMedidores();
                TiposMedidoresBus oSMedidorBus = new TiposMedidoresBus();

                oSMedidor        = oSMedidorBus.TiposMedidoresGetById(_vista.tmeCodigo.ToString());
                _vista.tmeCodigo = oSMedidor.TmeCodigo;
                _vista.srvCodigo.SelectedValue = oSMedidor.SrvCodigo;
                _vista.tmeDescripcion          = oSMedidor.TmeDescripcion;
                _vista.tmeDescripcionCorta     = oSMedidor.TmeDescripcionCorta;
                _vista.tmeFechaCarga           = oSMedidor.TmeFechaCarga;
                _vista.usrNumero = oSMedidor.UsrNumero;
                _vista.estCodigo = oSMedidor.EstCodigo;
            }
        }
Exemplo n.º 9
0
        public TiposMedidores LlenaComboTipoMedidores()
        {
            TiposMedidores        campos             = new TiposMedidores();
            DataTable             dt                 = new DataTable();
            List <CamposTiposMed> ListaCamposTipoMed = new List <CamposTiposMed>();


            SqlConnection connection = null;

            try
            {
                using (connection = Conexion.ObtieneConexion("ConexionBD"))
                {
                    SqlDataReader consulta;
                    connection.Open();
                    consulta = Ejecuta.ConsultaConRetorno(connection, "[Usp_ComboTipoMedidor]");
                    dt.Load(consulta);
                    connection.Close();
                }


                foreach (DataRow row in dt.Rows)
                {
                    CamposTiposMed reg = new CamposTiposMed();
                    reg.IdTipoMedidor = Convert.ToInt32(row["IdTipoMedidor"].ToString());
                    reg.Nombre        = row["Nombre"].ToString();
                    ListaCamposTipoMed.Add(reg);
                }
                campos.ListaRegTiposMed = ListaCamposTipoMed.ToArray();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            return(campos);
        }
Exemplo n.º 10
0
        public bool TiposMedidoresUpdate(TiposMedidores oTiposMedidores)
        {
            TiposMedidoresImpl oTiposMedidoresImpl = new TiposMedidoresImpl();

            return(oTiposMedidoresImpl.TiposMedidoresUpdate(oTiposMedidores));
        }
Exemplo n.º 11
0
        public int TiposMedidoresAdd(TiposMedidores oTiposMedidores)
        {
            TiposMedidoresImpl oTiposMedidoresImpl = new TiposMedidoresImpl();

            return(oTiposMedidoresImpl.TiposMedidoresAdd(oTiposMedidores));
        }