示例#1
0
    public string[] GetCities(string prefixText, int count)
    {
        Phreezer phreezer = new Phreezer(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);

        Affinity.Zipcodes        zs = new Affinity.Zipcodes(phreezer);
        Affinity.ZipcodeCriteria zc = new Affinity.ZipcodeCriteria();
        zc.CityBeginsWith = prefixText;
        zc.DistinctCity   = true;
        zc.AppendToOrderBy("City");
        zc.MaxResults = count;

        zs.Query(zc);
        string[] returnval = new string[zs.Count];

        int i = 0;

        foreach (Affinity.Zipcode z in zs)
        {
            returnval[i++] = z.City;
        }

        phreezer.Close();

        return(returnval);
    }
示例#2
0
        /* ~~~ CONSTRAINTS ~~~ */


        /* ~~~ SETS ~~~ */

        /// <summary>
        /// Returns a collection of AttachmentRole objects
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns>Accounts</returns>
        public AttachmentRoles GetAttachmentRoles(AttachmentRolesCriteria criteria)
        {
            Phreezer        p = new Phreezer(System.Configuration.ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);
            AttachmentRoles attachmentRoles = new AttachmentRoles(p);

            attachmentRoles.Query(criteria);
            p.Close();
            return(attachmentRoles);
        }
示例#3
0
    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);
    }
示例#4
0
    public Affinity.Requests GetNewRequests(Affinity.WsToken token)
    {
        Phreezer phreezer = new Phreezer(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);

        Affinity.Requests rs = new Affinity.Requests(phreezer);

        try
        {
            rs.Query(new Affinity.RequestCriteria());
        }
        catch (Exception ex)
        {
        }
        finally
        {
            phreezer.Close();
        }

        return(rs);
    }
示例#5
0
    public string[] GetCompanies(string prefixText, int count)
    {
        Phreezer phreezer = new Phreezer(ConfigurationManager.ConnectionStrings["DBConn"].ConnectionString);

        Affinity.Companys        cs = new Affinity.Companys(phreezer);
        Affinity.CompanyCriteria cc = new Affinity.CompanyCriteria();
        cc.NameBeginsWith = prefixText;
        cc.AppendToOrderBy("Name");
        cc.MaxResults = count;

        cs.Query(cc);
        string[] returnval = new string[cs.Count];

        int i = 0;

        foreach (Affinity.Company c in cs)
        {
            returnval[i++] = c.Name;
        }

        phreezer.Close();

        return(returnval);
    }