public Affinity.WsResponse SyncRequest(Affinity.WsToken token, System.Xml.XmlDocument doc) { Affinity.WsResponse resp = new Affinity.WsResponse(); Phreezer phreezer = new Phreezer(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString); try { Hashtable ht = new Hashtable(); XmlNodeList fields = doc.GetElementsByTagName("field"); // enumerate all the fields and convert to a hashtable foreach (XmlNode field in fields) { ht.Add(XmlForm.GetAttribute(field, "sp_id"), field.InnerText); } if (ht.ContainsKey("WEB_ID") == false || ht["WEB_ID"].Equals("")) { throw new Exception("WEB_ID is required"); } if (ht.ContainsKey("AFF_ID") == false || ht["AFF_ID"].Equals("")) { throw new Exception("AFF_ID is required"); } Affinity.Order order = new Affinity.Order(phreezer); order.Load(ht["WEB_ID"]); if (order.InternalId.Equals("")) { // the order doesn't have an AFF ID so this is a confirmation // we have to get the system settings to pass them in to the order confirm method Hashtable settings = (Hashtable)Application[Affinity.SystemSetting.DefaultCode]; resp = order.Confirm(ht["AFF_ID"].ToString(), settings); } else { resp.IsSuccess = true; resp.ActionWasTaken = false; resp.Message = "No action was taken"; } } catch (Exception ex) { resp.Message = ex.Message; } finally { phreezer.Close(); } return(resp); }