/// <summary> /// Actualizacion de registros TarjetRoll /// </summary> /// <param name="id_bobinado_target_roll"></param> /// <param name="codigo"></param> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> public int UpdateBobinadoTargetRoll(int id_bobinado_target_roll, string codigo, double a, double b) { 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(); // Establecemos valores tarjet_roll.ID_BOBINADO_TARGET_ROLL = id_bobinado_target_roll; tarjet_roll.CODIGO = codigo; tarjet_roll.A = a; tarjet_roll.B = b; // Actualizamos el registro Conexion.Entry(tarjet_roll).State = System.Data.Entity.EntityState.Modified; // Retornamos registros afectados return(Conexion.SaveChanges()); } } catch (Exception) { // Si hay error retornamos 0 return(0); } }
/// <summary> /// Inserción de registros TarjetRoll /// </summary> /// <param name="codigo"></param> /// <param name="a"></param> /// <param name="b"></param> /// <returns></returns> public int InsertBobinadoTargetRoll(string codigo, double a, double b) { try { // Establecemos conexión a través de EntityFramework using (var Conexion = new EntitiesTooling()) { // Declaramos la lista del objeto TBL_BOBINADO_TARGET_ROLL tarjet_roll = new TBL_BOBINADO_TARGET_ROLL(); // Asignamos los valores tarjet_roll.CODIGO = codigo; tarjet_roll.A = a; tarjet_roll.B = b; // Agregamos el objeto a la tabla Conexion.TBL_BOBINADO_TARGET_ROLL.Add(tarjet_roll); // Guardamos cambios Conexion.SaveChanges(); // Retornamos el ID return(tarjet_roll.ID_BOBINADO_TARGET_ROLL); } } catch (Exception) { // Si hay error 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); } }