public Boolean EliminarDB(ro_Novedad_x_Empleado_Info info, ref string msg) { try { using (EntitiesRoles db = new EntitiesRoles()) { var registro = db.ro_novedad_x_empleado.First(a => a.IdEmpresa == info.IdEmpresa && a.IdTransaccion == info.IdTransaccion && a.IdEmpresa_Emp_Novedad == info.IdEmpresa_Emp_Novedad && a.IdNovedad_Emp_Novedad == info.IdNovedad_Emp_Novedad && a.IdEmpleado_Emp_Novedad == info.IdEmpleado_Emp_Novedad); registro.estado = "I"; db.SaveChanges(); msg = "Se ha procedido anular el registro del Cargo #: " + info.IdTransaccion.ToString() + " exitosamente"; } return(true); } catch (Exception ex) { string array = 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(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean BorrarDB(ro_Novedad_x_Empleado_Info info, ref string msg) { try { using (EntitiesRoles context = new EntitiesRoles()) { var S = context.Database.ExecuteSqlCommand("delete from dbo.ro_novedad_x_empleado where IdEmpresa =" + info.IdEmpresa.ToString() + " AND IdTransaccion=" + info.IdTransaccion.ToString() + " AND IdEmpresa_Emp_Novedad=" + info.IdEmpresa_Emp_Novedad.ToString() + " AND IdNovedad_Emp_Novedad=" + info.IdNovedad_Emp_Novedad.ToString() + " AND IdEmpleado_Emp_Novedad=" + info.IdEmpleado_Emp_Novedad.ToString() ); } return(true); } catch (Exception ex) { string array = 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(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean GrabarDB(ro_Novedad_x_Empleado_Info info, decimal id, ref string msg) { try{ using (EntitiesRoles db = new EntitiesRoles()){ var address = new ro_novedad_x_empleado(); address.IdTransaccion = info.IdTransaccion = id; address.IdEmpresa = info.IdEmpresa; address.IdEmpresa_Emp_Novedad = info.IdEmpresa_Emp_Novedad; address.IdNovedad_Emp_Novedad = info.IdNovedad_Emp_Novedad; address.IdEmpleado_Emp_Novedad = info.IdEmpleado_Emp_Novedad; address.Observacion = info.Observacion; address.Fecha = info.Fecha; address.IdNomina_Tipo = info.IdNomina_Tipo; address.IdNomina_TipoLiqui = info.IdNomina_TipoLiqui; address.IdRubro = info.IdRubro; address.estado = (info.estado == null) ? "A" : info.estado; db.ro_novedad_x_empleado.Add(address); db.SaveChanges(); } return(true); }catch (Exception ex) { string array = 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(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public ro_Novedad_x_Empleado_Info Get_Info_Novedad_x_Empleado_x_IdTransaccion(int idEmpresa, decimal id) { ro_Novedad_x_Empleado_Info reg = new ro_Novedad_x_Empleado_Info(); try { using (EntitiesRoles db = new EntitiesRoles()) { var datos = (from a in db.ro_novedad_x_empleado where a.IdEmpresa == idEmpresa && a.IdTransaccion == id select a); foreach (var item in datos) { reg.IdEmpresa = item.IdEmpresa; reg.IdTransaccion = item.IdTransaccion; reg.IdEmpresa_Emp_Novedad = item.IdEmpresa_Emp_Novedad; reg.IdNovedad_Emp_Novedad = item.IdNovedad_Emp_Novedad; reg.IdEmpleado_Emp_Novedad = item.IdEmpleado_Emp_Novedad; reg.Observacion = item.Observacion; reg.estado = item.estado; reg.Fecha = item.Fecha; reg.IdNomina_Tipo = item.IdNomina_Tipo; reg.IdNomina_TipoLiqui = item.IdNomina_TipoLiqui; reg.IdRubro = item.IdRubro; } return(reg); } } catch (Exception ex) { string array = 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(), "", array, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean GuardarDB(ro_Novedad_x_Empleado_Info info, decimal id, string msg) { try { if (info.IdTransaccion != null) { return(oData.GrabarDB(info, id, ref msg)); } else { oData.ModificarDB(info, ref msg); } return(true); } catch (Exception ex) { Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message); throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "GuardarDB", ex.Message), ex) { EntityType = typeof(ro_Novedad_x_Empleado_Bus) }; } }