public bool Guardar_DB(List <ro_parametro_x_pago_variable_Det_Info> lista)
 {
     try
     {
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             foreach (var info in lista)
             {
                 ro_parametro_x_pago_variable_Det add = new ro_parametro_x_pago_variable_Det();
                 add.Idempresa             = info.Idempresa;
                 add.IdNomina_Tipo         = info.IdNomina_Tipo;
                 add.Id_Tipo_Pago_Variable = info.Id_Tipo_Pago_Variable;
                 add.Meta = info.Meta;
                 add.cod_Pago_Variable = info.cod_Pago_Variable;
                 add.Variable_porcentaje_prorrateado = info.Variable_porcentaje_prorrateado;
                 db.ro_parametro_x_pago_variable_Det.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 Modificar_DB(List <ro_parametro_x_pago_variable_Det_Info> lista)
 {
     try
     {
         int sec = 0;
         using (EntityRoles_FJ db = new EntityRoles_FJ())
         {
             foreach (var info in lista)
             {
                 if (sec == 0)
                 {
                     db.Database.ExecuteSqlCommand("delete Fj_servindustrias.ro_parametro_x_pago_variable_Det where IdEmpresa='" + info.Idempresa + "' and Id_Tipo_Pago_Variable='" + info.Id_Tipo_Pago_Variable + "' and IdNomina_Tipo='" + info.IdNomina_Tipo + "'");
                 }
                 sec++;
                 ro_parametro_x_pago_variable_Det add = new ro_parametro_x_pago_variable_Det();
                 add.Idempresa             = info.Idempresa;
                 add.IdNomina_Tipo         = info.IdNomina_Tipo;
                 add.Id_Tipo_Pago_Variable = info.Id_Tipo_Pago_Variable;
                 add.Meta = info.Meta;
                 add.cod_Pago_Variable = info.cod_Pago_Variable;
                 add.Variable_porcentaje_prorrateado = info.Variable_porcentaje_prorrateado;
                 db.ro_parametro_x_pago_variable_Det.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());
     }
 }