Exemplo n.º 1
0
        /// <summary>
        /// Actualización de registros TuboEnrollador
        /// </summary>
        /// <param name="id_tubo_enrollador"></param>
        /// <param name="codigo"></param>
        /// <param name="dim_a"></param>
        /// <returns></returns>
        public int UpdateTuboEnrollador(int id_tubo_enrollador, string codigo, double dim_a)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_TUBO_ENROLLADOR_THOMPSON_SEGMENTOS Tubo_Enrollador = Conexion.TBL_TUBO_ENROLLADOR_THOMPSON_SEGMENTOS.Where(x => x.ID_TUBO_ENROLLADOR == id_tubo_enrollador).FirstOrDefault();

                    // Asignamos valores
                    Tubo_Enrollador.ID_TUBO_ENROLLADOR = id_tubo_enrollador;
                    Tubo_Enrollador.CODIGO             = codigo;
                    Tubo_Enrollador.DIM_A = dim_a;

                    // Modificamos el registro
                    Conexion.Entry(Tubo_Enrollador).State = System.Data.Entity.EntityState.Modified;

                    // Guardamos los cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Inserción de registros para TuboEnrollador
        /// </summary>
        /// <param name="codigo"></param>
        /// <param name="dim_a"></param>
        /// <returns></returns>
        public int InsertTuboEnrollador(string codigo, double dim_a)
        {
            try
            {
                // Realizamos la conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_TUBO_ENROLLADOR_THOMPSON_SEGMENTOS Tubo_Enrollador = new TBL_TUBO_ENROLLADOR_THOMPSON_SEGMENTOS();

                    // Asignamos valores
                    Tubo_Enrollador.CODIGO = codigo;
                    Tubo_Enrollador.DIM_A  = dim_a;

                    // Agregamos el objeto a la tabla
                    Conexion.TBL_TUBO_ENROLLADOR_THOMPSON_SEGMENTOS.Add(Tubo_Enrollador);

                    // Guardamos los cambios
                    Conexion.SaveChanges();

                    // Retornamos el ID
                    return(Tubo_Enrollador.ID_TUBO_ENROLLADOR);
                }
            }
            catch (Exception)
            {
                // Si hay un error retornamos 0
                return(0);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Delete de registros TuboEnrollador
        /// </summary>
        /// <param name="id_tubo_enrollador"></param>
        /// <returns></returns>
        public int DeleteTuboEnrollador(int id_tubo_enrollador)
        {
            try
            {
                // Establecemos conexión a través de EntitFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_TUBO_ENROLLADOR_THOMPSON_SEGMENTOS Tubo_Enrollador = Conexion.TBL_TUBO_ENROLLADOR_THOMPSON_SEGMENTOS.Where(x => x.ID_TUBO_ENROLLADOR == id_tubo_enrollador).FirstOrDefault();

                    // Eliminamos el registro
                    Conexion.Entry(Tubo_Enrollador).State = System.Data.Entity.EntityState.Deleted;

                    // Guardamos cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }