public bool Guardar_DB(ro_empleado_x_Activo_Fijo_Info info) { try { using (EntityRoles_FJ db = new EntityRoles_FJ()) { ro_empleado_x_Activo_Fijo add = new ro_empleado_x_Activo_Fijo(); add.IdEmpresa = info.IdEmpresa; add.IdNomina_tipo = info.IdNomina_tipo; add.IdPeriodo = info.IdPeriodo; add.IdActivo_fijo = info.IdActivo_fijo; add.IdEmpleado = info.IdEmpleado; add.Fecha_Asignacion = info.Fecha_Asignacion; add.Fecha_Hasta = info.Fecha_Hasta; db.ro_empleado_x_Activo_Fijo.Add(add); db.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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public bool si_existe(int IdEmpresa, decimal IdEmpleado, decimal IdActivoFijo) { try { ro_empleado_x_Activo_Fijo_Info info = new ro_empleado_x_Activo_Fijo_Info(); using (EntityRoles_FJ db = new EntityRoles_FJ()) { var query = from q in db.vwro_ro_empleado_x_Activo_Fijo where q.IdEmpresa == IdEmpresa && q.IdActivo_fijo == IdActivoFijo && q.IdEmpleado == IdEmpleado select q; if (query.Count() > 0) { return(true); } else { return(false); } } } 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public bool Guardar_DB(ro_empleado_x_Activo_Fijo_Info info) { try { bool bandera = true; data.ModificarDB(info); bandera = data.Guardar_DB(info); if (bandera) { bandera = bus_centro_costo_empleado.GrabarBD(info.Info_Centro_costo_x_empleado); } if (!bandera) { } return(bandera); } catch (Exception ex) { mensaje = ex.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(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
void ucRo_Empleado1_event_cmbEmpleado_EditValueChanged(object sender, EventArgs e) { try { info_empleado = ucRo_Empleado1.get_EmpleadoInfo(); txt_cargo.EditValue = info_empleado.cargo_Descripcion; info_activo_fijo = bus_Activo_fijo.Get_Info(param.IdEmpresa, Convert.ToInt32(info_empleado.IdEmpleado)); txt_equipo.Text = info_activo_fijo.Af_Nombre; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public List <ro_empleado_x_Activo_Fijo_Info> listado_emp_x_af(int IdEmpresa) { try { List <ro_empleado_x_Activo_Fijo_Info> lista = new List <ro_empleado_x_Activo_Fijo_Info>(); using (EntityRoles_FJ db = new EntityRoles_FJ()) { var query = from q in db.vwro_ro_empleado_x_Activo_Fijo where q.IdEmpresa == IdEmpresa select q; foreach (var item in query) { ro_empleado_x_Activo_Fijo_Info info = new ro_empleado_x_Activo_Fijo_Info(); info.IdEmpresa = item.IdEmpresa; info.IdActivo_fijo = item.IdActivo_fijo; info.IdPeriodo = item.IdPeriodo; info.IdNomina_tipo = item.IdNomina_tipo; info.IdEmpleado = item.IdEmpleado; info.Fecha_Asignacion = Convert.ToDateTime(item.Fecha_Asignacion); info.Fecha_Hasta = Convert.ToDateTime(item.Fecha_Hasta); info.pe_nombre = item.pe_nombreCompleto; info.pe_cedulaRuc = item.pe_cedulaRuc; info.de_descripcion = item.de_descripcion; info.Descripcion = item.Descripcion; info.check = true; info.Af_Nombre = item.Af_Nombre; info.Af_DescripcionCorta = item.Af_DescripcionCorta; info.IdCentroCosto = item.IdCentroCosto; info.IdCentroCosto_sub_centro_costo = item.IdCentroCosto_sub_centro_costo; lista.Add(info); } } return(lista); } 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 MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public Boolean ModificarDB(ro_empleado_x_Activo_Fijo_Info info) { try { using (EntityRoles_FJ db = new EntityRoles_FJ()) { string sql = " delete Fj_servindustrias.ro_empleado_x_Activo_Fijo where IdEmpresa='" + info.IdEmpresa + "' and IdEmpleado='" + info.IdEmpleado + "'"; db.Database.ExecuteSqlCommand(sql); } return(true); } catch (Exception ex) { throw new Exception(ex.InnerException.ToString()); } }