public bool guardarDB(caj_Caja_Movimiento_Tipo_grupo_Info info) { try { using (EntitiesCaja Context = new EntitiesCaja()) { caj_Caja_Movimiento_Tipo_grupo Entity = new caj_Caja_Movimiento_Tipo_grupo(); Entity.IdTipoMovi_grupo = info.IdTipoMovi_grupo = get_id(); Entity.tg_descripcion = info.tg_descripcion; Entity.estado = info.estado = true; Context.caj_Caja_Movimiento_Tipo_grupo.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.InnerException + " " + ex.Message; throw new Exception(ex.ToString()); } }
public bool anularDB(caj_Caja_Movimiento_Tipo_grupo_Info info) { try { using (EntitiesCaja Context = new EntitiesCaja()) { caj_Caja_Movimiento_Tipo_grupo Entity = Context.caj_Caja_Movimiento_Tipo_grupo.FirstOrDefault(q => q.IdTipoMovi_grupo == info.IdTipoMovi_grupo); if (Entity != null) { Entity.estado = info.estado = false; 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.InnerException + " " + ex.Message; throw new Exception(ex.ToString()); } }