示例#1
0
        /// <summary>
        /// Actualización de registros Bushing Thompson
        /// </summary>
        /// <param name="id_bushing"></param>
        /// <param name="codigo"></param>
        /// <param name="dim_a"></param>
        /// <returns></returns>
        public int UpdateBushingThompson(int id_bushing, 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_BUSHING_THOMPSON_SEGMENTOS bushing_thompson = Conexion.TBL_BUSHING_THOMPSON_SEGMENTOS.Where(x => x.ID_BUSHING_THOMPSON == id_bushing).FirstOrDefault();

                    // Asignamos valores
                    bushing_thompson.ID_BUSHING_THOMPSON = id_bushing;
                    bushing_thompson.CODIGO = codigo;
                    bushing_thompson.DIM_A  = dim_a;

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

                    // Guardamos losd cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
示例#2
0
        /// <summary>
        /// Inserción de registros para Bushing Thompson
        /// </summary>
        /// <param name="codigo"></param>
        /// <param name="dim_a"></param>
        /// <returns></returns>
        public int InsertBushingThompson(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_BUSHING_THOMPSON_SEGMENTOS bushing_thompson = new TBL_BUSHING_THOMPSON_SEGMENTOS();

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

                    // Agregamos el objeto a la tabla
                    Conexion.TBL_BUSHING_THOMPSON_SEGMENTOS.Add(bushing_thompson);

                    // Guardamos los datos
                    Conexion.SaveChanges();

                    // Retornamos el ID del objeto insertado
                    return(bushing_thompson.ID_BUSHING_THOMPSON);
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
示例#3
0
        /// <summary>
        /// Delete de registros Bushing Thompson
        /// </summary>
        /// <param name="id_bushing"></param>
        /// <returns></returns>
        public int DeleteBushingThompson(int id_bushing)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_BUSHING_THOMPSON_SEGMENTOS bushing_thompson = Conexion.TBL_BUSHING_THOMPSON_SEGMENTOS.Where(x => x.ID_BUSHING_THOMPSON == id_bushing).FirstOrDefault();

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

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