public IActionResult GetListToTree(string parentId)
        {
            var resultCountModel = new RespResultCountViewModel();

            try
            {
                var data = parentId != null?_areaService.GetAll().Where(it => it.ParentId != parentId) : _areaService.GetAll();

                var resData = LayuixTree.CreateTree(
                    data.Where(it => it.ParentId == "0" || it.ParentId == null).Select(x => new TreeObject {
                    id = x.AreaId, name = x.AreaName, @checked = true, open = true
                }).ToList(),
                    data.Where(it => it.ParentId != "0" || it.ParentId != null).Select(x => new TreeObject {
                    id = x.AreaId, name = x.AreaName, pId = x.ParentId, @checked = true, open = true
                }).ToList()
                    );
                if (resData != null)
                {
                    return(Ok(resData));
                }
                else
                {
                    resultCountModel.code = -1;
                    resultCountModel.msg  = "没有检索到数据";
                    return(Ok(resultCountModel));
                }
            }
            catch (Exception ex)
            {
                resultCountModel.code = -1;
                resultCountModel.msg  = "操作失败:" + ex.ToString();
                return(Ok(resultCountModel));
            }
        }
Example #2
0
        public override AreaViewModel Initialize()
        {
            var retVal = base.Initialize();

            retVal.Areas = new ObservableCollection <Area>(mAreaService.GetAll());

            return(retVal);
        }
Example #3
0
        public ActionResult Create(int?id)
        {
            if (id != null)
            {
                ViewBag.IdArea = id;
            }
            var areas               = _areaService.GetAll();
            var assetTypes          = _assetTypeService.GetActive();
            var assetTypeViewModels = Mapper.Map <IEnumerable <AssetType>, IEnumerable <AssetTypeViewModel> >(assetTypes);
            var areaViewModels      = Mapper.Map <IEnumerable <Area>, IEnumerable <AreaViewModel> >(areas);

            ViewBag.AreaID      = new SelectList(areaViewModels, "ID", "Name");
            ViewBag.AssetTypeID = new SelectList(assetTypeViewModels, "ID", "Name");
            return(View());
        }
Example #4
0
        private void SaveUpdateValidate(Seat seat, IAreaService @as)
        {
            var asAll = @as.GetAll();
            var all   = GetAll();

            if (!(from x in asAll where x.Id == seat.AreaId select x).Any())
            {
                throw new Exception("No such area");
            }
            var r = from x in asAll where x.Id == seat.AreaId select x;

            if (r.Any())
            {
                int coordX = @as.Get(seat.AreaId).CoordX;
                int coordY = @as.Get(seat.AreaId).CoordY;
                int lid    = r.First().LayoutId;
                if ((from x in asAll
                     where x.Id != seat.AreaId && x.LayoutId == lid && x.CoordX > coordX && x.CoordY > coordY &&
                     (coordX + seat.Row >= x.CoordX || coordY + seat.Number >= x.CoordY)
                     select x).Any())
                {
                    throw new Exception("Seat coords out of range");
                }
            }
        }
Example #5
0
        public void IsNotNullAreaListGetAllServiceTest()
        {
            var list = _service.GetAll();

            Assert.IsNotNull(list);
            Assert.IsInstanceOfType(list, typeof(List <AreaDto>));
        }
Example #6
0
 protected override void Initialize(RequestContext requestContext)
 {
     base.Initialize(requestContext);
     currentUser          = (User)Session[AccountController.USER_SESSION_ID];
     warehouseSevices     = new WareHouseServices();
     areaService          = new AreaService();
     ViewData["location"] = new SelectList(areaService.GetAll(x => x.trading_yn.Value == true), "Id", "AreaAddress");
 }
Example #7
0
        //[Authorize(Roles = nameof(PermissionProvider.ViewGroup))]
        public HttpResponseMessage GetAll(HttpRequestMessage request)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;
                var model = _areaService.GetAll();
                response = request.CreateResponse(HttpStatusCode.OK, model);

                return response;
            }));
        }
 public IHttpActionResult GetAreas()
 {
     try
     {
         ICollection <Area> areas = _areaService.GetAll();
         return(base.Ok(_areaResponseFactory.Create(areas)));
     }
     catch (Exception ex)
     {
         _logger.Error(ex, "Failed to GetAreas");
         return(InternalServerError(ex, "Failed to GetAreas"));
     }
 }
        public async Task <IActionResult> GetAll()
        {
            try
            {
                var result = await _areaService.GetAll();

                return(Ok(result));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Example #10
0
        public ActionResult ForeignCategory()
        {
            MenuGeographyVm model              = new MenuGeographyVm();
            var             modelContinent     = _continentService.GetAll(true);
            var             modelCountryRegion = _countryRegionService.GetAll(true);
            var             modelStateProvince = _stateProvinceService.GetAll(true);
            var             modelArea          = _areaService.GetAll(true);

            model.Continents     = Mapper.Map <List <ContinentVm> >(modelContinent);
            model.CountryRegions = Mapper.Map <List <CountryRegionVm> >(modelCountryRegion);
            model.StateProvinces = Mapper.Map <List <StateProvinceVm> >(modelStateProvince);
            model.Areas          = Mapper.Map <List <AreaVm> >(modelArea);
            return(PartialView(model));
        }
Example #11
0
        // GET: PIC/Edit/5
        public ActionResult Edit(int id, FormCollection form)
        {
            var picModel = _PICService.GetById(id, new string[] { "Area", "ApplicationUser", "AssetType" });

            var areaModel = _areaService.GetAll();

            var assetTypeModel = _assetTypeService.GetAll();

            var userModel = applicationUserManager.Users.ToList();

            ViewBag.areaViewModel = Mapper.Map <IEnumerable <Area>, IEnumerable <AreaViewModel> >(areaModel);

            ViewBag.userViewModel = Mapper.Map <IEnumerable <ApplicationUser>, IEnumerable <UserViewModel> >(userModel);

            ViewBag.assetTypeViewModel = Mapper.Map <IEnumerable <AssetType>, IEnumerable <AssetTypeViewModel> >(assetTypeModel);

            if (picModel == null)
            {
                return(HttpNotFound());
            }
            var viewModel = Mapper.Map <PIC, PICViewModel>(picModel);

            return(View(viewModel));
        }
Example #12
0
        public JsonResult GetJsonByCountry(long CountryId)
        {
            IEnumerable <Area> AreaList   = areaService.GetAll(x => x.CountryId.Value == CountryId);
            List <AreaModel>   AreaModels = new List <AreaModel>();

            foreach (Area Area1 in AreaList)
            {
                AreaModel AreaModel1 = new AreaModel();
                AreaModel1.Id          = Area1.Id;
                AreaModel1.AreaAddress = Area1.AreaAddress;
                AreaModel1.CountryId   = CountryId;
                AreaModels.Add(AreaModel1);
            }
            return(this.Json(AreaModels, JsonRequestBehavior.AllowGet));
        }
        public ActionResult BuyerRegistration()
        {
            List <SelectListItem> areaList = new List <SelectListItem>();

            foreach (Area area in areaService.GetAll())
            {
                areaList.Add(new SelectListItem()
                {
                    Text = area.AreaName, Value = area.Id.ToString()
                });
            }

            ViewBag.AreaList = areaList;

            return(View());
        }
Example #14
0
        public async Task <Base.PagedResultDto <AreaDto> > GetAll(QueryAreaFilter filter)
        {
            var result = new Base.PagedResultDto <AreaDto>();
            var areas  = await _areaService.GetAll(new Service.AreaService.Dto.QueryAreaFilter()
            {
                PageCount = filter.PageCount,
                page      = filter.page,
                limit     = filter.limit,
                Sort      = filter.Sort,
                ZipCode   = filter.ZipCode,
                City      = filter.City,
                State     = filter.State,
                Street    = filter.Street
            });

            result.Items      = _mapper.Map <List <AreaDto> >(areas.Items);
            result.TotalCount = areas.TotalCount;
            return(result);
        }
Example #15
0
        public bool Delete(int id, IAreaService a, IEventSeatService es, IEventAreaService ea)
        {
            var all   = GetAll();
            var aAll  = a.GetAll();
            var eaAll = ea.GetAll();
            var esAll = es.GetAll();

            var r = from seat in  all
                    join area in aAll on seat.AreaId equals area.Id
                    join eventArea in eaAll on area.LayoutId equals eventArea.LayoutId
                    join eventSeat in esAll on eventArea.Id equals eventSeat.EventAreaId
                    where eventSeat.State != 0 &&
                    seat.Id == id
                    select seat;

            if (r.Any())
            {
                throw new Exception("Try to delete locked seat");
            }
            return(Repository.Delete(id));
        }
Example #16
0
        private void UpdateGridAreaData()
        {
            var totalRow = 0;
            var page     = areaGrid.Pager;
            var sort     = new SSM.Services.SortField(string.IsNullOrEmpty(page.Sidx) ? "AreaAddress" : page.Sidx, page.Sord == "asc");

            var area = new Area();

            if (areaGrid.SearchCriteria != null)
            {
                area = new Area
                {
                    AreaAddress = areaGrid.SearchCriteria.AreaAddress,
                    CountryId   = areaGrid.SearchCriteria.CountryId,
                    trading_yn  = areaGrid.SearchCriteria.IsTrading,
                };
            }
            var qr = areaService.GetAll(area);

            if (!CurrenUser.IsAdmin())
            {
                qr = qr.Where(x => x.IsHideUser == false);
            }
            qr       = qr.OrderBy(sort);
            totalRow = qr.Count();
            areaGrid.Pager.Init(totalRow);
            List <AreaModel> list = new List <AreaModel>();

            if (totalRow == 0)
            {
                areaGrid.Data = list;
                return;
            }
            var data = areaService.GetListPager(qr, page.CurrentPage, page.PageSize);

            list.AddRange(data.Select(db => Mapper.Map <AreaModel>(db)));
            areaGrid.Data = list;
        }
 public Task <IEnumerable <AreaDto> > AreaManagementGetAll()
 {
     return(_areaService.GetAll());
 }
Example #18
0
 public IEnumerable <AreaViewModel> GetAll()
 {
     return(Mapper.Map <IEnumerable <Area>, IEnumerable <AreaViewModel> >(_areaService.GetAll()));
 }
Example #19
0
        public IActionResult Index(int pageIndex)
        {
            var areas = _areaService.GetAll(pageIndex);

            return(Ok(areas));
        }
Example #20
0
 public Response <List <Area> > AreaGetAll()
 {
     return(areaService.GetAll());
 }
        public IActionResult GetAll()
        {
            var areas = areaService.GetAll();

            return(Ok(areas));
        }
 public IActionResult GetAll(int?pageSize = 10, int?pageNumber = 1, string q = null)
 {
     return(_areaService.GetAll(pageSize, pageNumber, q));
 }
Example #23
0
        public IHttpActionResult Get()
        {
            var list = _areaService.GetAll();

            return(Json(list));
        }
Example #24
0
        public async Task <IActionResult> Get(int currentPage = 0)
        {
            var result = _areaService.GetAll();

            return(await GetPagedData(result, currentPage));
        }