public ro_catalogo_Info get_info(int IdTipoCatalogo, int IdCatalogo) { try { ro_catalogo_Info info = new ro_catalogo_Info(); using (Entities_rrhh Context = new Entities_rrhh()) { ro_catalogo Entity = Context.ro_catalogo.FirstOrDefault(q => q.IdTipoCatalogo == IdTipoCatalogo && q.IdCatalogo == IdCatalogo); if (Entity == null) { return(null); } info = new ro_catalogo_Info { CodCatalogo = Entity.CodCatalogo, IdCatalogo = Entity.IdCatalogo, ca_descripcion = Entity.ca_descripcion, IdTipoCatalogo = Entity.IdTipoCatalogo, ca_estado = Entity.ca_estado, ca_orden = Entity.ca_orden }; } return(info); } catch (Exception) { throw; } }
public bool guardarDB(ro_catalogo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_catalogo Entity = new ro_catalogo(); { Entity.CodCatalogo = info.CodCatalogo; Entity.IdCatalogo = get_id(info.IdTipoCatalogo); Entity.ca_descripcion = info.ca_descripcion; Entity.IdTipoCatalogo = info.IdTipoCatalogo; Entity.ca_estado = "A"; Entity.ca_orden = info.ca_orden; Entity.Fecha_Transac = info.Fecha_Transac; Entity.IdUsuario = info.IdUsuario; }; Context.ro_catalogo.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean GuardarDB(ref ro_Catalogo_Info Info) { try { List <ro_Catalogo_Info> Lst = new List <ro_Catalogo_Info>(); using (EntitiesRoles Context = new EntitiesRoles()) { var Address = new ro_catalogo(); Address.IdCatalogo = Info.IdCatalogo = getId(); Address.IdTipoCatalogo = Info.IdTipoCatalogo; if (Info.CodCatalogo == "" || Info.CodCatalogo == null) { Address.CodCatalogo = Info.IdCatalogo.ToString(); } else { Address.CodCatalogo = Info.CodCatalogo; } Address.ca_descripcion = Info.ca_descripcion; Address.ca_estado = "A"; Address.ca_orden = Info.ca_orden; Context.ro_catalogo.Add(Address); 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); mensaje = ex.InnerException + " " + ex.Message; oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(ex.InnerException.ToString()); } }
public bool anularDB(ro_catalogo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_catalogo Entity = Context.ro_catalogo.FirstOrDefault(q => q.IdTipoCatalogo == info.IdTipoCatalogo && q.IdCatalogo == info.IdCatalogo); if (Entity == null) { return(false); } Entity.ca_estado = "I"; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Entity.Fecha_UltAnu = info.Fecha_UltAnu; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool modificarDB(ro_catalogo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_catalogo Entity = Context.ro_catalogo.FirstOrDefault(q => q.IdTipoCatalogo == info.IdTipoCatalogo && q.IdCatalogo == info.IdCatalogo); if (Entity == null) { return(false); } Entity.ca_descripcion = info.ca_descripcion; Entity.Fecha_UltMod = info.Fecha_UltMod; Entity.IdUsuarioUltMod = info.IdUsuarioUltMod; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }