public ro_cargo_Info get_info(int IdEmpresa, int IdCargo) { try { ro_cargo_Info info = new ro_cargo_Info(); using (Entities_rrhh Context = new Entities_rrhh()) { ro_cargo Entity = Context.ro_cargo.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdCargo == IdCargo); if (Entity == null) return null; info = new ro_cargo_Info { IdEmpresa = Entity.IdEmpresa, IdCargo = Entity.IdCargo, ca_descripcion = Entity.ca_descripcion, Estado = Entity.Estado, }; } return info; } catch (Exception) { throw; } }
public bool guardarDB(ro_cargo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_cargo Entity = new ro_cargo { IdEmpresa = info.IdEmpresa, IdCargo = info.IdCargo = get_id(info.IdEmpresa), ca_descripcion = info.ca_descripcion, Estado = info.Estado = "A", IdUsuario = info.IdUsuario, Fecha_Transac = info.Fecha_Transac = DateTime.Now }; Context.ro_cargo.Add(Entity); Context.SaveChanges(); } return true; } catch (Exception) { throw; } }
public bool anularDB(ro_cargo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_cargo Entity = Context.ro_cargo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdCargo == info.IdCargo); if (Entity == null) { return(false); } Entity.Estado = info.Estado = "I"; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Entity.Fecha_UltAnu = info.Fecha_UltAnu = DateTime.Now; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean GrabarDB(ro_Cargo_Info InfoCargo, ref int IdCargo, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { ro_cargo address = new ro_cargo(); address.IdCargo = InfoCargo.IdCargo = IdCargo = GetId(InfoCargo.IdEmpresa); address.IdEmpresa = InfoCargo.IdEmpresa; address.IdCargo = IdCargo; address.ca_descripcion = InfoCargo.ca_descripcion; address.IdUsuario = InfoCargo.IdUsuario == null ? "" : InfoCargo.IdUsuario; address.Fecha_Transac = (DateTime)InfoCargo.Fecha_Transac; address.nom_pc = InfoCargo.nom_pc; address.ip = InfoCargo.ip; address.Estado = "A"; address.considera_pago_utilidad = InfoCargo.considera_pago_utilidad; context.ro_cargo.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 modificarDB(ro_cargo_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_cargo Entity = Context.ro_cargo.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdCargo == info.IdCargo); if (Entity == null) return false; Entity.ca_descripcion = info.ca_descripcion; Entity.IdUsuarioUltMod = info.IdUsuarioUltMod; Entity.Fecha_UltMod = info.Fecha_UltMod = DateTime.Now; Context.SaveChanges(); } return true; } catch (Exception) { throw; } }