Ejemplo n.º 1
0
        public override void ProcessRequest(HttpContext context)
        {
            vmJsonResult         r_json_data = null;
            JavaScriptSerializer js          = new JavaScriptSerializer();

            js.MaxJsonLength = 4096;
            String       city    = context.Request.Form["city"];
            String       country = context.Request.Form["country"];
            LogicAddress LBase   = new LogicAddress();

            try
            {
                LBase.Connection = getSQLConnection();

                r_json_data = new vmJsonResult()
                {
                    result = true, data = LBase.GetRoad(city, country)
                };
                context.Response.Write(js.Serialize(r_json_data));
            }
            catch (Exception ex)
            {
                r_json_data = new vmJsonResult()
                {
                    result = false, message = ex.Message + ":" + ex.StackTrace
                };
                context.Response.Write(js.Serialize(r_json_data));
            }
        }
Ejemplo n.º 2
0
        public String ajax_AddrEdit_TW(String val)
        {
            LogicAddress BaseLogic = new LogicAddress()
            {
                Connection = getSQLConnection()
            };

            List <addrInfo> l = new List <addrInfo>();

            foreach (var q in BaseLogic.GetRoadIndex_TW(val.Replace('台', '臺')).SearchData)
            {
                l.Add(new addrInfo()
                {
                    label = q.data, value = q.data, zip = q.zip
                });
            }
            #region 回傳JSON資料

            return(JsonConvert.SerializeObject(l.ToArray(),
                                               new JsonSerializerSettings()
            {
                NullValueHandling = NullValueHandling.Ignore
            }));

            #endregion
        }
Ejemplo n.º 3
0
        protected override void HandleCollectDataToOptions()
        {
            //ViewBag.NewsKind_Option = MakeDropDownOption(ac.GetGroupCodeValue("NewsKind"));
            a_Users ac_User = new a_Users()
            {
                Connection = getSQLConnection()
            };
            LogicAddress address = new LogicAddress()
            {
                Connection = this.getSQLConnection()
            };

            ViewBag.Unit_Option    = MakeCollectDataToOptions(ac_User.MakeOption_Unit(), false);
            ViewBag.City_Option    = MakeCollectDataToOptions(address.GetCity(), false);
            ViewBag.Country_Option = MakeCollectDataToOptions(address.GetCountry(""), false);
        }
Ejemplo n.º 4
0
        public override void ProcessRequest(HttpContext context)
        {
            vmJsonResult r_json_data = null;
            JavaScriptSerializer js = new JavaScriptSerializer();
            js.MaxJsonLength = 4096;
            String city = context.Request.Form["city"];
            LogicAddress LBase = new LogicAddress();

            try
            {
                LBase.Connection = getSQLConnection();

                r_json_data = new vmJsonResult() { result = true, data = LBase.GetCountry(city) };
                context.Response.Write(js.Serialize(r_json_data));
            }
            catch (Exception ex)
            {
                r_json_data = new vmJsonResult() { result = false, message = ex.Message + ":" + ex.StackTrace };
                context.Response.Write(js.Serialize(r_json_data));
            }
        }