Пример #1
0
        public ActionResult StationModeProceed()
        {
            var request = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, "BOOTH");

            if (request != null)
            {
                if (request.Status == E_PublicCategory.REQUEST_STATUS.CLOSED)
                {
                    return(RedirectToAction("StationMode"));
                }
                var personel = new B_Personels().GetPersonelById(request.PersonelId.HasValue ? (int)request.PersonelId : 0);
                var booth    = new B_Booth().GetBoothByPersonelId(request.PersonelId.HasValue ? (int)request.PersonelId : 0);
                if (booth != null)
                {
                    ViewBag.PersonelName  = personel.FirstName + " " + personel.LastName;
                    ViewBag.PersonelImage = new E_FTPRoutes(BaseUrl).PERSONELS + personel.ImageName;
                    ViewBag.StationName   = booth.Name;
                    ViewBag.PhoneNumber   = personel.MobileNumber;
                    ViewBag.BoothAddress  = booth.Address;
                    ViewBag.StationCode   = "کد مرکز : " + booth.Id;
                }
                else
                {
                    ViewBag.PersonelName  = "---";
                    ViewBag.PersonelImage = new E_FTPRoutes(BaseUrl).PERSONELS + personel.ImageName;
                    ViewBag.StationName   = "---";
                    ViewBag.PhoneNumber   = "";
                    ViewBag.StationCode   = "کد مرکز : ---";
                }
                ViewBag.Status          = getRequestStatus(request.Status).Replace("#", booth.Id.ToString());
                ViewBag.Lat             = request.GeographicalCoordinates.Split(',')[0];
                ViewBag.Lng             = request.GeographicalCoordinates.Split(',')[1];
                ViewBag.RequestId       = request.Id;
                ViewBag.Disrespectful   = (int)E_PublicCategory.FEEDBACK.DISRESPECTFUL_BEHAVIOR;
                ViewBag.PersonalReasons = (int)E_PublicCategory.FEEDBACK.PERSONAL_REASONS;
                ViewBag.Request         = request;
                ViewBag.RequestItems    = new B_ServicesRequestItems().GetItems(request.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER);
            }
            else
            {
                return(RedirectToAction("StationMode"));
            }
            return(View());
        }
Пример #2
0
        public ActionResult GetNearStations(double Lat, double Lng)
        {
            object result = "";

            try
            {
                var booth        = new B_Booth().GetBoothes(Lat, Lng).ToList();
                var markers      = new List <object>();
                var NearStations = new List <object>();
                foreach (var li in booth)
                {
                    markers.Add(new
                    {
                        StationId    = li.Id,
                        Title        = li.Name,
                        popupContent = getMapPupWindow(li),
                        center       = new { lat = li.Lat, lng = li.Lng },
                        iconOpts     = new { iconUrl = "/Areas/User/Images/CapLogo.png", iconSize = new int[] { 30, 30 } }
                    });
                }
                var res = new Helper.ApiCall(@"https://api.cedarmaps.com/v1/geocode/cedarmaps.streets/" + Lat + "," + Lng + ".json?access_token=7775fb1e47034c4ae978aae1b3ac3f6f0b4ec6b3", "").CallApiGet();
                result = new { markers = markers, Address = res };
            }
            catch (Exception ex)
            {
                M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex);
                result = "Error";
                if (ex.Source == E_LogType.SYSTEM_ERROR.ToString())
                {
                    exx.LogType = E_LogType.SYSTEM_ERROR;
                    result      = exx;
                }
                L_Log.SubmitLog(exx);
            }
            return(Json(result));
        }