public Boolean guardar(clsTipoInversion inversion)
        {
            try
            {

                using (CuentasPorCobrarEntities entCxC = new CuentasPorCobrarEntities())
                {
                    int x = this.getIdSiguiente();
                    TipoInversion tipoInver = new TipoInversion()
                    {
                        idEmpresa = inversion.idEmpresa,
                        idTipoInversion = x,
                        Descripcion = inversion.Descripcion,
                        Estado =   inversion.Estado,
                    };
                    entCxC.AddToTipoInversion(tipoInver);
                    entCxC.SaveChanges();
                }
                return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine("xxxxxxxxxxxx" + ex);
                return false;
            }
        }
        /*
         public void consultaBancoEspecifica(clsBanco Banco)
        {
            using (CuentasPorCobrarEntities ent = new CuentasPorCobrarEntities())
            {
                var x = (from q in ent.Banco where q.idBanco == Banco.idBanco select q).First();

                Banco.idEmpresa = x.idEmpresa; //Error no se puede convertit implicitamente int
                Banco.idBanco = x.idBanco;
                Banco.Nombre = x.Nombre;
                Banco.Estado = x.Estado;
            }

        }*/
        public void consultaTipoInversionEspecifica(clsTipoInversion tipoInversion)
        {
            using (CuentasPorCobrarEntities ent = new CuentasPorCobrarEntities())
            {
                var x = (from q in ent.TipoInversion where q.idTipoInversion == tipoInversion.idTipoInversion select q).First();

                tipoInversion.idEmpresa = x.idEmpresa; //Error no se puede convertit implicitamente int
                tipoInversion.idTipoInversion = x.idTipoInversion;
                tipoInversion.Descripcion = x.Descripcion;
                tipoInversion.Estado = x.Estado;
            }
        }
 public Boolean eliminar(clsTipoInversion inversion)
 {
     try
     {
         using (CuentasPorCobrarEntities entCxC = new CuentasPorCobrarEntities())
         {
             var x = (from q in entCxC.TipoInversion where q.idTipoInversion == inversion.idTipoInversion select q).First();
             entCxC.DeleteObject(x);
             entCxC.SaveChanges();
         }
         return true;
     }
     catch (Exception ex)
     {
         Console.WriteLine("xxxxxxxxxxxx" + ex);
         return false;
     }
 }
        public List<clsTipoInversion> consultaTipoInversionGeneral()
        {
            try
            {
                List<clsTipoInversion> lista = new List<clsTipoInversion>();
                CuentasPorCobrarEntities ent = new CuentasPorCobrarEntities();
                var con = from w in ent.TipoInversion select w;
                foreach (var item in con)
                {
                    clsTipoInversion inversion = new clsTipoInversion();
                    inversion.idEmpresa = item.idEmpresa;
                    inversion.idTipoInversion = item.idTipoInversion;
                    inversion.Descripcion = item.Descripcion;
                    inversion.Estado = item.Estado;

                    lista.Add(inversion);
                }
                return lista;
            }
            catch (Exception)
            {
                return null;
            }
        }
        public Boolean modificar(clsTipoInversion inversion)
        {
            using (CuentasPorCobrarEntities entCxC = new CuentasPorCobrarEntities())
            {
                var x = (from q in entCxC.TipoInversion where q.idTipoInversion == inversion.idTipoInversion select q).First();

                x.idEmpresa = inversion.idEmpresa;
                x.idTipoInversion = inversion.idTipoInversion;
                x.Descripcion = inversion.Descripcion;
                x.Estado = inversion.Estado;

                entCxC.SaveChanges();

                return true;
            }
        }