Beispiel #1
0
 public IHttpActionResult GetNumberOfEmptySlot(int areaId)
 {
     try
     {
         var areaApi = new AreaApi();
         var area    = areaApi.GetAreaWithEmptyNumber(areaId);
         if (area == null || area.Active == false)
         {
             return(Json(new
             {
                 success = false,
             }));
         }
         else
         {
             return(Json(new
             {
                 result = area.EmptyAmount,
                 success = true,
             }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             success = false,
         }));
     }
 }
Beispiel #2
0
 public IHttpActionResult UpdateStatus(AreaUpdateViewModel model)
 {
     try
     {
         var areaApi = new AreaApi();
         var result  = areaApi.UpdateStatus(model);
         if (result)
         {
             return(Json(new ResultModel
             {
                 message = "Cập nhập thành công",
                 success = true,
             }));
         }
         else
         {
             return(Json(new ResultModel
             {
                 message = "Có chỗ đậu đang sử dụng, vui lòng cập nhật sau",
                 success = false,
             }));
         }
     }
     catch (Exception ex)
     {
         return(Json(new ResultModel
         {
             message = "Có lỗi xảy ra, vui lòng liên hệ admin",
             success = false,
         }));
     }
 }
Beispiel #3
0
        public static List <FxtApi_SYSArea> GetAreaByCityName(string cityName)
        {
            if (string.IsNullOrEmpty(cityName))
            {
                return(new List <FxtApi_SYSArea>());
            }
            List <FxtApi_SYSArea> list = AreaApi.GetAreaByCityName(cityName);

            return(list);
        }
Beispiel #4
0
 public HttpResponseMessage PutArea(int id, AreaApi a)
 {
     if (userDto.TokenIsValid(a.Email, a.Token))
     {
         if (ModelState.IsValid)
         {
             Geodeta.Services.Area area     = this.areaDto.PutArea(id, a);
             HttpResponseMessage   response = Request.CreateResponse(HttpStatusCode.Created, area);
             response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = area.ID }));
             return(response);
         }
     }
     return(Request.CreateResponse(HttpStatusCode.OK));
 }
Beispiel #5
0
        public ActionResult AddProject_Fancybox(string projectName, string cityName, string areaName, long?caseId)
        {
            projectName = JsonHelp.DecodeField(projectName);
            cityName    = JsonHelp.DecodeField(cityName);
            areaName    = JsonHelp.DecodeField(areaName);
            int                       nowProvinceId   = 0;
            int                       nowCityId       = 0;
            int                       nowAreaId       = 0;
            FxtApi_SYSCity            city            = CityApi.GetCityByCityName(cityName);
            List <FxtApi_SYSProvince> provinceList    = ProvinceApi.GetAllProvince();
            List <FxtApi_SYSCode>     purposeCodeList = SysCodeApi.GetAllProjectPurposeCode();
            List <FxtApi_SYSCity>     cityList        = new List <FxtApi_SYSCity>();
            List <FxtApi_SYSArea>     areaList        = new List <FxtApi_SYSArea>();

            if (city != null)
            {
                nowProvinceId = city.ProvinceId;
                nowCityId     = city.CityId;
                cityList      = CityApi.GetCityByProvinceId(nowProvinceId);
                areaList      = AreaApi.GetAreaByCityId(nowCityId);
                if (areaList != null)
                {
                    FxtApi_SYSArea area = areaList.Where(p => !string.IsNullOrEmpty(areaName) && (p.AreaName.Contains(areaName) || areaName.Contains(p.AreaName))).FirstOrDefault();
                    if (area != null)
                    {
                        nowAreaId = area.AreaId;
                    }
                }
            }
            ViewBag.Address         = "";
            ViewBag.nowProvinceId   = nowProvinceId;
            ViewBag.nowCityId       = nowCityId;
            ViewBag.nowAreaId       = nowAreaId;
            ViewBag.projectName     = projectName;
            ViewBag.provinceList    = provinceList;
            ViewBag.purposeCodeList = purposeCodeList;
            ViewBag.cityList        = cityList;
            ViewBag.areaList        = areaList;
            if (caseId != null)
            {
                案例信息 caseObj = CaseManager.GetCaseById(Convert.ToInt64(caseId));
                if (caseObj != null && caseObj.地址 != null)
                {
                    ViewBag.Address = caseObj.地址;
                }
            }

            return(View());
        }
Beispiel #6
0
        // POST api/AreaApi

        /// <summary>
        /// Dodawanie nowego obszaru
        /// </summary>
        /// <param name="a">Informacje do stworzenia obszaru z pkt i liniami</param>
        /// <returns>response</returns>
        public HttpResponseMessage PostArea(AreaApi a)
        {
            if (userDto.TokenIsValid(a.Email, a.Token))
            {
                Area area = this.areaDto.PostArea(a);
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, area);
                response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = area.ID }));
                return(response);
            }

            else
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, this.ModelState));
            }
        }
Beispiel #7
0
 public IHttpActionResult UpdateName(AreaUpdateViewModel model)
 {
     try
     {
         var areaApi = new AreaApi();
         areaApi.UpdateName(model);
         return(Json(new
         {
             success = true,
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             success = false,
         }));
     }
 }
Beispiel #8
0
 public IHttpActionResult GetAreasByCarParkid(int carParkId)
 {
     try
     {
         var areaApi  = new AreaApi();
         var listArea = areaApi.GetAreaByCarParkId(carParkId);
         return(Json(new
         {
             result = listArea,
             success = true,
         }));
     }
     catch (Exception ex)
     {
         return(Json(new
         {
             success = false,
         }));
     }
 }
Beispiel #9
0
        public IHttpActionResult GetEmptyAmount(int id)
        {
            CarParkApi carParkApi = new CarParkApi();
            AreaApi    areaApi    = new AreaApi();

            try
            {
                var emptyAmount = carParkApi.GetEmptyAmount(id);
                return(Json(new
                {
                    result = emptyAmount,
                    success = true,
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    success = false,
                }));
            }
        }
Beispiel #10
0
        public static List <FxtApi_SYSArea> GetAreaByCityId(int cityId)
        {
            List <FxtApi_SYSArea> list = AreaApi.GetAreaByCityId(cityId);

            return(list);
        }