public Boolean AnularDB(Af_Activo_fijo_x_ct_centro_costo_sub_centro_costo_Info info) { try { using (EntitiesActivoFijo_FJ Context = new EntitiesActivoFijo_FJ()) { Af_Activo_fijo_x_ct_centro_costo_sub_centro_costo Entity = Context.Af_Activo_fijo_x_ct_centro_costo_sub_centro_costo.FirstOrDefault(q => q.IdActivoFijo_AF == info.IdActivoFijo_AF && q.IdEmpresa_AF == info.IdEmpresa_AF && q.Estado == true); if (Entity != null) { Entity.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.InnerException.ToString()); } }
public Boolean GuardarDB(Af_Activo_fijo_x_ct_centro_costo_sub_centro_costo_Info info) { try { using (EntitiesActivoFijo_FJ Context = new EntitiesActivoFijo_FJ()) { Af_Activo_fijo_x_ct_centro_costo_sub_centro_costo Entity = new Af_Activo_fijo_x_ct_centro_costo_sub_centro_costo(); Entity.IdEmpresa_AF = info.IdEmpresa_AF; Entity.IdActivoFijo_AF = info.IdActivoFijo_AF; Entity.IdEmpresa_Scc = info.IdEmpresa_Scc; Entity.IdCentroCosto_Scc = info.IdCentroCosto_Scc; Entity.IdCentroCosto_sub_centro_costo_Scc = info.IdCentroCosto_sub_centro_costo_Scc; Entity.Estado = true; Context.Af_Activo_fijo_x_ct_centro_costo_sub_centro_costo.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.InnerException.ToString()); } }