Ejemplo n.º 1
0
        protected override NameValueCollection Values()
        {
            NameValueCollection collection = new NameValueCollection();

            collection.Add("format", "json");

            collection.Add("username", client.GetUsername());
            collection.Add("password", client.GetPassword());

            if (Sender != null)
            {
                collection.Add("from", Sender);
            }

            if (To != null)
            {
                collection.Add("to", string.Join(",", To));
            }

            if (Group != null)
            {
                collection.Add("group", Group);
            }

            collection.Add("message", Text);

            collection.Add("single", (Single ? "1" : "0"));
            collection.Add("nounicode", (NoUnicode ? "1" : "0"));
            collection.Add("flash", (Flash ? "1" : "0"));
            collection.Add("fast", (Fast ? "1" : "0"));

            if (DataCoding != null)
            {
                collection.Add("datacoding", DataCoding);
            }

            if (MaxParts > 0)
            {
                collection.Add("max_parts", MaxParts.ToString());
            }

            if (DateSent != null)
            {
                collection.Add("date", DateSent);
            }

            if (DateExpire != null)
            {
                collection.Add("expiration_date", DateExpire);
            }

            if (Partner != null)
            {
                collection.Add("partner_id", Partner);
            }

            collection.Add("encoding", Encoding);

            if (Normalize == true)
            {
                collection.Add("normalize", "1");
            }

            if (Test == true)
            {
                collection.Add("test", "1");
            }

            if (Idx != null && Idx.Length > 0)
            {
                collection.Add("check_idx", (IdxCheck ? "1" : "0"));
                collection.Add("idx", string.Join("|", Idx));
            }

            if (this.Params != null)
            {
                for (int i = 0; i < this.Params.Length; i++)
                {
                    if (this.Params[i] != null)
                    {
                        collection.Add("param" + ((i + 1).ToString()), this.Params[i]);
                    }
                }
            }

            return(collection);
        }
Ejemplo n.º 2
0
        protected override NameValueCollection Values()
        {
            var collection = new NameValueCollection
            {
                { "format", "json" },
                { "username", client.GetUsername() },
                { "password", client.GetPassword() }
            };



            if (_sender != null)
            {
                collection.Add("from", _sender);
            }

            if (To != null)
            {
                collection.Add("to", string.Join(",", To));
            }

            if (Group != null)
            {
                collection.Add("group", Group);
            }

            collection.Add("message", _text);

            collection.Add("single", (_single ? "1" : "0"));
            collection.Add("nounicode", (_noUnicode ? "1" : "0"));
            collection.Add("flash", (_flash ? "1" : "0"));
            collection.Add("fast", (_fast ? "1" : "0"));

            if (_dataCoding != null)
            {
                collection.Add("datacoding", _dataCoding);
            }

            if (MaxParts > 0)
            {
                collection.Add("max_parts", MaxParts.ToString());
            }

            if (DateSent != null)
            {
                collection.Add("date", DateSent);
            }

            if (_dateExpire != null)
            {
                collection.Add("expiration_date", _dateExpire);
            }

            if (Partner != null)
            {
                collection.Add("partner_id", Partner);
            }

            collection.Add("encoding", _encoding);

            if (_normalize)
            {
                collection.Add("normalize", "1");
            }

            if (Test)
            {
                collection.Add("test", "1");
            }

            if (Idx != null && Idx.Length > 0)
            {
                collection.Add("check_idx", (IdxCheck ? "1" : "0"));
                collection.Add("idx", string.Join("|", Idx));
            }

            if (_details)
            {
                collection.Add("details", "1");
            }

            if (_params != null)
            {
                for (var i = 0; i < _params.Length; i++)
                {
                    if (_params[i] != null)
                    {
                        collection.Add("param" + (i + 1), _params[i]);
                    }
                }
            }

            return(collection);
        }