Example #1
0
        /*****************chaojie1124j********************/
        public HttpResponseBase GetZip()
        {
            Zip zip = new Zip();
            List<Zip> zipList = new List<Zip>();
            int resultzip = 0;
            if (!string.IsNullOrEmpty(Request.Params["big_code"]))
            {
                zip.bigcode = Request.Params["big_code"];
                resultzip = 1;
            }
            if (!string.IsNullOrEmpty(Request.Params["c_midcode"]))
            {
                zip.middlecode = Request.Params["c_midcode"];
                resultzip = 1;
            }
            if (!string.IsNullOrEmpty(Request.Params["c_zipcode"]))
            {
                zip.zipcode = Request.Params["c_zipcode"];
                resultzip = 1;
            }

            string jsonStr = string.Empty;
            try
            {
                zMgr = new ZipMgr(connectionString);
                zipList = zMgr.GetZipList(zip);
                if (zipList.Count > 0 && resultzip > 0)
                {
                    jsonStr = "{success:true,msg:\"" + zipList[0].big + "  " + zipList[0].middle + "  " + zipList[0].zipcode + "/" + zipList[0].small.Trim() + "\"}";
                }
                else
                {
                    jsonStr = "{success:true,msg:\"" + 100 + "\"}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                jsonStr = "{success:false}";
            }
            this.Response.Clear();
            this.Response.Write(jsonStr);
            this.Response.End();
            return this.Response;
        }