//public Boolean EliminarEGPXOGD(List<ro_empleado_gastos_perso_x_otros_gast_deduci_Info> info, int IncrementaColumnas) public Boolean EliminarEGPXOGD(List <ro_empleado_gastos_perso_x_otros_gast_deduci_Info> info) { try { using (EntitiesRoles ro = new EntitiesRoles()) { //int i = 0; //int Resta = info.Count - IncrementaColumnas; foreach (var item in info) { //i++; //if (i <= Resta) //{ ro_empleado_gastos_perso_x_otros_gast_deduci EGPXOGD = ro.ro_empleado_gastos_perso_x_otros_gast_deduci.First(v => v.IdEmpleado == item.IdEmpleado && v.IdEmpresa == item.IdEmpresa && v.Anio_fiscal == item.Anio_fiscal); ro.ro_empleado_gastos_perso_x_otros_gast_deduci.Remove(EGPXOGD); ro.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 mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean GrabarBD(ro_empleado_gastos_perso_x_otros_gast_deduci_Info info, ref string msg) { try { using (EntitiesRoles db = new EntitiesRoles()) { ro_empleado_gastos_perso_x_otros_gast_deduci item = new ro_empleado_gastos_perso_x_otros_gast_deduci(); item.IdEmpresa = info.IdEmpresa; item.IdEmpleado = info.IdEmpleado; item.Anio_fiscal = info.Anio_fiscal; item.secuencia = getId(info.IdEmpresa, info.IdEmpleado, info.Anio_fiscal); item.Valor_Pension_alim = info.Valor_Pension_alim; item.Valor_no_cub_x_aseg = info.Valor_no_cub_x_aseg; db.ro_empleado_gastos_perso_x_otros_gast_deduci.Add(item); 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 mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean EliminarDB(ro_empleado_gastos_perso_x_otros_gast_deduci_Info info) { try { using (EntitiesRoles ro = new EntitiesRoles()) { ro_empleado_gastos_perso_x_otros_gast_deduci EGPXOGD = ro.ro_empleado_gastos_perso_x_otros_gast_deduci.First(v => v.IdEmpleado == info.IdEmpleado && v.IdEmpresa == info.IdEmpresa && v.Anio_fiscal == info.Anio_fiscal); ro.ro_empleado_gastos_perso_x_otros_gast_deduci.Remove(EGPXOGD); ro.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 mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
public Boolean GrabarDB(List <ro_empleado_gastos_perso_x_otros_gast_deduci_Info> info) { try { //if (EliminarEGPXOGD(info, IncrementaColumnas) == true || EliminarEGPXOGD(info, IncrementaColumnas) == false) if (EliminarEGPXOGD(info) == true || EliminarEGPXOGD(info) == false) { using (EntitiesRoles rol = new EntitiesRoles()) { foreach (var item in info) { ro_empleado_gastos_perso_x_otros_gast_deduci BD = new ro_empleado_gastos_perso_x_otros_gast_deduci(); BD.IdEmpresa = item.IdEmpresa; BD.IdEmpleado = item.IdEmpleado; BD.Anio_fiscal = item.Anio_fiscal; BD.secuencia = item.secuencia; BD.Valor_Pension_alim = item.Valor_Pension_alim; BD.Valor_no_cub_x_aseg = item.Valor_no_cub_x_aseg; rol.ro_empleado_gastos_perso_x_otros_gast_deduci.Add(BD); rol.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 mensaje); mensaje = ex.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }