コード例 #1
0
        public IHttpActionResult SearchImpackShapes(ProjectImpactShapeSearch data)
        {
            var repos = new TDAssetRespository();

            List <PROJECT_IMPACT_GEOMETRY> results = null;

            var project = tdmEntities.PROJECT_IMPACT.Where(p => p.ID == data.ProjectImpactID).FirstOrDefault();

            results = repos.SearcPROJECT_IMPACT_GEOMETRY(data);

            return(Json(new
            {
                ProjectImpactImportedID = data.ProjectImpactID,
                RequireOtherPage = 0,
                Project = project,
                Detail = results.Select(r => new {
                    Chanode = r.Chanode,
                    Area = r.Area,
                    Shape = r.Shape.WellKnownValue,
                    REG_P_WAH = r.REG_P_WAH,
                    REG_AMT = r.REG_AMT,
                    RVAL_P_WAH = r.RVAL_P_WAH,
                    RVAL_AMT = r.RVAL_AMT,
                    PROVINCE_ID = r.PROVINCE_ID,
                    ProvinceName = r.PROVINCE_ID.Trim() != "" ? tdaEntities.PROVINCEs.Where(p => p.PRO_C == r.PROVINCE_ID).FirstOrDefault().NAME_T : "",
                    AMPHOE_ID = r.AMPHOE_ID,
                    AmphoeName = r.AMPHOE_ID.Trim() != "" ? tdaEntities.AMPHOEs.Where(p => p.DIS_C == r.PROVINCE_ID + r.AMPHOE_ID).FirstOrDefault().NAME_T : "",
                    TAMBOL_ID = r.TAMBOL_ID,
                    TambolName = r.TAMBOL_ID.Trim() != "" ? tdaEntities.TAMBOLs.Where(p => p.SUB_C == r.PROVINCE_ID + r.AMPHOE_ID + r.AMPHOE_ID).FirstOrDefault().NAME_T : ""
                }).ToList(),
                PageNo = data.PageNo,
                Shapes = results.Select(r => r.Shape.WellKnownValue).ToList(),
            }, jsonSetting));
        }