Example #1
0
        public ActionResult Create()
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role == "U" || role == "A")
            {
                return(RedirectToAction("Login", "Account"));
            }
            ViewBag.Areas = new SelectList(webApi.GetAreas(), "AREA_ID", "AREA_NAME");
            return(View());
        }
Example #2
0
        public ActionResult Create()
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role == "U")
            {
                return(RedirectToAction("Login", "Account"));
            }
            TempData["pageName"]  = "Create";
            ViewBag.Areas         = new SelectList(webApi.GetAreas(), "AREA_ID", "AREA_NAME");
            ViewBag.FacilityTypes = new SelectList(webApi.GetFacilityTypes(), "FT_ID", "FT_NAME");
            return(View());
        }
Example #3
0
        public ActionResult Register()
        {
            DatabaseEntities db = new DatabaseEntities();

            ViewBag.Areas         = new SelectList(webApi.GetAreas(), "AREA_ID", "AREA_NAME");
            ViewBag.USER_DISTRICT = new SelectList(db.DISTRICTs, "DISTRICT_ID", "DISTRICT_NAME");

            return(View());
        }
Example #4
0
        // GET: Areas
        public ActionResult Index(int?page)
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role == "U" || role == "A")
            {
                return(RedirectToAction("Login", "Account"));
            }
            int pageSize   = 10;
            int pageNumber = (page ?? 1);
            var areas      = webApi.GetAreas().ToPagedList(pageNumber, pageSize);

            return(View(areas));
        }
Example #5
0
        // GET: Member
        public ActionResult Index(int?pageActive, int?pageHistory, int?pageSub, int?selectedTab)
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role != "U" && role != "A" && role != "O")
            {
                return(RedirectToAction("Login", "Account"));
            }
            if (selectedTab != null)
            {
                TempData["selectedTab"] = selectedTab;
            }
            int pageSize          = 10;
            int pageNumberActive  = (pageActive ?? 1);
            int pageNumberHistory = (pageHistory ?? 1);
            int pageNumberSub     = (pageSub ?? 1);

            TempData["selectedTab"] = TempData["selectedTab"] == null ? 0 : TempData["selectedTab"];

            DatabaseEntities db = new DatabaseEntities();

            string     cookieName            = FormsAuthentication.FormsCookieName;
            HttpCookie authCookie            = HttpContext.Request.Cookies[cookieName];
            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value);
            string userName         = ticket.Name;
            var    user             = webApi.GetUser(userName);
            var    liveReservations = webApi.liveReservations(user.USER_ID);
            var    subscribers      = webApi.GetSubscribersByUserId(user.USER_ID);
            var    oldReservations  = webApi.oldReservations(user.USER_ID);
            List <SportsSide.DAL.RESERVATION> newLiveReservations = new List <SportsSide.DAL.RESERVATION>();
            List <SportsSide.DAL.RESERVATION> newOldReservations  = new List <SportsSide.DAL.RESERVATION>();

            foreach (var item in liveReservations)
            {
                if (item.DT_BEGIN.Date > DateTime.Now.Date || (item.DT_BEGIN.Date == DateTime.Now.Date && item.DT_BEGIN.Hour > DateTime.Now.Hour))
                {
                    newLiveReservations.Add(item);
                }
            }
            foreach (var item in oldReservations)
            {
                if (item.DT_BEGIN.Date < DateTime.Now.Date || (item.DT_BEGIN.Date == DateTime.Now.Date && item.DT_BEGIN.Hour < DateTime.Now.Hour))
                {
                    newOldReservations.Add(item);
                }
            }
            MemberBigModel model = new MemberBigModel();

            model.User             = user;
            model.LiveReservations = newLiveReservations.OrderByDescending(x => x.CREATED_DATE).ToPagedList(pageNumberActive, pageSize);
            model.oldReservations  = newOldReservations.OrderByDescending(x => x.CREATED_DATE).ToPagedList(pageNumberHistory, pageSize);
            model.Subscribers      = subscribers.OrderByDescending(x => x.CREATED_DATE).ToPagedList(pageNumberSub, pageSize);
            model.selectedTab      = TempData["selectedTab"].ToString();

            model.Date = System.DateTime.Now.Date;


            ViewBag.Areas     = new SelectList(webApi.GetAreas(), "AREA_ID", "AREA_NAME", user.DISTRICT.CITY.AREA.AREA_ID);
            ViewBag.Cities    = new SelectList(webApi.GetCitiesByAreas(user.DISTRICT.CITY.AREA.AREA_ID), "CITY_ID", "CITY_NAME");
            ViewBag.Districts = new SelectList(webApi.GetDistrictsByCities(user.DISTRICT.CITY.CITY_ID), "DISTRICT_ID", "DISTRICT_NAME");

            return(View(model));
        }
Example #6
0
        // GET: Arama
        public ActionResult Index(int?page, string SearchString, string FacilityType, string ddlAreas, string ddlCities, string ddlDistricts, string Price1, string Price2, string enlem, string boylam)
        {
            string role = new Business.AccountBusiness().currentMember();

            if (role != "U" && role != "A" && role != "O")
            {
                return(RedirectToAction("Login", "Account"));
            }
            DatabaseEntities          db         = new DatabaseEntities();
            string                    cookieName = FormsAuthentication.FormsCookieName;           //Find cookie name
            HttpCookie                authCookie = HttpContext.Request.Cookies[cookieName];       //Get the cookie by it's name
            FormsAuthenticationTicket ticket     = FormsAuthentication.Decrypt(authCookie.Value); //Decrypt it
            string                    UserName   = ticket.Name;                                   //You have the UserName!
            var                    rowFind       = db.USERS.FirstOrDefault(x => x.USER_NAME == UserName);
            var                    district      = rowFind.USER_DISTRICT;
            List <FACILITY>        facilityList  = db.FACILITies.Where(a => a.DISTRICT_ID == district).ToList();
            IEnumerable <FACILITY> facilityIE    = facilityList;
            var                    facilities    = facilityIE;

            ViewBag.Areas = new SelectList(webApi.GetAreas(), "AREA_ID", "AREA_NAME");

            if (enlem != null && boylam != null)
            {
                string         url        = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" + enlem + "," + boylam + "&sensor=true";
                HttpWebRequest request    = WebRequest.Create(url) as HttpWebRequest;
                string         jsonVerisi = "";
                using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
                {
                    StreamReader reader = new StreamReader(response.GetResponseStream());
                    jsonVerisi = reader.ReadToEnd();
                }
                var obj = JObject.Parse(jsonVerisi);

                var user    = JsonConvert.DeserializeObject <GoogleGeoCodeResponse>(jsonVerisi);
                var yer     = user.results[0].address_components[0].long_name;
                var mevki   = user.results[0].address_components[1].long_name;
                var mahalle = user.results[0].address_components[2].long_name;
                var ilce    = user.results[0].address_components[3].long_name;
                var il      = user.results[0].address_components[4].long_name;

                var distList = db.DISTRICTs.FirstOrDefault(a => a.DISTRICT_NAME == ilce);

                var facility = db.FACILITies.Where(a => a.DISTRICT_ID == distList.DISTRICT_ID).ToList();
                //IEnumerable<FACILITY> facilityIE = facility;


                //rowFind.USER_DISTRICT = distList.DISTRICT_ID;

                //db.Entry(rowFind).State = EntityState.Modified;
                //db.SaveChanges();
                return(View(facility));
            }



            if (!String.IsNullOrEmpty(ddlAreas))
            {
                facilities = db.FACILITies.Where(a => a.DISTRICT.CITY.AREA_ID.ToString() == ddlAreas).ToList();
            }
            if (!String.IsNullOrEmpty(ddlCities))
            {
                facilities = db.FACILITies.Where(x => x.DISTRICT.CITY_ID.ToString() == ddlCities).ToList();
            }
            if (!String.IsNullOrEmpty(ddlDistricts))
            {
                facilities = db.FACILITies.Where(x => x.DISTRICT_ID.ToString() == ddlDistricts).ToList();
            }
            if (String.IsNullOrEmpty(ddlAreas) && String.IsNullOrEmpty(ddlCities) && String.IsNullOrEmpty(ddlDistricts) && !String.IsNullOrEmpty(SearchString))
            {
                facilities = db.FACILITies.Where(x => x.FACILITY_NAME.StartsWith(SearchString)).ToList();
            }
            if (Price1 != null && Price1 != "")
            {
                int PriceMin = Int32.Parse(Price1);
                facilities = facilities.Where(a => a.FACILITY_PRICE >= PriceMin);
            }
            if (Price2 != null && Price2 != "")
            {
                int PriceMax = Int32.Parse(Price2);
                facilities = facilities.Where(a => a.FACILITY_PRICE <= PriceMax).ToList();
            }
            if (!String.IsNullOrEmpty(FacilityType) && FacilityType != "Tesis Türü Seç")
            {
                facilities = facilities.Where(x => x.FACILITY_TYPE1.FT_NAME == FacilityType).ToList();
            }
            if ((!String.IsNullOrEmpty(ddlAreas) || !String.IsNullOrEmpty(ddlCities) || !String.IsNullOrEmpty(ddlDistricts)) && !String.IsNullOrEmpty(SearchString))
            {
                var newFacilities = db.FACILITies.Where(x => x.FACILITY_NAME.StartsWith(SearchString));
                facilities = newFacilities.Where(x => x.DISTRICT_ID.ToString() == ddlDistricts).ToList();
            }
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(View(facilities.ToPagedList(pageNumber, pageSize)));
        }