示例#1
0
 public ActionResult SearchEvents(string venue)
 {
     using (GoExploreEntities goExplore = new GoExploreEntities())
     {
         var filteredList = goExplore.Event_Details.Where(e => e.City.Contains(venue)).ToList().Take(5);
         EventListDetails eventListDetails = new EventListDetails();
         eventListDetails.Events = new List <Events>();
         foreach (var item in filteredList)
         {
             Events events = new Events();
             events.categoryId       = item.categoryId;
             events.City             = item.City;
             events.eventDate        = item.eventDate;
             events.eventDescription = item.eventDescription;
             events.eventId          = item.eventId;
             events.eventName        = item.eventName;
             events.imagePath        = item.imagePath;
             events.organizerId      = item.organizerId;
             events.ticketPrice      = item.ticketPrice;
             events.totalSeats       = item.totalSeats;
             events.venue            = item.venue;
             eventListDetails.Events.Add(events);
         }
         string data = JsonConvert.SerializeObject(eventListDetails.Events);
         return(Json(data));
     }
 }
示例#2
0
        public ActionResult SaveEvent(Event_Details event_Details, HttpPostedFileBase ImagePath)
        {
            var allowedExtensions = new[] { ".Jpg", ".png", ".jpg", "jpeg" };

            using (GoExploreEntities goExplore = new GoExploreEntities()) {
                int _rownumner = goExplore.Event_Details.Count();

                var fileName = Path.GetFileName(ImagePath.FileName);
                var ext      = Path.GetExtension(ImagePath.FileName);

                string name = Path.GetFileNameWithoutExtension(fileName);
                //string myfile = name +"_"+ _rownumner.ToString() + ext;
                string myfile = "eImg_" + _rownumner.ToString() + ext;
                var    path   = Path.Combine(Server.MapPath("~/images/"), myfile);
                ImagePath.SaveAs(path);

                Event_Details _event_Details = new Event_Details();
                _event_Details.categoryId       = event_Details.categoryId;
                _event_Details.eventName        = event_Details.eventName;
                _event_Details.eventDescription = event_Details.eventDescription;
                _event_Details.eventDate        = event_Details.eventDate;
                _event_Details.venue            = event_Details.venue;
                _event_Details.organizerId      = event_Details.organizerId;
                //_event_Details.i = myfile;

                goExplore.Event_Details.Add(_event_Details);
                goExplore.SaveChanges();

                int newEventId = event_Details.eventId;
                return(RedirectToAction("Index", "Dashboard", new { @pageNo = 0 }));
            }
        }
示例#3
0
        public ActionResult AddEvent()
        {
            try
            {
                if (Session["UserId"] != null)
                {
                    using (GoExploreEntities db = new GoExploreEntities())
                    {
                        var        categoryList  = db.Event_Category.ToList();
                        SelectList catSelectList = new SelectList(categoryList, "CategoryId", "CategoryName");
                        ViewBag.CategoryData = catSelectList;

                        var        userList   = db.Users.ToList();
                        SelectList userSelect = new SelectList(userList, "UserId", "UserNAme");
                        ViewBag.UserData = userSelect;
                        ViewBag.UserName = Session["UserName"].ToString();
                    }
                    return(View());
                }
                else
                {
                    return(RedirectToAction("Index", "Login"));
                }
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
示例#4
0
        // GET: Admin/Dashboard
        public ActionResult Index(int pageNo)
        {
            try
            {
                if (Session["UserId"] != null)
                {
                    using (GoExploreEntities db = new GoExploreEntities())
                    {
                        //var eventList = db.Event_Details.ToList().Skip(0).Take(10);
                        var eventList = db.Event_Details.Include("Event_Category").Include("User").ToList().Skip(pageNo * 10).Take(10);
                        ViewBag.eventDatas = eventList.OrderByDescending(e => e.eventId);
                        ViewBag.UserName   = Session["UserName"].ToString();

                        var eventListCount = db.Event_Details.ToList().Count();
                        ViewBag.Count = eventListCount;
                        return(View());
                    }
                }
                else
                {
                    return(RedirectToAction("Index", "Login"));
                }
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
示例#5
0
 public ActionResult OrderHistory()
 {
     using (GoExploreEntities db = new GoExploreEntities())
     {
         var userId    = Convert.ToInt32(Session["UserId"]);
         var eventList = db.Bookings.Include("Event_Details").Include("Event_Details.Event_Category").Include("Event_Details.User").Where(i => i.userId == userId && i.status == "S").ToList();
         ViewBag.eventDatas = eventList.OrderByDescending(e => e.eventId);
         ViewBag.Count      = eventList.Count();;
         return(View());
     }
 }
示例#6
0
 public ActionResult CancelOrder(int bookingId)
 {
     using (GoExploreEntities db = new GoExploreEntities())
     {
         var booking = db.Bookings.Where(i => i.bookingId == bookingId).FirstOrDefault();
         booking.status = "D";
         //db.Bookings.Add(booking);
         db.SaveChanges();
         ViewBag.Success = 1;
         return(RedirectToAction("OrderHistory", "User"));
     }
 }
示例#7
0
 public ActionResult Index(PaymentModel paymentModel)
 {
     if (ModelState.IsValid)
     {
         var bookingId = 0;
         using (var context = new GoExploreEntities()) //need to maintain transaction here
         {
             Booking booking = new Booking();
             booking.bookingDate   = DateTime.Now;
             booking.eventId       = paymentModel.EventId;
             booking.address       = paymentModel.Address;
             booking.bookingStatus = "S";
             booking.city          = paymentModel.City;
             booking.country       = paymentModel.Country;
             booking.seatsOccupied = paymentModel.SeatsOccupied;
             booking.state         = paymentModel.State;
             booking.status        = "S";
             booking.totalAmount   = paymentModel.TotalAmount;
             booking.userId        = Convert.ToInt32(Session["UserId"]);
             booking.zipCode       = paymentModel.ZipCode;
             db.Bookings.Add(booking);
             db.SaveChanges();
             Payment payment = new Payment();
             payment.bookingId   = booking.bookingId;
             payment.amount      = paymentModel.TotalAmount;
             payment.cardNumer   = paymentModel.CardNumber;
             payment.cardType    = paymentModel.CardType;
             payment.cvv         = paymentModel.CVV;
             payment.expiryDate  = paymentModel.ExpiryMonth + "/" + paymentModel.ExpiryYear.ToString();
             payment.firstName   = paymentModel.NameOnCard;
             payment.lastName    = "";
             payment.paymentMode = paymentModel.CardType;
             payment.status      = "S";
             db.Payments.Add(payment);
             db.SaveChanges();
             bookingId = booking.bookingId;
         }
         ViewBag.result    = "Success";
         ViewBag.bookingId = bookingId;
         return(View());
     }
     else
     {
         //string json = JsonConvert.SerializeObject(paymentModel);
         //var encryptedData = Utility.Encrypt(json, "GoExploreHashKey");
         paymentModel.Amount = paymentModel.TotalAmount;
         ViewBag.BookingId   = 0;
         return(View(paymentModel));
     }
 }
示例#8
0
        public ActionResult Index()
        {
            using (GoExploreEntities goExplore = new GoExploreEntities())
            {
                var topEventList = goExplore.Event_Details.OrderByDescending(e => e.eventId).ToList().Take(3);
                ViewBag.TopEventData = topEventList;

                var eventList = goExplore.Event_Details.OrderByDescending(e => e.eventId).ToList().Take(10);
                foreach (var item in eventList)
                {
                    item.imagePath = item.imagePath == null ? "~/images/autumn.jpg" : (item.imagePath.Contains("https") ? item.imagePath : "~/images/events/" + item.imagePath);
                }
                ViewBag.EventData = eventList;
                return(View());
            }
        }
示例#9
0
 public ActionResult _eventPartial(string venue)
 {
     using (GoExploreEntities db = new GoExploreEntities())
     {
         if (venue == null || venue.Length <= 0)
         {
             var currnetEvent = db.Event_Details.Include("Event_Category").Include("User").ToList().Take(10);
             ViewBag.currnetEvent = currnetEvent.OrderByDescending(e => e.eventId);
         }
         else
         {
             var currnetEvent = db.Event_Details.Include("Event_Category").Include("User").Where(e => e.City.Contains(venue)).ToList().Take(10);
             ViewBag.currnetEvent = currnetEvent.OrderByDescending(e => e.eventId);
         }
     }
     return(PartialView("~/Views/Event/_eventPartial.cshtml"));
 }
示例#10
0
 public ActionResult Index(LoginModel loginModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (GoExploreEntities goExplore = new GoExploreEntities())
             {
                 var userDetails = goExplore.Users.SingleOrDefault(x => x.emailId == loginModel.EmailId && x.password == loginModel.Password);
                 if (userDetails != null)
                 {
                     Session["UserId"]   = userDetails.userid;
                     Session["UserName"] = userDetails.userName;
                     ViewBag.UserName    = Session["UserName"].ToString();
                     ViewBag.Message     = "Welcome to GoExplore.";
                     if (Session["v"] == null)
                     {
                         return(RedirectToAction("Index", "Home"));
                     }
                     else
                     {
                         var v = Session["v"];
                         var s = Session["s"];
                         return(RedirectToAction("Index", "Payments", new { s = s, v = v }));
                     }
                 }
                 else
                 {
                     var erroMsg = "User not exist, Pleaase Create new user.";
                     return(RedirectToAction("RegisterUser", "User", new { errorMessage = erroMsg }));
                 }
             }
         }
         else
         {
             return(View(loginModel));
         }
     }
     catch (Exception ex)
     {
         ViewBag.Message = ex.Message;
         return(View());
     }
 }
示例#11
0
        // GET: Event
        public ActionResult EventList()
        {
            //ViewBag.Title = "Event List.";
            using (GoExploreEntities db = new GoExploreEntities())
            {
                //var eventList = db.Event_Details.ToList().Skip(0).Take(10);


                var eventListCount = db.Event_Details.ToList().Count();
                ViewBag.ec_Count = eventListCount;

                var upcomingEvent = db.Event_Details.Include("Event_Category").Include("User").Where(e => e.eventDate > DateTime.Today).ToList().Take(10);
                ViewBag.upcomingEvent = upcomingEvent.OrderByDescending(e => e.eventId);

                var upcomingEventCount = db.Event_Details.ToList().Count();
                ViewBag.ue_Count = upcomingEventCount;

                return(View());
            }
        }
示例#12
0
 public ActionResult Index(LoginModel loginModel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             using (GoExploreEntities goExplore = new GoExploreEntities())
             {
                 var userDetails = goExplore.Users.SingleOrDefault(x => x.emailId == loginModel.EmailId && x.password == loginModel.Password);
                 if (userDetails != null)
                 {
                     Session["UserId"]   = userDetails.userid;
                     Session["UserName"] = userDetails.userName;
                     ViewBag.UserName    = Session["UserName"].ToString();
                     ViewBag.Message     = "Welcome to GoExplore.";
                     //goExplore.Dispose();
                     return(RedirectToAction("Index", "Dashboard", new { @pageNo = 0 }));
                     //return RedirectToActionPermanent()
                 }
                 else
                 {
                     ViewBag.Message = "User not exist, Pleaase Create new user.";
                     return(RedirectToAction("Index", "Registration"));
                 }
             }
         }
         else
         {
             return(View(loginModel));
         }
     }
     catch (Exception ex)
     {
         ViewBag.Message = ex.Message;
         return(View());
     }
 }
示例#13
0
        public ActionResult event_detail(int eventId)
        {
            using (GoExploreEntities goExplore = new GoExploreEntities())
            {
                EventDetail eventDetailModel = new EventDetail();
                var         eventDetailData  = goExplore.Event_Details.Where(e => e.eventId == eventId).FirstOrDefault();

                eventDetailModel.eventId          = eventDetailData.eventId;
                eventDetailModel.categoryId       = eventDetailData.categoryId;
                eventDetailModel.eventName        = eventDetailData.eventName;
                eventDetailModel.eventDescription = eventDetailData.eventDescription;
                eventDetailModel.venue            = eventDetailData.venue;
                eventDetailModel.eventDate        = eventDetailData.eventDate;
                eventDetailModel.organizerId      = eventDetailData.organizerId;
                eventDetailModel.ticketPrice      = eventDetailData.ticketPrice;
                eventDetailModel.totalSeats       = eventDetailData.totalSeats;
                eventDetailModel.imagePath        = eventDetailData.imagePath;


                var eventDetailList = goExplore.Event_Details.OrderByDescending(e => e.eventId).ToList().Take(10);
                ViewBag.EventList = eventDetailList;
                return(View(eventDetailModel));
            }
        }
示例#14
0
 public int Createuser(RegistrationModel registrationModel)
 {
     using (GoExploreEntities goExplore = new GoExploreEntities())
     {
         int  UID      = 0;
         User existing = goExplore.Users.FirstOrDefault(u => u.emailId == registrationModel.EmailId);
         if (existing == null)
         {
             User users = new User();
             users.userid   = 0;
             users.userName = registrationModel.UserName;
             users.emailId  = registrationModel.EmailId;
             users.userType = registrationModel.UserType;
             users.password = registrationModel.Password;
             goExplore.Users.Add(users);
             UID = goExplore.SaveChanges();
         }
         else
         {
             UID = -1;
         }
         return(UID);
     }
 }