コード例 #1
0
        public static void SubscribeExpress100(string companyCode, string number)
        {
            string newKey = GetNewKey();

            if (!string.IsNullOrEmpty(newKey) && ((companyCode != "") && (number != "")))
            {
                WebClient           client  = new WebClient();
                NameValueCollection data    = new NameValueCollection();
                StringBuilder       builder = new StringBuilder();
                builder.Append("{");
                builder.AppendFormat("\"company\":\"{0}\",", companyCode);
                builder.AppendFormat("\"number\":\"{0}\",", number);
                builder.AppendFormat("\"key\":\"{0}\",", newKey);
                string str2 = "http://" + HttpContext.Current.Request.Url.Host + "/API/ExpressReturn.ashx?action=SaveExpressData";
                builder.AppendFormat("\"parameters\":{0}\"callbackurl\":\"{1}\"{2}", "{", str2, "}");
                builder.Append("}");
                data.Add("schema", "json");
                data.Add("param", builder.ToString());
                try
                {
                    byte[] bytes = client.UploadValues("http://www.kuaidi100.com/poll", "POST", data);
                    string log   = Encoding.UTF8.GetString(bytes);
                    Globals.Debuglog("returnUrl:" + str2, "_Debuglog.txt");
                    Globals.Debuglog(log, "_Debuglog.txt");
                }
                catch (Exception)
                {
                }
            }
        }
コード例 #2
0
 public static void DelImgByFilePath(string savePath)
 {
     try
     {
         if (!savePath.ToLower().Contains("headlogo.jpg") && !savePath.ToLower().Contains("/distributorlogopic/") && !savePath.ToLower().Contains("/storage/master/logo/") && File.Exists(savePath))
         {
             string a = Path.GetExtension(savePath).ToLower();
             if (a == ".gif" || a == ".jpg" || a == ".png" || a == ".jpeg")
             {
                 File.Delete(savePath);
             }
         }
     }
     catch (Exception ex)
     {
         Globals.Debuglog(ex.ToString(), "_DebuglogDelFile.txt");
     }
 }