public bool modificarDB(in_Ing_Egr_Inven_fj_Info info) { try { using (EntitiesInventario_Fj Context = new EntitiesInventario_Fj()) { in_Ing_Egr_Inven_fj Entity = Context.in_Ing_Egr_Inven_fj.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdSucursal == info.IdSucursal && q.IdMovi_inven_tipo == info.IdMovi_inven_tipo && q.IdNumMovi == info.IdNumMovi); if (Entity != null) { Entity.cod_orden_mantenimiento = info.cod_orden_mantenimiento; Entity.IdEmpleado = info.IdEmpleado; Context.SaveChanges(); } else { guardarDB(info); } } return(true); } catch (Exception ex) { string mensaje = ""; 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public bool guardarDB(in_Ing_Egr_Inven_fj_Info info) { try { using (EntitiesInventario_Fj Context = new EntitiesInventario_Fj()) { in_Ing_Egr_Inven_fj Entity = new in_Ing_Egr_Inven_fj(); Entity.IdEmpresa = info.IdEmpresa; Entity.IdSucursal = info.IdSucursal; Entity.IdMovi_inven_tipo = info.IdMovi_inven_tipo; Entity.IdNumMovi = info.IdNumMovi; Entity.cod_orden_mantenimiento = info.cod_orden_mantenimiento; Entity.IdEmpleado = info.IdEmpleado; Context.in_Ing_Egr_Inven_fj.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception ex) { string mensaje = ""; 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }