public Boolean Borrar(int IdEmpresa, int IdModeloProduccion, Decimal IdProducto)
 {
     try
     {
         using (EntitiesProduccion context = new EntitiesProduccion())
         {
             var contact = context.prod_ModeloProduccion_x_Producto_CusTal.First(obj => obj.IdEmpresa == IdEmpresa && obj.IdModeloProd == IdModeloProduccion && obj.IdProducto == IdProducto);
             context.prod_ModeloProduccion_x_Producto_CusTal.Remove(contact);
             context.SaveChanges();
             context.Dispose();
         }
         return(true);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
         mensaje = ex.ToString() + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.ToString());
     }
 }
Пример #2
0
        public Boolean GuardarDB(List <prod_GestionProductivaLaminado_x_paradas_CusTalme_Info> LST, ref string mensaje)
        {
            try
            {
                int c = 1;
                foreach (var item in LST)
                {
                    using (EntitiesProduccion Context = new EntitiesProduccion())
                    {
                        var Address = new prod_GestionProductivaLaminado_x_paradas_CusTalme();
                        Address.causa               = item.causa;
                        Address.Descripcion         = item.Descripcion;
                        Address.HoraFin             = item.HoraFin;
                        Address.HoraIni             = item.HoraIni;
                        Address.IdEmpresa           = item.IdEmpresa;
                        Address.IdGestionProductiva = item.IdGestionProductiva;
                        Address.IdTipoParada        = item.IdTipoParada;
                        Address.Secuencia           = c;
                        c++;

                        Context.prod_GestionProductivaLaminado_x_paradas_CusTalme.Add(Address);
                        Context.SaveChanges();
                        Context.Dispose();
                    }
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "", "", "", "", "", DateTime.Now);
                mensaje = ex.ToString() + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.ToString());
            }
        }