/// <summary>
        /// Delete de registros ClosingBandAnillos
        /// </summary>
        /// <param name="idclosingbandanillo"></param>
        /// <returns></returns>
        public int DeleteClosingBandAnillo(int idclosingbandanillo)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    ClosingBandAnillos_ closingbandanillos = Conexion.ClosingBandAnillos_.Where(x => x.ID_ClosingBandAnillo == idclosingbandanillo).FirstOrDefault();

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

                    // Guardamos los cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
        /// <summary>
        /// Eliminar registros CenterWafer
        /// </summary>
        /// <param name="id_bobinado_center_wafer"></param>
        /// <returns></returns>
        public int DeleteBobinadoCenterWafer(int id_bobinado_center_wafer)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_BOBINADO_CENTER_WAFER center_wafer = Conexion.TBL_BOBINADO_CENTER_WAFER.Where(x => x.ID_BOBONADO_CENTER_WAFER == id_bobinado_center_wafer).FirstOrDefault();

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

                    // Retornamos registros afectados
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
        /// <summary>
        /// Eliminar registros Rubber Lapeado
        /// </summary>
        /// <param name="id_rubber_lapeado_segmentos"></param>
        /// <returns></returns>
        public int DeleteRubberLapeado(int id_rubber_lapeado_segmentos)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_RUBBER_LAPEADO_SEGMENTOS Rubber_Lapeado = Conexion.TBL_RUBBER_LAPEADO_SEGMENTOS.Where(x => x.ID_RUBBER_LAPEADO_SEGMENTOS == id_rubber_lapeado_segmentos).FirstOrDefault();

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

                    // Guardamos los cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
        /// <summary>
        /// Eliminar registro Lower_Roll
        /// </summary>
        /// <param name="id_bobinado_lower_roll"></param>
        /// <returns></returns>
        public int DeleteBobinadoLowerRoll(int id_bobinado_lower_roll)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_BOBINADO_LOWER_ROLL lower_roll = Conexion.TBL_BOBINADO_LOWER_ROLL.Where(x => x.ID_BOBINADO_LOWER_ROLL == id_bobinado_lower_roll).FirstOrDefault();

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

                    // Guardamos cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay errror retornamos 0
                return(0);
            }
        }
        /// <summary>
        /// Eliminar registro TarjetLower
        /// </summary>
        /// <param name="id_bobinado_target_roll"></param>
        /// <returns></returns>
        public int DeletedBobinadoTargetRoll(int id_bobinado_target_roll)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_BOBINADO_TARGET_ROLL tarjet_roll = Conexion.TBL_BOBINADO_TARGET_ROLL.Where(x => x.ID_BOBINADO_TARGET_ROLL == id_bobinado_target_roll).FirstOrDefault();

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

                    // Retornamos los registros afectados
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
        /// <summary>
        ///  Delete de registros Discos Thompson
        /// </summary>
        /// <param name="id_disco"></param>
        /// <returns></returns>
        public int DeleteDiscoThompson(int id_disco)
        {
            try
            {
                // Establecemos conexión a través de EntitFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_DISCOS_THOMPSON_SEGMENTOS discos_thompson = Conexion.TBL_DISCOS_THOMPSON_SEGMENTOS.Where(x => x.ID_DISCO == id_disco).FirstOrDefault();

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

                    // Guardamos cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(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);
            }
        }
        /// <summary>
        /// Delete de registros BackUPRing
        /// </summary>
        /// <param name="id_backup_ring"></param>
        /// <returns></returns>
        public int DeleteBackUPRing(int id_backup_ring)
        {
            try
            {
                // Establecemos conexión a través de EntitFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_BACKUP_RING_THOMPSON_SEGMENTOS BackUP_Ring = Conexion.TBL_BACKUP_RING_THOMPSON_SEGMENTOS.Where(x => x.ID_BACKUP_RING == id_backup_ring).FirstOrDefault();

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

                    // Guardamos cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
        /// <summary>
        /// Delete de registros ClampPlate
        /// </summary>
        /// <param name="id_clamp_plate"></param>
        /// <returns></returns>
        public int DeleteClampPlate(int id_clamp_plate)
        {
            try
            {
                // Establecemos conexión a través de EntitFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_CLAMP_PLATE_THOMPSON_SEGMENTOS Clamp_Plate = Conexion.TBL_CLAMP_PLATE_THOMPSON_SEGMENTOS.Where(x => x.ID_CLAMP_PLATE == id_clamp_plate).FirstOrDefault();

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

                    // Guardamos cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
        /// <summary>
        /// Eliminar registros BarrelGradePusher
        /// </summary>
        /// <param name="id_barrel_grade_pusher"></param>
        /// <returns></returns>
        public int DeleteBarrelGradePusher(int id_barrel_grade_pusher)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_BARREL_GRADE_PUSHER grade_pusher = Conexion.TBL_BARREL_GRADE_PUSHER.Where(x => x.ID_BARREL_GRADE_PUSHER == id_barrel_grade_pusher).FirstOrDefault();

                    // Eliminamos el registro de la tabla
                    Conexion.Entry(grade_pusher).State = System.Data.Entity.EntityState.Deleted;

                    // Retornamos registros afectados
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
        /// <summary>
        /// Método que elimina un registro de la tabla CutterSplitter
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DeleteCutter(int id)
        {
            try
            {
                // Se inicializa la conexión a la base de datos.
                using (var Conexion = new EntitiesTooling())
                {
                    //Se obtiene el objeto que se va a eliminar.
                    CutterSplitter obj = Conexion.CutterSplitter.Where(x => x.ID_CUTTER_SPLITTER == id).FirstOrDefault();

                    //eliminamos el registro
                    Conexion.Entry(obj).State = EntityState.Deleted;

                    //Se guardan los cambios y retorna el número de registros afectados.
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                //Si hay error retorna cero
                return(0);
            }
        }
        /// <summary>
        /// Inserción de registros para LowerRoll
        /// </summary>
        /// <param name="codigo"></param>
        /// <param name="detalle_rodillo"></param>
        /// <param name="detalle_engrane"></param>
        /// <param name="wire_width_min"></param>
        /// <param name="wire_width_max"></param>
        /// <param name="dia_min"></param>
        /// <param name="dia_max"></param>
        /// <param name="side_plate_dia"></param>
        /// <returns></returns>
        public int InsertBobinadoLowerRoll(string codigo, string detalle_rodillo, string detalle_engrane, double wire_width_min, double wire_width_max, double dia_min, double dia_max, double side_plate_dia)
        {
            try
            {
                // Realizamos la conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_BOBINADO_LOWER_ROLL lower_roll = new TBL_BOBINADO_LOWER_ROLL();

                    // Asignamos valores
                    lower_roll.CODIGO          = codigo;
                    lower_roll.DETALLE_RODILLO = detalle_rodillo;
                    lower_roll.DETALLE_ENGRANE = detalle_engrane;
                    lower_roll.WIRE_WIDTH_MIN  = wire_width_min;
                    lower_roll.WIRE_WIDTH_MAX  = wire_width_max;
                    lower_roll.DIA_MIN         = dia_min;
                    lower_roll.DIA_MAX         = dia_max;
                    lower_roll.SIDE_PLATE_DIA  = side_plate_dia;

                    // Agregamos el objeto en la lista
                    Conexion.TBL_BOBINADO_LOWER_ROLL.Add(lower_roll);

                    // Guardamos cambios
                    Conexion.SaveChanges();

                    // Retornamos el ID
                    return(lower_roll.ID_BOBINADO_LOWER_ROLL);
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }