public Boolean GrabarDB(ro_empleado_x_titulos_Info Info, ref string msg) { try { using (EntitiesRoles Context = new EntitiesRoles()) { var Address = new ro_empleado_x_titulos(); int idtitulo = getId(Info.IdEmpresa, Info.IdEmpleado); Address.IdEmpresa = Info.IdEmpresa; Address.IdEmpleado = Info.IdEmpleado; Address.Secuencia = idtitulo; Address.fecha = Info.fecha; Address.IdInstitucion = Info.IdInstitucion; Address.IdTitulo = Info.IdTitulo; Address.Observacion = Info.Observacion; Context.ro_empleado_x_titulos.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 guardarDB(ro_empleado_x_titulos_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_empleado_x_titulos Entity = new ro_empleado_x_titulos { IdEmpresa = info.IdEmpresa, IdEmpleado = info.IdEmpleado, Secuencia = get_id(info.IdEmpresa, info.IdEmpleado), IdInstitucion = info.IdInstitucion, IdTitulo = info.IdTitulo, fecha = info.fecha, Observacion = info.Observacion, estado = "A", IdUsuario = info.IdUsuario, Fecha_Transac = DateTime.Now }; Context.ro_empleado_x_titulos.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public ro_empleado_x_titulos_Info get_info(int IdEmpresa, decimal IdEmpleado, int Secuencia) { try { ro_empleado_x_titulos_Info info = new ro_empleado_x_titulos_Info(); using (Entities_rrhh Context = new Entities_rrhh()) { ro_empleado_x_titulos Entity = Context.ro_empleado_x_titulos.FirstOrDefault(q => q.IdEmpresa == IdEmpresa && q.IdEmpleado == IdEmpleado && q.Secuencia == Secuencia); if (Entity == null) { return(null); } info = new ro_empleado_x_titulos_Info { IdEmpresa = Entity.IdEmpresa, IdEmpleado = Entity.IdEmpleado, IdInstitucion = Entity.IdInstitucion, IdTitulo = Entity.IdTitulo, Secuencia = Entity.Secuencia, fecha = Entity.fecha, Observacion = Entity.Observacion }; } return(info); } catch (Exception) { throw; } }
public bool modificarDB(ro_empleado_x_titulos_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_empleado_x_titulos Entity = Context.ro_empleado_x_titulos.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdEmpleado == info.IdEmpleado && q.Secuencia == info.Secuencia); if (Entity == null) { return(false); } Entity.IdInstitucion = info.IdInstitucion; Entity.IdTitulo = info.IdTitulo; Entity.Observacion = info.Observacion; Entity.fecha = info.fecha; Entity.Fecha_UltMod = DateTime.Now; Entity.IdUsuarioUltMod = info.IdUsuarioUltMod; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool anularDB(ro_empleado_x_titulos_Info info) { try { using (Entities_rrhh Context = new Entities_rrhh()) { ro_empleado_x_titulos Entity = Context.ro_empleado_x_titulos.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdEmpleado == info.IdEmpleado && q.Secuencia == info.Secuencia); if (Entity == null) { return(false); } Entity.estado = "I"; Entity.Fecha_UltAnu = DateTime.Now; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }