public static async Task <int> ImportCustomers()
        {
            var imp = new QuickBookImportCustomers();
            await Task.Run(() => imp.Start());

            var list = imp.Customers;

            if (list.Count == 0)
            {
                return(0);
            }

            var dt = new DataTable();

            dt.Columns.Add("Name", typeof(string));
            foreach (var name in list)
            {
                dt.Rows.Add(name);
            }

            DbObject.ExecStoredProc("ImportAdvertisersFromQb", (cmd) =>
            {
                cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter("@advertisers", SqlDbType.Structured)
                {
                    Value = dt
                });
            });

            Advertizer.ReloadAllFromDb();

            return(list.Count);
        }
示例#2
0
 public void RefreshAdvertizers()
 {
     Advertizer.ReloadAllFromDb();
     RaisePropertyChangedEvent("AllAdvertisers");
 }