Esempio n. 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        int Sid = Common.TypeHelper.ObjectToInt(this.txtSid.Text, 0);

        if (Sid == 0)
        {
            Common.JScript.alert("a", "请输入资源Id", "SearchStock.aspx", this.Page);
            return;
        }

        Common.StockResult SearchData = Common.SearchStock.GetStock(Sid, userseesion.UserName + "-" + WebFramework.GeneralMethodBase.GetKeyConfig(22).Val);

        string Text = "";

        if (SearchData.list != null && SearchData.list.Count > 0)
        {
            foreach (Common.StockListResult model in SearchData.list)
            {
                Text += "资源编号:" + model.SupplierId;
                Text += "  资源名称:" + model.SupplierName;
                Text += "  资源剩余量:" + model.Qty;
                Text += "<br/>";
            }
        }
        else
        {
            Text = "查询失败";
        }

        this.LbSurplus.Text = Text;
    }
Esempio n. 2
0
        //{"status":"true","list":[{"SupplierId":"270","SupplierName":"美团20元优惠券(满20.01使用)","Qty":"105"}]}

        public static StockResult GetStock(int sid, string username)
        {
            //string sid = Common.Fun.ConvertTo<string>(Request["sid"], "0");
            //string username = "******";
            string timestamp = DateTimeToInt(DateTime.Now).ToString();
            string key       = "ESMART_PSI_1766";

            Dictionary <string, string> list = new Dictionary <string, string>();

            list.Add("username", username);
            list.Add("timestamp", timestamp.ToString());
            list.Add("sid", sid.ToString());
            string q = GetAscString(list);

            list.Add("appkey", key);
            string AscString = GetAscString(list);


            string sign = Common.getMD5.MD5(AscString).ToUpper();


            string url = "http://my.eswapi.com/PublicApi/GetStock.aspx";

            string pp = q + "&sign=" + sign + "";

            StockResult result = new StockResult()
            {
                status = "false", list = null
            };

            try
            {
                result = Common.JsonHelper.JsonDeserialize <StockResult>(Common.Fun.webRequestPost(url, pp));
            }
            catch (Exception ex) {
            }
            return(result);
        }