示例#1
0
        public IHttpActionResult GetResultsPOIs(string radius, string parcel_type, string shapes, string object_id,
                                                string changwatCode, string amphurCode, string tumbonCode, string x, string y, string branchCode)
        {
            var repos       = new TDAssetRespository();
            var result      = new List <dynamic>();
            var _shapes     = JsonConvert.DeserializeObject <List <dynamic> >(shapes);
            var branchCodes = JsonConvert.DeserializeObject <string[]>(Convert.ToString(branchCode));

            if (parcel_type == "1") //CHANOD
            {
                result = repos.GetChanods(_shapes, changwatCode, radius, branchCodes);
            }
            else if (parcel_type == "2") //NS3K
            {
                result = repos.GetNS3Ks(_shapes, changwatCode, radius, branchCodes);
            }
            else
            {
                return(NotFound());
            }

            return(Json(from o in result
                        select new
            {
                OBJECT_ID = o.OBJECTID,
                PARCEL_TYPE = parcel_type == "1" ? "โฉนด" : "น.ส.3ก.",
                CHANOD_NO = Convert.ToString(o.CHANOD_NO),
                LAND_NO = Convert.ToString(o.LAND_NO),
                PASS_THROUGH = "100%",
                VAL_AMT = string.Format("{0:N2}", Convert.ToDecimal(o.VAL_AMT)),
            }));
        }
示例#2
0
        public IHttpActionResult GetResultDetail(string searchCriteria, string radius, string parcel_type, string shapes, string object_id,
                                                 string changwatCode, string amphurCode, string tumbonCode, string x, string y, string branchCode)
        {
            var repos       = new TDAssetRespository();
            var result      = new List <dynamic>();
            var _shapes     = JsonConvert.DeserializeObject <List <dynamic> >(Convert.ToString(shapes));
            var branchCodes = JsonConvert.DeserializeObject <string[]>(Convert.ToString(branchCode));

            switch (parcel_type)
            {
            case "1":     //CHANOD
                result = repos.GetChanods(_shapes, changwatCode, radius, branchCodes);
                break;

            case "2":     //NS3K
                result = repos.GetNS3Ks(_shapes, changwatCode, radius, branchCodes);
                break;

            default:
                return(NotFound());
            }

            var poi = searchCriteria == "condition" ? repos.GetPOI(object_id) : new POI
            {
                NAME_T = "ข้อมูลแปลงที่ดินโดยรวม",
            };

            return(Json(new
            {
                OBJECT_ID = Convert.ToInt32(object_id),
                NAME = Convert.ToString(poi.NAME_T),
                TOTAL_PARCEL_COUNT = string.Format("{0:N0}", result.Count()),
                TOTAL_AREA_RAI = string.Format("{0:N2}", result.Select <dynamic, int>(hd => Convert.ToInt16(hd.NRAI)).Sum() * 400),
                TOTAL_VAL_AMT = string.Format("{0:N2}", result.Select <dynamic, decimal>(o => Convert.ToDecimal(o.VAL_AMT)).Sum()),
            }));
        }