Exemplo n.º 1
0
        internal SimplePricing ResetToList(int id) {
            SimplePricing point = new SimplePricing();
            StringBuilder sb = new StringBuilder(api_domain);
            sb.AppendFormat("ResetToList?key={0}", api_key);

            Dictionary<string, string> post_data = new Dictionary<string, string>();
            post_data.Add("customerID", customerID.ToString());
            post_data.Add("partID", id.ToString());

            string json = UDF.POSTRequest(sb.ToString(), post_data);

            point = JsonConvert.DeserializeObject<SimplePricing>(json);

            return point;
        }
Exemplo n.º 2
0
        internal SimplePricing SetPrice(int partID, decimal price, int isSale = 0, string sale_start = "", string sale_end = "") {
            SimplePricing point = new SimplePricing();
            StringBuilder sb = new StringBuilder(api_domain);
            sb.AppendFormat("SetPrice?key={0}", api_key);

            Dictionary<string, string> post_data = new Dictionary<string, string>();
            post_data.Add("customerID", customerID.ToString());
            post_data.Add("price", price.ToString());
            post_data.Add("partID", partID.ToString());
            post_data.Add("isSale", isSale.ToString());
            post_data.Add("sale_start", (sale_start.Length == 0)?DateTime.Now.ToString():sale_start);
            post_data.Add("sale_end", (sale_end.Length == 0)?DateTime.Now.ToString():sale_end);

            string json = UDF.POSTRequest(sb.ToString(), post_data);
            try {
                point = JsonConvert.DeserializeObject<SimplePricing>(json);
            } catch (Exception) {
                throw new Exception(json);
            }
            
            return point;
        }