protected string ApiTest()
        {
            string result = "\n" + CatalogFilename + ": ";
            string tempDisplay = ProgressText;
            ProgressText += result + "Rows to export...";
            StopWatch exportWatch = new StopWatch(true);

            #if MAGENTO_API_AVAILABLE
            #region Static Trevor
            if (static_proxy && m_alias.Equals("Trevor"))
            {
              MagentoService Mclient = new MagentoService();
              string MsessionId = "";

              //---------------------CATALOG EXPORT----------------------------
              try
              {
                MsessionId = Mclient.login(m_apiUserName, m_apiKey);
                catalogProductEntity[] plist = Mclient.catalogProductList(MsessionId, null, "");
                if (plist.Length < 1)
                  throw new Exception("No products available");

                //TODO: create catalog file header
                string type = "";
                foreach (catalogProductEntity p in plist)
                {
                  string pid = p.product_id;
                  if (p.type.Equals("simple")) //only export combined items or else simple items with no parents
                  {
                    bool isChild = false;
                    catalogProductLinkEntity[] plinks = Mclient.catalogProductLinkList(MsessionId, "grouped", pid, "id");
                    foreach (catalogProductLinkEntity pl in plinks)
                      if (pl.type.Equals("configurable"))
                      {
                        isChild = true;
                        break;
                      }
                    if (isChild) continue;
                  }
                  else
                    type += p.type + " ";

                  string pname = p.name;
                  string patt1 = "";
                  bool first = true;
                  foreach (string cid in p.category_ids)
                  {
                    if (first) first = false;
                    else patt1 += ",";
                    patt1 += cid;
                  }

                  catalogProductReturnEntity pinfo = Mclient.catalogProductInfo(MsessionId, pid, "", null, "id");
                  catalogProductReturnEntity pPriceInfo = Mclient.catalogProductGetSpecialPrice(MsessionId, pid, "", "id");
                  string patt2 = "";
                  string pprice = pPriceInfo.price; ;
                  if ((pPriceInfo.special_from_date != null) && (pinfo.special_to_date != null))
                  {
                    DateTime saleStart = DateTime.Parse(pPriceInfo.special_from_date);
                    DateTime saleEnd = DateTime.Parse(pPriceInfo.special_to_date);
                    DateTime now = DateTime.Now;
                    if (now >= saleStart && now <= saleEnd)
                      pprice = pPriceInfo.special_price;
                  }
                  string pfilter = "";
                  string plink = pinfo.url_key;
                  string pimage = "";
                  string psku = pinfo.sku;
                  catalogProductImageEntity pimageinfo = null;
                  try
                  {
                    pimageinfo = Mclient.catalogProductAttributeMediaInfo(MsessionId, pid, "", "", "id");
                  }
                  catch { }
                  if (pimageinfo != null)
                  {
                    pimage = pimageinfo.url;
                  }
                }
              }
              catch { }

              //---------------------SALES EXPORT----------------------------
              try
              {
                //salesOrderEntity[] sorders = Mclient.salesOrderList(MsessionId, null);
                salesOrderEntity[] sorders = Mclient.salesOrderList(MsessionId, null);
                if (sorders.Length > 0)
                {
                  //TODO: create header line for sales export
                  foreach (salesOrderEntity s in sorders)
                  {
                    string customerid = s.customer_id;
                    if (s.customer_is_guest.Equals("1"))
                    {
                      customerid = s.customer_email;
                      if (customerid == null || customerid.Length < 1)
                        customerid = s.increment_id;
                    }
                    string date = s.created_at;
                    salesOrderEntity sinfo = Mclient.salesOrderInfo(MsessionId, s.increment_id);
                    foreach (salesOrderItemEntity item in sinfo.items)
                    {
                      string productid = item.product_id;
                      string quantity = item.qty_ordered;
                      int len = quantity.IndexOf(".");
                      if (len > 0)
                        quantity = quantity.Substring(0, len); //remove fractional part

                      //TODO: add line to sales data here
                    }
                  }
                  //TODO: upload sales data
                }
              }
              catch { }
            }
            #endregion
            #endif

            #region Static GoStore
              Mage_Api_Model_Server_V2_HandlerPortTypeClient Mclient = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
              string MsessionId = "";

              //---------------------CATALOG EXPORT----------------------------
              try
              {
                //login
                    //MsessionId = Mclient.login(m_apiUserName, m_apiKey);
                    MsessionId = Mclient.login("4Tell", "4tellsoftware"); //condomania

                    //Get API calls available
                    apiEntity[] resources = Mclient.resources(MsessionId);
                    //resultObj = proxy.CallMethod("resources", sessionID);
                    //Type t = resultObj.GetType();
                    //XmlSerializer xs = new XmlSerializer(t);
                    //XElement resources = xs.SerializeAsXElement(resultObj);
                    //TODO: check each CallMethod to make sure it is in this list...

                    //Set product attributes to fetch
                catalogProductRequestAttributes prodAttributes = new catalogProductRequestAttributes();
                    string[] attributes = { "sku", "url_key", "price", "special_price", "special_from_date", "special_to_date", "parent_item_id" };
                prodAttributes.attributes = attributes;

                    //filters prodFilters = new filters();
                    //associativeEntity[] filterList = new associativeEntity[1];
                    //filterList[0].key = "";
                    //filterList[0].value = "";

                //loop through all products
                    StringBuilder data = new StringBuilder(CommonHeader + ProductRecord.Header());
                catalogProductEntity[] plist;
                Mclient.catalogProductList(out plist, MsessionId, null, "");
                string type = "";
                int maxCid = 0;
                foreach (catalogProductEntity p in plist)
                {
                  string pid = p.product_id;

                        if (p.type.Equals("simple")) //only export combined items or else simple items with no parents
                        {
                            //bool isChild = false;
                            //catalogProductLinkEntity[] plinks = Mclient.catalogProductLinkList(MsessionId, "grouped", pid, "id");
                            //foreach (catalogProductLinkEntity pl in plinks)
                            //  if (pl.type.Equals("configurable"))
                            //  {
                            //    isChild = true;
                            //    break;
                            //  }
                            //if (isChild) continue;
                        }
                        else
                            type += p.type + " ";

                  string pname = p.name;
                  string patt1 = "";
                  bool first = true;
                  foreach (string cid in p.category_ids)
                  {
                    if (first) first = false;
                    else patt1 += ",";
                    patt1 += cid;
                    int id = Convert.ToInt32(cid);
                    if (id > maxCid) maxCid = id;
                  }

                  string patt2 = "";
                  catalogProductReturnEntity pinfo = Mclient.catalogProductInfo(MsessionId, pid, "", prodAttributes, "id");
                  string pprice = pinfo.price; ;
                  if ((pinfo.special_from_date != null) && (pinfo.special_to_date != null))
                  {
                    DateTime saleStart = DateTime.Parse(pinfo.special_from_date);
                    DateTime saleEnd = DateTime.Parse(pinfo.special_to_date);
                    DateTime now = DateTime.Now;
                    if (now >= saleStart && now <= saleEnd)
                      pprice = pinfo.special_price;
                  }
                  string pfilter = "";
                  string plink = pinfo.url_key;
                  string pimage = "";
                  string psku = pinfo.sku;
                  catalogProductImageEntity pimageinfo = null;
                        try
                        {
                            pimageinfo = Mclient.catalogProductAttributeMediaInfo(MsessionId, pid, "", "", "id");
                        }
                        catch
                        {
                            try
                            {
                                pimageinfo = Mclient.catalogProductAttributeMediaInfo(MsessionId, psku, "", "", "sku");
                            }
                            catch
                            {
                            }
                        }
                        if (pimageinfo != null)
                        {
                            pimage = pimageinfo.url;
                        }
                  data.Append(pid + "\t" + pname + "\t" + patt1 + "\t" + patt2 + "\t" + pprice + "\t" + pfilter + "\t" + plink + "\t" + pimage + "\t" + psku + "\r\n");
                }
                    result += m_boostService.WriteTable(m_alias, CatalogFilename, data);

                //get cat info
                result += "\n" + Att1Filename + ": ";
                ProgressText = tempDisplay + result + "Exporting...";
                catalogCategoryInfo cinfo;
                    StringBuilder csb = new StringBuilder(CommonHeader + AttributeRecord.Header());
                for (int cid = 1; cid <= maxCid; cid++)
                {
                  try
                  {
                    cinfo = Mclient.catalogCategoryInfo(MsessionId, cid, "", null);
                    csb.Append(cid.ToString() + "\t" + cinfo.name + "\r\n");
                  }
                  catch
                  {
                    csb.Append(cid.ToString() + "\t" + cid.ToString() + "\r\n");
                  }
                }
                    result += m_boostService.WriteTable(m_alias, Att1Filename, csb);
                ProgressText = tempDisplay + result;
              }
              catch { }
                //try
                //{
                //  //catalogCategoryTree ctree = Mclient.catalogCategoryTree(MsessionId, "", "");
                //  catalogCategoryTree ctree = Mclient.catalogCategoryTree(MsessionId, "0", "");
                //}
                //catch { }
                //try
                //{
                //  //catalogCategoryEntityNoChildren[] clist = Mclient.catalogCategoryLevel(MsessionId, "", "", "");
                //  catalogCategoryEntityNoChildren[] clist = Mclient.catalogCategoryLevel(MsessionId, "", "", "");
                //}
                //catch { }
                //try
                //{
                //  //catalogCategoryEntityNoChildren[] clist = Mclient.catalogCategoryLevel(MsessionId, "", "", "");
                //  catalogCategoryEntityNoChildren[] clist = Mclient.catalogCategoryLevel(MsessionId, "", "", "");
                //}
                //catch { }
                //try
                //{
                //  //catalogCategoryInfo cinfo = Mclient.catalogCategoryInfo(MsessionId, 0, "CurrentView", null);
                //  catalogCategoryInfo cinfo = Mclient.catalogCategoryInfo(MsessionId, 4, "", null);
                //}
                //catch { }
                //try
                //{
                //  //catalogProductAttributeSetEntity[] pasList = Mclient.catalogProductAttributeSetList(MsessionId);
                //  //...this one works!
                //  catalogProductAttributeSetEntity[] pasList = Mclient.catalogProductAttributeSetList(MsessionId);
                //}
                //catch { }

              //---------------------SALES EXPORT----------------------------
              try
              {
                    DateTime exportDate = DateTime.Now; //pass this date in
                    string salesFileName = string.Format(SalesFilenameFormat, exportDate.ToString("yyyy-MM"));
                    result += "\n" + salesFileName + ": ";
                    StringBuilder salesData = new StringBuilder(CommonHeader + SalesRecord.Header());

                    //create filter to get sales for this month only
                    string fromDate = string.Format("{0:0000}-{1:00}-01 00:00:00", exportDate.Year, exportDate.Month);
                    string toDate = string.Format("{0:0000}-{1:00}-01 00:00:00", exportDate.Year, exportDate.Month + 1);
                    filters monthFilter = new filters();
                    monthFilter.complex_filter = new complexFilter[2];
                    monthFilter.complex_filter[0] = new complexFilter();
                    monthFilter.complex_filter[0].key = "created_at";
                    monthFilter.complex_filter[0].value = new associativeEntity();
                    monthFilter.complex_filter[0].value.key = "from";
                    monthFilter.complex_filter[0].value.value = fromDate;
                    monthFilter.complex_filter[1] = new complexFilter();
                    monthFilter.complex_filter[1].key = "created_at";
                    monthFilter.complex_filter[1].value = new associativeEntity();
                    monthFilter.complex_filter[1].value.key = "to";
                    monthFilter.complex_filter[1].value.value = toDate;

                    //get list of sales orders
                salesOrderEntity[] sorders = Mclient.salesOrderList(MsessionId, monthFilter);
                if (sorders.Length > 0)
                {
                  //TODO: create header line for sales export
                  foreach (salesOrderEntity s in sorders)
                  {
                    string customerid = s.customer_id;
                    if (s.customer_is_guest.Equals("1"))
                    {
                      customerid = s.customer_email;
                      if (customerid == null || customerid.Length < 1)
                        customerid = s.increment_id;
                    }
                    string date = s.created_at;
                            //get list of items purchased on each sales order
                    salesOrderEntity sinfo = Mclient.salesOrderInfo(MsessionId, s.increment_id);
                    foreach (salesOrderItemEntity item in sinfo.items)
                    {
                      string productid = item.product_id;
                      string quantity = item.qty_ordered;
                      int len = quantity.IndexOf(".");
                      if (len > 0)
                        quantity = quantity.Substring(0, len); //remove fractional part

                      //add line to sales data
                                salesData.Append(customerid + "\t" + productid + "\t" + quantity + "\t" + date + "\r\n");
                    }
                  }
                  //upload sales data
                        result += m_boostService.WriteTable(m_alias, salesFileName, salesData);

                }
              }
              catch { }
            #endregion

            return result;
        }
        protected override string GetCatalog()
        {
            string h2 = "";
            StringBuilder data = null;

            string filename = "Catalog.txt";
            string result = "\n" + filename + ": ";
            string tempDisplay = ProgressText;
            ProgressText += result + "Rows to export...";
            StopWatch exportWatch = new StopWatch(true);

            //--------DEBUG USING STATIC------
            bool static_proxy = false;
            //--------------------------------

            #if MAGENTO_API_AVAILABLE
            #region Static Trevor
            if (static_proxy && m_alias.Equals("Trevor"))
            {
              MagentoService Mclient = new MagentoService();
              string MsessionId = "";

              //---------------------CATALOG EXPORT----------------------------
              try
              {
                MsessionId = Mclient.login(m_apiUserName, m_apiKey);
                catalogProductEntity[] plist = Mclient.catalogProductList(MsessionId, null, "");
                if (plist.Length < 1)
                  throw new Exception("No products available");

                //TODO: create catalog file header
                string type = "";
                foreach (catalogProductEntity p in plist)
                {
                  string pid = p.product_id;
                  if (p.type.Equals("simple")) //only export combined items or else simple items with no parents
                  {
                    bool isChild = false;
                    catalogProductLinkEntity[] plinks = Mclient.catalogProductLinkList(MsessionId, "grouped", pid, "id");
                    foreach (catalogProductLinkEntity pl in plinks)
                      if (pl.type.Equals("configurable"))
                      {
                        isChild = true;
                        break;
                      }
                    if (isChild) continue;
                  }
                  else
                    type += p.type + " ";

                  string pname = p.name;
                  string patt1 = "";
                  bool first = true;
                  foreach (string cid in p.category_ids)
                  {
                    if (first) first = false;
                    else patt1 += ",";
                    patt1 += cid;
                  }

                  catalogProductReturnEntity pinfo = Mclient.catalogProductInfo(MsessionId, pid, "", null, "id");
                  catalogProductReturnEntity pPriceInfo = Mclient.catalogProductGetSpecialPrice(MsessionId, pid, "", "id");
                  string patt2 = "";
                  string pprice = pPriceInfo.price; ;
                  if ((pPriceInfo.special_from_date != null) && (pinfo.special_to_date != null))
                  {
                    DateTime saleStart = DateTime.Parse(pPriceInfo.special_from_date);
                    DateTime saleEnd = DateTime.Parse(pPriceInfo.special_to_date);
                    DateTime now = DateTime.Now;
                    if (now >= saleStart && now <= saleEnd)
                      pprice = pPriceInfo.special_price;
                  }
                  string pfilter = "";
                  string plink = pinfo.url_key;
                  string pimage = "";
                  string psku = pinfo.sku;
                  catalogProductImageEntity pimageinfo = null;
                  try
                  {
                    pimageinfo = Mclient.catalogProductAttributeMediaInfo(MsessionId, pid, "", "", "id");
                  }
                  catch { }
                  if (pimageinfo != null)
                  {
                    pimage = pimageinfo.url;
                  }
                }
              }
              catch { }

              //---------------------SALES EXPORT----------------------------
              try
              {
                //salesOrderEntity[] sorders = Mclient.salesOrderList(MsessionId, null);
                salesOrderEntity[] sorders = Mclient.salesOrderList(MsessionId, null);
                if (sorders.Length > 0)
                {
                  //TODO: create header line for sales export
                  foreach (salesOrderEntity s in sorders)
                  {
                    string customerid = s.customer_id;
                    if (s.customer_is_guest.Equals("1"))
                    {
                      customerid = s.customer_email;
                      if (customerid == null || customerid.Length < 1)
                        customerid = s.increment_id;
                    }
                    string date = s.created_at;
                    salesOrderEntity sinfo = Mclient.salesOrderInfo(MsessionId, s.increment_id);
                    foreach (salesOrderItemEntity item in sinfo.items)
                    {
                      string productid = item.product_id;
                      string quantity = item.qty_ordered;
                      int len = quantity.IndexOf(".");
                      if (len > 0)
                        quantity = quantity.Substring(0, len); //remove fractional part

                      //TODO: add line to sales data here
                    }
                  }
                  //TODO: upload sales data
                }
              }
              catch { }
            }
            #endregion
            #endif

            #region Static GoStore
            if (static_proxy && m_alias.Equals("WSTea"))
            {
                Mage_Api_Model_Server_V2_HandlerPortTypeClient Mclient = new Mage_Api_Model_Server_V2_HandlerPortTypeClient();
                string MsessionId = "";

                //---------------------CATALOG EXPORT----------------------------
                try
                {
                    //login
                    MsessionId = Mclient.login(m_apiUserName, m_apiKey);

                    //Set product attributes to fetch
                    catalogProductRequestAttributes prodAttributes = new catalogProductRequestAttributes();
                    string[] attributes = { "sku", "url_key", "price", "special_price", "special_from_date", "special_to_date", "parent_item_id" };
                    prodAttributes.attributes = attributes;

                    //filters prodFilters = new filters();
                    //associativeEntity[] filterList = new associativeEntity[1];
                    //filterList[0].key = "";
                    //filterList[0].value = "";

                    //loop through all products
                    h2 = "Product ID\tName\tAtt1 ID\tAtt2 ID\tPrice\tFilter\tLink\tImage Link\tStandard Code\r\n"; //product catalog second header line
                    data = new StringBuilder(CommonHeader + h2);
                    catalogProductEntity[] plist;
                    Mclient.catalogProductList(out plist, MsessionId, null, "");
                    //string type = "";
                    int maxCid = 0;
                    foreach (catalogProductEntity p in plist)
                    {
                        string pid = p.product_id;
                        catalogProductLinkEntity[] plinks = Mclient.catalogProductLinkList(MsessionId, "parent", pid, "id");
                        if (plinks != null)
                            continue; //is a child

                        //if (p.type.Equals("simple")) //only export combined items or else simple items with no parents
                        //{
                        //  bool isChild = false;
                        //  catalogProductLinkEntity[] plinks = Mclient.catalogProductLinkList(MsessionId, "grouped", pid, "id");
                        //  foreach (catalogProductLinkEntity pl in plinks)
                        //    if (pl.type.Equals("configurable"))
                        //    {
                        //      isChild = true;
                        //      break;
                        //    }
                        //  if (isChild) continue;
                        //}
                        //else
                        //  type += p.type + " ";

                        string pname = p.name;
                        string patt1 = "";
                        bool first = true;
                        foreach (string cid in p.category_ids)
                        {
                            if (first) first = false;
                            else patt1 += ",";
                            patt1 += cid;
                            int id = Convert.ToInt32(cid);
                            if (id > maxCid) maxCid = id;
                        }

                        string patt2 = "";
                        catalogProductReturnEntity pinfo = Mclient.catalogProductInfo(MsessionId, pid, "", prodAttributes, "id");
                        string pprice = pinfo.price; ;
                        if ((pinfo.special_from_date != null) && (pinfo.special_to_date != null))
                        {
                            DateTime saleStart = DateTime.Parse(pinfo.special_from_date);
                            DateTime saleEnd = DateTime.Parse(pinfo.special_to_date);
                            DateTime now = DateTime.Now;
                            if (now >= saleStart && now <= saleEnd)
                                pprice = pinfo.special_price;
                        }
                        string pfilter = "";
                        string plink = pinfo.url_key;
                        string pimage = "";
                        string psku = pinfo.sku;
                        catalogProductImageEntity pimageinfo = null;
                        try
                        {
                            pimageinfo = Mclient.catalogProductAttributeMediaInfo(MsessionId, pid, "", "", "id");
                        }
                        catch { }
                        if (pimageinfo != null)
                        {
                            pimage = pimageinfo.url;
                        }
                        data.Append(pid + "\t" + pname + "\t" + patt1 + "\t" + patt2 + "\t" + pprice + "\t" + pfilter + "\t" + plink + "\t" + pimage + "\t" + psku + "\r\n");
                    }
                    result += m_boostService.WriteTable(m_alias, filename, data);

                    //get cat info
                    filename = "Attribute1Names.txt";
                    result += "\n" + filename + ": ";
                    ProgressText = tempDisplay + result + "Exporting...";
                    catalogCategoryInfo cinfo;
                    h2 = "Att ID\tName\r\n";
                    StringBuilder csb = new StringBuilder(CommonHeader + h2);
                    for (int cid = 1; cid <= maxCid; cid++)
                    {
                        try
                        {
                            cinfo = Mclient.catalogCategoryInfo(MsessionId, cid, "", null);
                            csb.Append(cid.ToString() + "\t" + cinfo.name + "\r\n");
                        }
                        catch
                        {
                            csb.Append(cid.ToString() + "\t" + cid.ToString() + "\r\n");
                        }
                    }
                    result += m_boostService.WriteTable(m_alias, filename, csb);
                    ProgressText = tempDisplay + result;
                }
                catch { }
            }
            #endregion

            #region Dynamic GoStore

            if (!static_proxy)
            {
                //http://whitesalmontea.gostorego.com/api/v2_soap/?wsdl
                DynamicProxy proxy = GetSoapProxy(m_wsdlUrl, "Mage_Api_Model_Server_V2_HandlerPortType");
                if (proxy == null)
                    throw new Exception("Unable to create SOAP proxy for Magento");

                //login to get a session id
                object resultObj = proxy.CallMethod("login", m_apiUserName, m_apiKey);
                string sessionID = resultObj.ToString();
                //Type t;
                //XmlSerializer xs;

                //---------------------CATALOG EXPORT----------------------------
                try
                {

                    //Get catalog details
                    resultObj = proxy.CallMethod("resources", sessionID);
                    XElement resources = XmlSerializerExtension.SerializeAsXElement(resultObj);
                    //t = resultObj.GetType();
                    //xs = new XmlSerializer(t);
                    //XElement resources = xs.SerializeAsXElement(resultObj);
                    //TODO: check each CallMethod to make sure it is in this list...

                    //catalog_product.list  catalogProductList
                    resultObj = proxy.CallMethod("catalog_product.list", sessionID);
                    XElement products = XmlSerializerExtension.SerializeAsXElement(resultObj); //catalogProductEntity[]
                    //t = resultObj.GetType();
                    //xs = new XmlSerializer(t);
                    //XElement products = xs.SerializeAsXElement(resultObj); //catalogProductEntity[]
                    foreach (XElement product in products.Elements("catalogProductEntity"))
                    {
                        string pid = "";
                        string pname = "";
                        string patt1 = "";
                        try
                        {
                            pid = Client.GetValue(product, "product_id");
                            pname = Client.GetValue(product, "name");
                        }
                        catch (Exception ex) { }

                        try
                        {
                            bool first = true;
                            foreach (XElement cat in product.Elements("category_ids"))
                            {
                                if (first) first = false;
                                else patt1 += ",";
                                patt1 += Client.GetValue(cat, "id");
                            }
                        }
                        catch (Exception ex) { }

                        XElement pinfo = null;
                        //#if MAGENTO_API_AVAILABLE
                        catalogProductRequestAttributes a = new catalogProductRequestAttributes();
                        string[] attributes = { "sku", "url_key", "price", "special_price", "special_from_date", "special_to_date" };
                        a.attributes = attributes;
                        XElement request = XmlSerializerExtension.SerializeAsXElement(a);
                        //t = a.GetType();
                        //xs = new XmlSerializer(t);
                        //XElement request = xs.SerializeAsXElement(a);
                        string patt2 = "";
                        string pprice = "";
                        try
                        {
                            //catalog_product.info  catalogProductInfo
                            resultObj = proxy.CallMethod("catalog_product.info", sessionID, pid, a, "id");
                            pinfo = XmlSerializerExtension.SerializeAsXElement(resultObj); //catalogProductReturnEntity
                            //t = resultObj.GetType();
                            //xs = new XmlSerializer(t);
                            //pinfo = xs.SerializeAsXElement(resultObj); //catalogProductReturnEntity

                            pprice = Client.GetValue(pinfo, "price");
                            XElement xFromDate = pinfo.Element("special_from_date");
                            XElement xToDate = pinfo.Element("special_from_date");
                            if ((xFromDate != null) && (xToDate != null))
                            {
                                DateTime saleStart = DateTime.Parse(xFromDate.Value);
                                DateTime saleEnd = DateTime.Parse(xToDate.Value);
                                DateTime now = DateTime.Now;
                                if (now >= saleStart && now <= saleEnd)
                                    pprice = Client.GetValue(pinfo, "special_price");
                            }
                        }
                        catch (Exception ex) { }
                        //#endif

                        string pfilter = "";
                        string plink = "";
                        string psku = "";
                        string pimage = "";
                        try
                        {
                            plink = Client.GetValue(pinfo, "url_key");
                            psku = Client.GetValue(pinfo, "sku");
                            XElement pimageinfo = null;
                            //catalog_product_attribute_media.info  catalogProductAttributeMediaInfo
                            resultObj = proxy.CallMethod("catalog_product_attribute_media.info", sessionID, pid, "", "", "id");
                            pimageinfo = XmlSerializerExtension.SerializeAsXElement(resultObj);		//catalogProductImageEntity
                            //t = resultObj.GetType();
                            //xs = new XmlSerializer(t);
                            //pimageinfo = xs.SerializeAsXElement(resultObj);		//catalogProductImageEntity
                            if (pimageinfo != null)
                            {
                                pimage = Client.GetValue(pimageinfo, "url");
                            }
                        }
                        catch { }

                    }
                }
                catch (Exception ex)
                {
                    string errMsg = "Error extracting catalog: " + ex.Message;
                    if (ex.InnerException != null)
                        errMsg += "\nInner Exception" + ex.InnerException.Message;
                    result += "\n" + errMsg;
                }
            }
            #endregion

            return result;
        }