public Boolean AnularDB(ct_centro_costo_sub_centro_costo_Info _Info) { try { using (EntitiesDBConta context = new EntitiesDBConta()) { ct_centro_costo_sub_centro_costo subCentro = context.ct_centro_costo_sub_centro_costo.FirstOrDefault(v => v.IdCentroCosto == _Info.IdCentroCosto && v.IdEmpresa == _Info.IdEmpresa && v.IdCentroCosto_sub_centro_costo == _Info.IdCentroCosto_sub_centro_costo); if (subCentro != null) { subCentro.pc_Estado = "I"; context.SaveChanges(); } } 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }
public Boolean GrabarDB(ct_centro_costo_sub_centro_costo_Info info) { try { using (EntitiesDBConta OECentroCost = new EntitiesDBConta()) { ct_centro_costo_sub_centro_costo subCentro = new ct_centro_costo_sub_centro_costo(); subCentro.IdEmpresa = info.IdEmpresa; subCentro.IdCentroCosto = info.IdCentroCosto; subCentro.IdCentroCosto_sub_centro_costo = info.IdCentroCosto_sub_centro_costo = GetIdSubCentroCosto(info.IdEmpresa); subCentro.cod_subcentroCosto = info.cod_subcentroCosto; subCentro.Centro_costo = info.Centro_costo; subCentro.pc_Estado = info.pc_Estado; subCentro.IdCtaCble = info.IdCtaCble; OECentroCost.ct_centro_costo_sub_centro_costo.Add(subCentro); OECentroCost.SaveChanges(); } 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); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.ToString(); throw new Exception(ex.ToString()); } }