Example #1
0
        public IHttpActionResult GetPrice(SearchMap searchDto)
        {
            List <EstimateData> estimateData = null;
            var        repos    = new TDAssetRespository();
            SetionType sectionT = new SetionType();

            /* switch (SectionType)
             * {
             *   case "1":sectionT = SetionType.Region;break;
             *   case "2": sectionT = SetionType.Provice; break;
             *   case "3": sectionT = SetionType.Amphur; break;
             * }*/


            if (searchDto.costEstUnitType == "2") // ราคาซื้อขาย
            {
                estimateData = repos.GetPrice(searchDto);
                estimateData = estimateData.Where(o => (Converting.ToDecimal(o.MarketWAHPrice) >= Converting.ToDecimal(searchDto.costEstMin) &&
                                                        Converting.ToDecimal(o.MarketWAHPrice) <= Converting.ToDecimal(searchDto.costEstMax)))
                               .OrderByDescending(x => Converting.ToDecimal(x.MarketWAHPriceMax)).ToList();
            }
            else
            {
                estimateData = repos.GetPrice(searchDto).Where(o => (Converting.ToDecimal(o.ParcelWAHPrice) >= Converting.ToDecimal(searchDto.costEstMin) &&
                                                                     Converting.ToDecimal(o.ParcelWAHPrice) <= Converting.ToDecimal(searchDto.costEstMax)))
                               .OrderByDescending(x => Converting.ToDecimal(x.ParcelWAHPriceMax)).ToList();
            }


            return(Json(estimateData));
        }
Example #2
0
        public IHttpActionResult GetCondoRegisterMenu2(SearchMap searchDto)
        {
            var        repos    = new TDAssetRespository();
            SetionType sectionT = new SetionType();

            /* switch (SectionType)
             * {
             *   case "1":sectionT = SetionType.Region;break;
             *   case "2": sectionT = SetionType.Provice; break;
             *   case "3": sectionT = SetionType.Amphur; break;
             * }*/

            if (searchDto.FromYear != null && searchDto.FromMonth != null)
            {
                searchDto.FromYearMonth = searchDto.FromYear + Converting.ToInt(searchDto.FromMonth).ToString("##00");
            }

            if (searchDto.ToYear != null && searchDto.ToMonth != null)
            {
                searchDto.ToYearMonth = searchDto.ToYear + Converting.ToInt(searchDto.ToMonth).ToString("##00");
            }

            var estimateData = repos.GetCondoRegisterMenu2(searchDto);

            return(Json(estimateData));
        }
Example #3
0
        public IHttpActionResult GetPriceBI(SearchMap searchDto)
        {
            var                  repos      = new TDAssetRespository();
            SetionType           sectionT   = new SetionType();
            GetPriceBI           resultList = new GetPriceBI();
            List <string>        data       = null;
            List <BarchartValue> value      = null;
            List <BarchartValue> value2     = null;
            BarchartValue        barValue   = null;
            var                  barchart   = new Barchart();
            int                  row        = 0;

            var estimateData = repos.GetPriceBI(searchDto);

            resultList.EstimateData = estimateData.OrderByDescending(o => Converting.ToDecimal(o.ParcelWAHPriceMax))
                                      .ThenBy(c => c.MarketWAHPriceMax).ThenBy(c => c.DisplayName).ToList();
            if (estimateData != null)
            {
                data   = new List <string>();
                value  = new List <BarchartValue>();
                value2 = new List <BarchartValue>();

                row = 0;
                foreach (EstimateData result in estimateData.OrderByDescending(o => Converting.ToDecimal(o.ParcelWAHPriceMax))
                         .ThenBy(c => c.MarketWAHPriceMax).ThenBy(c => c.DisplayName))
                {
                    if (row >= overMax)
                    {
                        break;
                    }
                    barValue       = new BarchartValue();
                    barValue.name  = result.DisplayName;
                    barValue.value = Converting.ToDecimal(result.ParcelWAHPriceMax);
                    barValue.key   = result.DisplayCode;


                    value.Add(barValue);


                    barValue       = new BarchartValue();
                    barValue.name  = result.DisplayName;
                    barValue.value = Converting.ToDecimal(result.MarketWAHPriceMax);
                    barValue.key   = result.DisplayCode;
                    value2.Add(barValue);



                    data.Add(result.DisplayName);
                    row++;
                }

                barchart.Data   = data;
                barchart.Value  = value;
                barchart.Value2 = value2;
            }

            resultList.Barchart = barchart;

            return(Json(resultList));
        }
Example #4
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)),
            }));
        }
        public IHttpActionResult GetSection1EstimateList(SearchMap searchDto)
        {
            var repos        = new TDAssetRespository();
            var estimateData = repos.GetSection1EstimateList(searchDto);

            return(Json(estimateData));
        }
        public IHttpActionResult GetAllProjectImpact(PROJECT_IMPACTDto searchDto)
        {
            var repos        = new TDAssetRespository();
            var estimateData = repos.GetPROJECT_IMPACT(searchDto);

            return(Json(estimateData));
        }
        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));
        }
        public IHttpActionResult UpdateProject(PROJECT_IMPACT project)
        {
            try
            {
                var repos = new TDAssetRespository();

                PROJECT_IMPACT updateProject = tdmEntities.PROJECT_IMPACT.First(x => x.ID == project.ID);

                updateProject.IS_DELETED   = project.IS_DELETED;
                updateProject.SUBJECT_ID   = project.SUBJECT_ID;
                updateProject.SUBJECT_NAME = project.SUBJECT_NAME;
                updateProject.PUBLISH_DATE = project.PUBLISH_DATE;
                updateProject.IS_PUBLISHED = project.IS_PUBLISHED;
                updateProject.UPDATE_BY    = project.UPDATE_BY;
                updateProject.UPDATE_DATE  = project.UPDATE_DATE;
                updateProject.CREATE_DATE  = project.CREATE_DATE;
                updateProject.CREATE_BY    = project.CREATE_BY;
                updateProject.PROVINCE_ID  = project.PROVINCE_ID;
                updateProject.AMPHOE_ID    = project.AMPHOE_ID;
                updateProject.TAMBOL_ID    = project.TAMBOL_ID;
                updateProject.Shape        = project.Shape != null ? project.Shape : null;
                tdmEntities.SaveChanges();

                repos.AddPROJECT_IMPACT_GEOMETRY(updateProject);

                return(Json(project, jsonSetting));
            }
            catch (Exception ex)
            {
                return(Json(ex));
            }
        }
Example #9
0
        public IHttpActionResult GetAddressList()
        {
            var         repos    = new TDAssetRespository();
            AddressList addrList = new AddressList();



            return(Json(repos.GetAddressList(null)));
        }
Example #10
0
        private List <Models.EstimateData> GetMapInfo(MapSearchCriteria criteria)
        {
            List <Models.EstimateData> result = new List <Models.EstimateData>(0);
            var repos = new TDAssetRespository();
            List <EstimateData> searchResult = null;

            if (criteria.AreaType == "1")
            {
                searchResult = repos.GetPrice(new SearchMap()
                {
                    SectionType = criteria.Type,
                    Code        = criteria.ID,
                    ChanodeNo   = criteria.ChanodeNo
                });
            }
            else if (criteria.AreaType == "2")
            {
                searchResult = repos.GetCondoPrice(new SearchMap()
                {
                    SectionType = criteria.Type,
                    Code        = criteria.ID,
                    ChanodeNo   = criteria.ChanodeNo
                });
            }

            if (searchResult != null && searchResult.Count() > 0)
            {
                if (criteria.CostEstUnitType == "2") // ราคาซื้อขาย
                {
                    searchResult = searchResult.Where(o => (Converting.ToDecimal(o.MarketWAHPrice) >= Converting.ToDecimal(criteria.CostEstMin) && Converting.ToDecimal(o.MarketWAHPrice) <= Converting.ToDecimal(criteria.CostEstMax))).ToList();
                }
                else
                {
                    searchResult = searchResult.Where(o => (Converting.ToDecimal(o.ParcelWAHPrice) >= Converting.ToDecimal(criteria.CostEstMin) && Converting.ToDecimal(o.ParcelWAHPrice) <= Converting.ToDecimal(criteria.CostEstMax))).ToList();
                }


                foreach (EstimateData data in searchResult)
                {
                    data.Name = data.DisplayName;

                    data.MapStructure = new Models.ViewModels.MapStructureInfo()
                    {
                        ParcelDrawingCode = (criteria.AreaType == "2") ? "poin" : data.ParcelColor,
                        MarketDrawingCode = (criteria.AreaType == "2") ? "poin" : data.MarketColor,

                        Shape = data.Shape.ToString()
                    };
                    data.PriceType       = criteria.PriceType;
                    data.CostEstUnitType = criteria.CostEstUnitType;
                    data.AreaType        = criteria.AreaType;
                }
            }

            return(searchResult);
        }
Example #11
0
        public IHttpActionResult GetPriceOfCondo(SearchMap searchDto)
        {
            var        repos    = new TDAssetRespository();
            SetionType sectionT = new SetionType();


            var estimateData = repos.GetPriceOfCondo(searchDto);

            return(Json(estimateData));
        }
Example #12
0
 protected MapController()
 {
     tdmEntities = new TDManagementEntities();
     tdaEntities = new TDASSETEntities();
     cmEntities  = new commonEntities();
     repos       = new TDAssetRespository();
     tdmEntities.Configuration.ProxyCreationEnabled = false;
     tdaEntities.Configuration.ProxyCreationEnabled = false;
     cmEntities.Configuration.ProxyCreationEnabled  = false;
 }
Example #13
0
        public IHttpActionResult GetDropDownList(string Code)
        {
            var        repos    = new TDAssetRespository();
            SetionType sectionT = new SetionType();



            var estimateData = repos.GetDropDownList(Code);

            return(Json(estimateData));
        }
Example #14
0
        public IHttpActionResult GetPOIDetailCondominiums(string object_id, string radius, string parcel_type, string changwatCode, string chanod_no)
        {
            var tdRepo = new TDAssetRespository();
            var result = new[] { 1, 2 };
            var data   = from o in result
                         select new
            {
                B = 1,
            };

            return(Json(data));
        }
Example #15
0
        public JsonResult TakeSession(string userId)
        {
            //  string userId = (System.Web.HttpContext.Current.Request != null && System.Web.HttpContext.Current.Request.Form["UserId"]!= null) ? System.Web.HttpContext.Current.Request.Form["UserId"]:"" ;
            repos = new TDAssetRespository();

            if (System.Web.HttpContext.Current.Session["UserPermission"] == null && userId != "")
            {
                userProfile = repos.GetPermission(userId);
                System.Web.HttpContext.Current.Session.Add("UserPermission", userProfile);
            }
            else
            {
                userProfile = (UserProFile)System.Web.HttpContext.Current.Session["UserPermission"];
            }

            return(Json(userProfile));
        }
Example #16
0
        public IHttpActionResult GetLandRatio(SearchMap searchDto)
        {
            var        repos    = new TDAssetRespository();
            SetionType sectionT = new SetionType();

            /* switch (SectionType)
             * {
             *   case "1":sectionT = SetionType.Region;break;
             *   case "2": sectionT = SetionType.Provice; break;
             *   case "3": sectionT = SetionType.Amphur; break;
             * }*/


            var estimateData = repos.GetLandRatio(searchDto);

            return(Json(estimateData));
        }
Example #17
0
        public IHttpActionResult GetPOIDetail(string object_id, string radius, string parcel_type, string changwatCode, string chanod_no)
        {
            var tdRepo = new TDAssetRespository();

            dynamic o;

            if (parcel_type == "1") //CHANOD
            {
                o = tdRepo.GetChanodDetail(object_id, changwatCode, chanod_no);
            }
            else if (parcel_type == "2") //NS3K
            {
                o = tdRepo.GetNS3KDetail(object_id, changwatCode, chanod_no);
            }
            else
            {
                return(NotFound());
            }

            var data = new
            {
                PARCEL_TYPE   = GetParcelTypeName(Convert.ToString(o.PARCEL_TYPE)),
                UTMMAP1       = Convert.ToString(o.UTMMAP1),
                UTMMAP3       = Convert.ToString(o.UTMMAP3),
                SURVEY_NO     = Convert.ToInt16(o.SURVEY_NO),
                CHANOD_NO     = Convert.ToInt16(o.CHANOD_NO),
                LAND_NO       = Convert.ToInt16(o.LAND_NO),
                BRANCH_CODE   = Convert.ToString(o.BRANCH_CODE),
                CHANGWAT_CODE = o.CHANGWAT_CODE,
                CHANGWAT_NAME = o.CHANGWAT_NAME,
                AMPHUR_CODE   = o.AMPHUR_CODE,
                AMPHUR_NAME   = o.AMPHUR_NAME,
                TUMBON_CODE   = o.TUMBON_CODE,
                TUMBON_NAME   = o.TUMBON_NAME,
                NRAI          = Convert.ToInt16(o.NRAI),
                NNHAN         = Convert.ToInt16(o.NNHAN),
                NWAH          = Convert.ToInt16(o.NWAH),
                DREMAIN       = Convert.ToDecimal(o.DREMAIN),
                PASS_THROUGH  = "100%",
                OWNERS        = 0,
                VAL_AMT       = string.Format("{0:N2}", Convert.ToDecimal(o.VAL_AMT)),
            };

            return(Json(data));
        }
Example #18
0
        public IHttpActionResult GetConstructionType()
        {
            var repos = new TDAssetRespository();


            /* switch (SectionType)
             * {
             *   case "1":sectionT = SetionType.Region;break;
             *   case "2": sectionT = SetionType.Provice; break;
             *   case "3": sectionT = SetionType.Amphur; break;
             * }*/



            var results = repos.GetConstructionType();

            return(Json(results));
        }
Example #19
0
        public IHttpActionResult GetPriceOfConstruction(SearchMap searchDto)
        {
            var        repos    = new TDAssetRespository();
            SetionType sectionT = new SetionType();

            /* switch (SectionType)
             * {
             *   case "1":sectionT = SetionType.Region;break;
             *   case "2": sectionT = SetionType.Provice; break;
             *   case "3": sectionT = SetionType.Amphur; break;
             * }*/



            var estimateData = repos.GetPriceOfConstrucion(searchDto);

            return(Json(estimateData.OrderByDescending(o => Converting.ToDecimal(o.ParcelPrice)).ToList()));
        }
        public IHttpActionResult AddProject(PROJECT_IMPACT project)
        {
            var repos = new TDAssetRespository();

            try
            {
                project.ID = 0;
                PROJECT_IMPACT saveProject = tdmEntities.PROJECT_IMPACT.Add(project);
                tdmEntities.SaveChanges();

                repos.AddPROJECT_IMPACT_GEOMETRY(saveProject);

                return(Json(saveProject, jsonSetting));
            }
            catch (Exception ex)
            {
                return(Json(ex));
            }
        }
Example #21
0
        public IHttpActionResult GetPOIs(string changwatCode, string amphurCode, string tumbonCode)
        {
            var repos = new TDAssetRespository();
            var pois  = repos.GetPOIs(changwatCode, amphurCode, tumbonCode);

            return(Json(from q in pois
                        select
                        new
            {
                OBJECT_ID = q.OBJECTID,
                NAME = q.NAME_T,
                X = q.X,
                Y = q.Y,
                CHANGWAT_NAME = q.PROV_NAME_T,
                TUMBON_NAME = q.TUMB_NAME_T,
                AMPHUR_NAME = q.AMPH_NAME_T,
                TUMBON_CODE = q.TUMB_CODE,
            }
                        ));
        }
Example #22
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()),
            }));
        }
Example #23
0
        //private List<Models.ViewModels.MAP_ViewModel> GetMapInfo(SetionType type, string code)
        private List <Models.ViewModels.MAP_ViewModel> GetMapInfo1(MapSearchCriteria criteria)
        {
            List <Models.ViewModels.MAP_ViewModel> result = new List <Models.ViewModels.MAP_ViewModel>(0);
            var repos = new TDAssetRespository();
            List <EstimateData> searchResult = null;

            if (criteria.AreaType == "1")
            {
                searchResult = repos.GetPrice(new SearchMap()
                {
                    SectionType = criteria.Type,
                    Code        = criteria.ID,
                    ChanodeNo   = criteria.ChanodeNo
                });
            }
            else if (criteria.AreaType == "2")
            {
                searchResult = repos.GetCondoPrice(new SearchMap()
                {
                    SectionType = criteria.Type,
                    Code        = criteria.ID,
                    ChanodeNo   = criteria.ChanodeNo
                });
            }

            if (searchResult != null && searchResult.Count() > 0)
            {
                result = searchResult.Select(r => new TDM.Models.ViewModels.MAP_ViewModel()
                {
                    Name = r.DisplayName,

                    ParcelPrice    = criteria.ChanodeNo == null ? DecimalHelper.ToDecimal(r.ParcelPrice, -1) :  DecimalHelper.ToDecimal(r.ParcelWAHPrice, -1),
                    ParcelPriceMin = DecimalHelper.ToDecimal(r.ParcelWAHPriceMin, -1),
                    ParcelPriceMax = DecimalHelper.ToDecimal(r.ParcelWAHPriceMax, -1),
                    ParcelPriceAvg = DecimalHelper.ToDecimal(r.ParcelWAHPriceAvg, -1),

                    MarketPrice    = criteria.ChanodeNo == null ? DecimalHelper.ToDecimal(r.MarketPrice, -1) : DecimalHelper.ToDecimal(r.ParcelWAHPrice, -1),
                    MarketPriceMin = DecimalHelper.ToDecimal(r.MarketWAHPriceMin, -1),
                    MarketPriceMax = DecimalHelper.ToDecimal(r.MarketWAHPriceMax, -1),
                    MarketPriceAvg = DecimalHelper.ToDecimal(r.MarketWAHPriceAvg, -1),
                    LATITUDE       = r.LATITUDE,
                    LONGITUDE      = r.LONGITUDE,
                    MapStructure   = new Models.ViewModels.MapStructureInfo()
                    {
                        ParcelDrawingCode = (criteria.AreaType == "2")? "poin" : r.ParcelColor,
                        MarketDrawingCode = (criteria.AreaType == "2")? "poin" : r.MarketColor,

                        Shape = r.Shape.ToString()
                    },
                    MaxPrice = false,
                    MinPrice = false,

                    PriceType       = criteria.PriceType,
                    CostEstUnitType = criteria.CostEstUnitType,
                    AreaType        = criteria.AreaType
                }).ToList();

                if (result.Count() > 1)
                {
                    if (criteria.PriceType == "1")
                    {
                        result = result.OrderBy(r => r.ParcelPrice).ToList();
                        var target = result.Where(rs => rs.ParcelPrice > 0);
                        if (target.Any())
                        {
                            var max = target.Max(t => t.ParcelPrice);
                            var min = target.Min(t => t.ParcelPrice);
                            if (max != min)
                            {
                                result.Where(rs => rs.ParcelPrice == min).ToList().ForEach(r => r.MinPrice = true);
                                result.Where(rs => rs.ParcelPrice == max).ToList().ForEach(r => r.MaxPrice = true);
                            }
                        }
                    }
                    else
                    {
                        result = result.OrderBy(r => r.MarketPrice).ToList();
                        var target = result.Where(rs => rs.MarketPrice > 0);

                        if (target.Any())
                        {
                            var max = target.Max(t => t.MarketPrice);
                            var min = target.Min(t => t.MarketPrice);
                            if (max != min)
                            {
                                result.Where(rs => rs.MarketPrice == min).ToList().ForEach(r => r.MinPrice = true);
                                result.Where(rs => rs.MarketPrice == max).ToList().ForEach(r => r.MaxPrice = true);
                            }
                        }
                    }
                }

                result = ExecuteClientCriteria(criteria, result);
            }

            return(GetRandomColor(result));
        }
        public IHttpActionResult GetAllProjectImpactBI(SearchMap searchDto)
        {
            var repos = new TDAssetRespository();

            GetProjectImpacteBI  resultList = new GetProjectImpacteBI();
            List <string>        data       = null;
            List <BarchartValue> value      = null;
            List <BarchartValue> value2     = null;
            BarchartValue        barValue   = null;
            var barchart = new Barchart();
            int row      = 0;

            if (searchDto.SectionType == SetionType.Region)
            {
                searchDto.RegionCode = searchDto.Code;
            }
            else if (searchDto.SectionType == SetionType.Provice)
            {
                searchDto.ProvinceCode = searchDto.Code;
            }
            var estimateData = repos.GetPROJECT_IMPACT(searchDto);

            if (estimateData != null)
            {
                resultList.EstimateData = estimateData.OrderByDescending(o => o.ParcelTotal).ToList();

                data   = new List <string>();
                value  = new List <BarchartValue>();
                value2 = new List <BarchartValue>();

                foreach (PROJECT_IMPACTDto result in estimateData.OrderByDescending(o => o.ParcelTotal))
                {
                    if (row >= overMax)
                    {
                        break;
                    }


                    barValue       = new BarchartValue();
                    barValue.name  = result.SUBJECT_NAME;
                    barValue.value = Converting.ToDecimal(result.ParcelTotal);
                    barValue.key   = result.SUBJECT_ID;


                    value.Add(barValue);


                    barValue       = new BarchartValue();
                    barValue.name  = result.SUBJECT_NAME;
                    barValue.value = Converting.ToDecimal(result.Area);
                    barValue.key   = result.SUBJECT_ID;
                    value2.Add(barValue);



                    data.Add(result.SUBJECT_NAME);

                    row++;
                }

                barchart.Data   = data;
                barchart.Value  = value;
                barchart.Value2 = value2;
            }

            resultList.Barchart = barchart;


            return(Json(resultList));
        }
Example #25
0
        public IHttpActionResult GetPriceOfConstructionBI(SearchMap searchDto)
        {
            var                   repos      = new TDAssetRespository();
            SetionType            sectionT   = new SetionType();
            int                   row        = 0;
            GetPriceBI            resultList = new GetPriceBI();
            List <string>         data       = null;
            List <BarchartValue>  value      = null;
            List <BarchartValue2> value2     = null;
            BarchartValue         barValue   = null;
            BarchartValue2        barValue3  = null;
            var                   barchart   = new Barchart();


            var estimateData = repos.GetPriceOfConstrucionBI(searchDto);

            resultList.EstimateData = resultList.EstimateData = estimateData.OrderByDescending(o => Converting.ToDecimal(o.ParcelPrice)).ToList();

            if (estimateData != null)
            {
                data   = new List <string>();
                value  = new List <BarchartValue>();
                value2 = new List <BarchartValue2>();

                foreach (EstimateData result in estimateData.OrderByDescending(o => Converting.ToDecimal(o.ParcelPrice)))
                {
                    if (row >= overMax)
                    {
                        break;
                    }
                    barValue       = new BarchartValue();
                    barValue.name  = result.DisplayName;
                    barValue.value = Converting.ToDecimal(result.ParcelPrice);
                    barValue.key   = result.DisplayCode;


                    value.Add(barValue);



                    //  { xAxis: 0, y: 350, name: 'Line', symbolSize: 20, symbol: 'image://../asset/ico/折线图.png' }
                    barValue3            = new BarchartValue2();
                    barValue3.xAxis      = 0;
                    barValue3.y          = 350;
                    barValue3.name       = result.DisplayName;
                    barValue3.symbolSize = 20;
                    barValue3.symbol     = "";

                    barValue3.key = result.DisplayCode;
                    value2.Add(barValue3);



                    data.Add(result.DisplayName);


                    row++;
                }

                barchart.Data   = data;
                barchart.Value  = value;
                barchart.Value3 = value2;
            }

            resultList.Barchart = barchart;


            return(Json(resultList));
        }