public void runQuery(List<xFerParamater> _vars)
        {
            string packageName = _vars[0].Value.ToString();
            string dbName = _vars[1].Value.ToString();
            string xQuery = _vars[2].Value.ToString();
            string collection = string.Empty;
            List<xFerParamater> _params = new List<xFerParamater>();
            if (_vars.Count > 3)
            {
                string paramtext = string.Empty;
                try
                {
                    collection = _vars[3].Value.ToString().Trim();

                    if (collection.IndexOf("[") > -1)
                    {
                        collection = string.Empty;
                        paramtext = _vars[3].Value.ToString().Trim();
                    }


                }
                catch
                {
                }

                if(_vars.Count > 4)
                try
                {
                    paramtext = _vars[4].Value.ToString().Trim();
                }
                catch
                {
                }

                if (paramtext != string.Empty)
                {
                    _params = getParametersPassed(paramtext);
                }
            }


             xFerCalls call = new xFerCalls();
             xFer xMe = new xFer();
             xMe.MongoCollection = collection;
             foreach (xFerPackage p in _xFerPackages)
             {
                 if (p.PackageName == packageName)
                 {
                     foreach (xFerQuery q in p.Queries)
                     {
                         if (q.QueryName == xQuery)
                         {

                             xMe.SourceQuery = q;
                             if (_params.Count > 0)
                             {
                                 xMe.SourceQuery.Paramaters = _params;
                             }
                         }
                     }
                 }

                 foreach (xFerDb db in _dbs)
                 {
                     if (db.DbName == dbName)
                     {
                         xMe.SourceDb = db;
                     }
                 }

             }

             if (xMe.SourceDb.ConnectionString != string.Empty && xMe.SourceQuery.QueryText.ToString() != string.Empty)
             {
                 DataTable dt = call.transfer(xMe);

                 if (dt != null)
                 {
                     if (dt.Rows.Count > 0)
                     {
                         StringBuilder sbHeader = new StringBuilder();
                         StringBuilder sbSubHeader = new StringBuilder();
                         foreach (DataColumn dc in dt.Columns)
                         {
                             sbHeader.Append(dc.ColumnName.ToString() + "\t");
                             sbSubHeader.Append(returnDots(dc.ColumnName.ToString()) + "\t");
                         }

                         Console.WriteLine(sbHeader.ToString());
                         Console.WriteLine(sbSubHeader.ToString());

                         foreach (DataRow dr in dt.Rows)
                         {
                             StringBuilder sbRow = new StringBuilder();

                             for (int i = 0; i < dt.Columns.Count; i++)
                             {
                                 sbRow.Append(dr[i].ToString() + "\t");
                             }

                             Console.WriteLine(sbRow.ToString());
                         }
                     }
                 }

             }


        }
        public void run(List<xFerParamater> _vars)
        {
            string packageName = _vars[0].Value.ToString();
            string xFerName = string.Empty;

            if (_vars.Count > 1)
            {
                Console.WriteLine(_vars[1].ToString());
                xFerName = _vars[1].Value.ToString();
            }

            List<xFerParamater> _params = new List<xFerParamater>();
            if (_vars.Count > 2)
            {
                try
                {
                    string paramtext = _vars[2].Value.ToString().Trim();
                    _params = getParametersPassed(paramtext);
                    foreach (xFerParamater p in _params)
                    {
                        Console.WriteLine(p.Name + ": " + p.Value);
                    }

                }
                catch
                {
                }
            }

            xFerCalls call = new xFerCalls();
            foreach (xFerPackage p in _xFerPackages)
            {
                if (p.PackageName == packageName)
                {
                    if (xFerName != string.Empty)
                    {
                        foreach (xFer x in p.XFers)
                        {
                            if (x.XFerName == xFerName)
                            {
                                if (_params.Count > 0)
                                {
                                    x.SourceQuery.Paramaters = _params;
                                }
                                Console.WriteLine("Run: " + x.XFerName);
                                call.transfer(x);
                            }
                        }

                    }
                    else
                    {
                        foreach (xFer x in p.XFers)
                        {
                            Console.WriteLine("Run: " + x.XFerName);
                            call.transfer(x);
                        }
                    }
                }
            }

        }
        public void testConn(List<xFerParamater> _vars)
        {
            if (_vars.Count > 0)
            {
                string dbName = _vars[0].Value.ToString().Trim();

                foreach (xFerDb db in _dbs)
                {
                    if (db.DbName == dbName)
                    {
                        xFerCalls call = new xFerCalls();
                        call.testConnection(db.ConnectionString, db.DbType);
                    }
                }

            }
            else
            {
                Console.WriteLine("missing paramaters: dbName");
            }
        }