Exemplo n.º 1
0
        /// <summary>
        /// Actualizar registros Rubber Lapeado
        /// </summary>
        /// <param name="id_rubber_lapeado_segmentos"></param>
        /// <param name="codigo"></param>
        /// <param name="dim_a"></param>
        /// <param name="plano"></param>
        /// <returns></returns>
        public int UpdateRubberLapeado(int id_rubber_lapeado_segmentos, string codigo, double dim_a, string plano)
        {
            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();

                    // Asignamos valores
                    Rubber_Lapeado.ID_RUBBER_LAPEADO_SEGMENTOS = id_rubber_lapeado_segmentos;
                    Rubber_Lapeado.CODIGO = codigo;
                    Rubber_Lapeado.DIM_A  = dim_a;
                    Rubber_Lapeado.PLANO  = plano;

                    // Modificamos el registro
                    Conexion.Entry(Rubber_Lapeado).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 Rubber Lapeado
        /// </summary>
        /// <param name="codigo"></param>
        /// <param name="dim_a"></param>
        /// <param name="plano"></param>
        /// <returns></returns>
        public int InsertRubberLapeado(string codigo, double dim_a, string plano)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Delcaramos el objeto de la lista
                    TBL_RUBBER_LAPEADO_SEGMENTOS Rubber_Lapeado = new TBL_RUBBER_LAPEADO_SEGMENTOS();

                    // Asignamos los valores
                    Rubber_Lapeado.CODIGO = codigo;
                    Rubber_Lapeado.DIM_A  = dim_a;
                    Rubber_Lapeado.PLANO  = plano;

                    // Agregamos el objeto a la tabla
                    Conexion.TBL_RUBBER_LAPEADO_SEGMENTOS.Add(Rubber_Lapeado);

                    // Guardamos los cambios
                    Conexion.SaveChanges();

                    // Retornamos el ID del objeto
                    return(Rubber_Lapeado.ID_RUBBER_LAPEADO_SEGMENTOS);
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
Exemplo n.º 3
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);
            }
        }