using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WooCommerceNET.WooCommerce.v3;

namespace SVS_XDWooSync_Isolcasa
{
    static class globals
    {
        // global int
        public static string csXD;
        public static string WooURL;
        public static string WooCK;
        public static string WooCS;
        public static List<Product> products;
        // global function
        public static string HelloWorld()
        {
            return @"server=192.168.1.3;port=3308;userid=root;password=xd;database=xdisolcasa";
        }

        // global int using get/set
        static int _getsetcounter;
        public static int getsetcounter
        {
            set { _getsetcounter = value; }
            get { return _getsetcounter; }
        }


        //CONVERTE DATATABLE PARA LIST
        public static List<Dictionary<string, object>> DataTableToDictionaryList(DataTable dt)
        {
            var result = new List<Dictionary<string, object>>();
            //or var result = new List<Dictionary<string, string>>();

            foreach (DataRow row in dt.Rows)
            {
                var dictRow = new Dictionary<string, object>();
                foreach (DataColumn col in dt.Columns)
                {
                    dictRow.Add(col.ColumnName, row[col]);
                    //or dictRow.Add(col.ColumnName, row[col].ToString());
                }

                result.Add(dictRow);
            }

            return result;
        }



    }
}
