Exemplo n.º 1
0
        /// <summary>
        /// Inserción de registros para ClampPlate
        /// </summary>
        /// <param name="codigo"></param>
        /// <param name="dim_b"></param>
        /// <param name="parte"></param>
        /// <returns></returns>
        public int InsertClampPlate(string codigo, double dim_b, string parte)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                using (var Conexion = new EntitiesTooling())
                {
                    // Declaramos el objeto de la lista
                    TBL_CLAMP_PLATE_THOMPSON_SEGMENTOS Clamp_Plate = new TBL_CLAMP_PLATE_THOMPSON_SEGMENTOS();

                    // Asignamos valores
                    Clamp_Plate.CODIGO = codigo;
                    Clamp_Plate.DIM_B  = dim_b;
                    Clamp_Plate.PARTE  = parte;

                    // Agregamos el objeto a la tabla
                    Conexion.TBL_CLAMP_PLATE_THOMPSON_SEGMENTOS.Add(Clamp_Plate);

                    // Guardamos los cambios
                    Conexion.SaveChanges();

                    // Retornamos el ID
                    return(Clamp_Plate.ID_CLAMP_PLATE);
                }
            }
            catch (Exception)
            {
                // Si hay un error retornamos 0
                return(0);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Actualización de registros ClampPlate
        /// </summary>
        /// <param name="id_clamp_plate"></param>
        /// <param name="codigo"></param>
        /// <param name="dim_b"></param>
        /// <param name="parte"></param>
        /// <returns></returns>
        public int UpdateClampPlate(int id_clamp_plate, string codigo, double dim_b, string parte)
        {
            try
            {
                // Establecemos conexión a través de EntityFramework
                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();

                    // Asignamos valores
                    Clamp_Plate.ID_CLAMP_PLATE = id_clamp_plate;
                    Clamp_Plate.CODIGO         = codigo;
                    Clamp_Plate.DIM_B          = dim_b;
                    Clamp_Plate.PARTE          = parte;

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

                    // Guardamos los cambios
                    return(Conexion.SaveChanges());
                }
            }
            catch (Exception)
            {
                // Si hay error retornamos 0
                return(0);
            }
        }
Exemplo n.º 3
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);
            }
        }