Пример #1
0
        public Boolean GrabarBD(ro_empleado_x_Proyeccion_Gastos_Personales_Info info, ref string msg)
        {
            try
            {
                using (EntitiesRoles db = new EntitiesRoles())
                {
                    ro_empleado_x_Proyeccion_Gastos_Personales item = new ro_empleado_x_Proyeccion_Gastos_Personales();
                    item.IdEmpresa       = info.IdEmpresa;
                    item.IdEmpleado      = info.IdEmpleado;
                    item.IdTipoGasto     = info.IdTipoGasto;
                    item.AnioFiscal      = info.AnioFiscal;
                    item.Valor           = info.Valor;
                    item.FechaIngresa    = info.FechaIngresa;
                    item.UsuarioIngresa  = info.UsuarioIngresa;
                    item.FechaModifica   = info.FechaModifica;
                    item.UsuarioModifica = info.UsuarioModifica;

                    db.ro_empleado_x_Proyeccion_Gastos_Personales.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);
                mensaje = ex.InnerException + " " + ex.Message;
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                throw new Exception(ex.InnerException.ToString());
            }
        }
Пример #2
0
 public Boolean EliminarPGP(List <ro_empleado_x_Proyeccion_Gastos_Personales_Info> InfoPGP)
 {
     try
     {
         using (EntitiesRoles rol = new EntitiesRoles())
         {
             foreach (var item in InfoPGP)
             {
                 ro_empleado_x_Proyeccion_Gastos_Personales pgpData = rol.ro_empleado_x_Proyeccion_Gastos_Personales.First(v => v.IdEmpresa == item.IdEmpresa && v.AnioFiscal == item.AnioFiscal);
                 rol.ro_empleado_x_Proyeccion_Gastos_Personales.Remove(pgpData);
                 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);
         mensaje = ex.InnerException + " " + ex.Message;
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         throw new Exception(ex.InnerException.ToString());
     }
 }