Esempio n. 1
0
        public string Execute(Hashtable res)
        {
            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid = res["UID"].ToString().Trim();

                ListApiResp resp = new ListApiResp();
                resp.Code    = "-1";
                resp.Message = "";

                DictManager dictManager = new DictManager();
                DataTable   dt          = dictManager.GetDictList("05");
                if (dt != null && dt.Rows.Count > 0)
                {
                    List <GetVehicleFaultTypeItem> list = new List <GetVehicleFaultTypeItem>();
                    foreach (DataRow dr in dt.Rows)
                    {
                        GetVehicleFaultTypeItem item = new GetVehicleFaultTypeItem();
                        item.id   = dr["id"].ToString();
                        item.name = dr["name"].ToString();
                        list.Add(item);
                    }
                    resp.List  = list;
                    resp.Total = list.Count;
                    resp.Code  = "0";
                }

                return(JsonConvert.SerializeObject(resp));
            }
        }
Esempio n. 2
0
        public string Execute(Hashtable res)
        {
            if (!string.IsNullOrEmpty(SiteHelper.GetAppsetString("NearParkingKM")))
            {
                km = double.Parse(SiteHelper.GetAppsetString("NearParkingKM"));
            }
            if (!string.IsNullOrEmpty(SiteHelper.GetAppsetString("PageNum")))
            {
                pageNum = int.Parse(SiteHelper.GetAppsetString("PageNum"));
            }

            if (res["Longitude"] == null || res["Longitude"].ToString().Trim().Length <= 0 ||
                res["Latitude"] == null || res["Latitude"].ToString().Trim().Length <= 0 ||
                res["PageNum"] == null || res["PageNum"].ToString().Trim().Length <= 0 ||
                res["CurrentPage"] == null || res["CurrentPage"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                //pageNum = int.Parse(res["PageNum"].ToString().Trim());
                currentPage = int.Parse(res["CurrentPage"].ToString().Trim());
                string longitude = res["Longitude"].ToString().Trim();
                string latitude  = res["Latitude"].ToString().Trim();

                ListApiResp resp = new ListApiResp();
                resp.Code    = "-1";
                resp.Message = "";

                int count = 0;
                ServiceAreaManager areaManager = new ServiceAreaManager();
                DataTable          dt          = areaManager.GetNearParking(km, longitude, latitude, currentPage, pageNum, ref count);
                if (dt != null && dt.Rows.Count > 0)
                {
                    List <GetNearParkingResponseDataItem> list = new List <GetNearParkingResponseDataItem>();
                    foreach (DataRow dr in dt.Rows)
                    {
                        GetNearParkingResponseDataItem item = new GetNearParkingResponseDataItem();
                        item.name   = dr["ThisName"].ToString();
                        item.center = dr["Longitude"].ToString() + "," + dr["Latitude"].ToString();
                        item.points = dr["Coordinates"].ToString();
                        list.Add(item);
                    }
                    resp.List  = list;
                    resp.Total = count;
                    resp.Code  = "0";
                }

                return(JsonConvert.SerializeObject(resp));
            }
        }