Esempio n. 1
0
        /// <summary>
        /// このインスタンスに持っている情報をWebのフォームなどで送信するための
        /// Dictionaryに詰め込みます。
        /// </summary>
        /// <param name="dictionary">情報を詰め込むDictionary</param>
        /// <returns>情報の詰まったDictionary</returns>
        internal Dictionary <string, string> ToFormContent(Dictionary <string, string> dictionary)
        {
            dictionary.Add("count", this.Count.ToString());

            dictionary.Add("offset", this.Offset.ToString());

            if (CreatedGt != DateTimeOffset.MinValue)
            {
                dictionary.Add("created[gt]", HelperImpl.ToUnixTime(CreatedGt));
            }

            if (CreatedGte != DateTimeOffset.MinValue)
            {
                dictionary.Add("created[gte]", HelperImpl.ToUnixTime(CreatedGte));
            }

            if (CreatedLt != DateTimeOffset.MinValue)
            {
                dictionary.Add("created[lt]", HelperImpl.ToUnixTime(CreatedLt));
            }

            if (CreatedLte != DateTimeOffset.MinValue)
            {
                dictionary.Add("created[lte]", HelperImpl.ToUnixTime(CreatedLte));
            }

            return(dictionary);
        }
Esempio n. 2
0
        /// <summary>
        /// 過去に作成した課金のリストを取得します。
        /// </summary>
        /// <param name="list">リストを取得する際の条件</param>
        /// <param name="customerid">課金情報を取得する対象の顧客ID</param>
        /// <returns>課金情報のリスト</returns>
        public ChargeList All(ListRequest list, string customerid)
        {
            string query = string.Empty;

            if (list != null || !string.IsNullOrWhiteSpace(customerid))
            {
                Dictionary <string, string> dic = new Dictionary <string, string>();

                if (list != null)
                {
                    list.ToFormContent(dic);
                }

                if (!string.IsNullOrWhiteSpace(customerid))
                {
                    dic.Add("customer", customerid);
                }

                query = HelperImpl.ToQueryString(dic);
            }

            HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Get, new Uri(parent.BaseUri, "charges?" + query));

            ChargeList retval = this.parent.SendRequest <ChargeList>(message);

            return(retval);
        }
Esempio n. 3
0
        /// <summary>
        /// 顧客のリストを取得します。
        /// </summary>
        /// <param name="list">リストを取得する際の条件</param>
        /// <returns>顧客のリスト</returns>
        public CustomerList All(ListRequest list)
        {
            Dictionary <string, string> dic = list.ToFormContent(new Dictionary <string, string>());
            string             query        = HelperImpl.ToQueryString(dic);
            HttpRequestMessage message      = new HttpRequestMessage(HttpMethod.Get, new Uri(parent.BaseUri, "customers?" + query));

            CustomerList retval = this.parent.SendRequest <CustomerList>(message);

            return(retval);
        }