Ejemplo n.º 1
0
 public ActionResult CreateEvent()
 {
     List<EventDates> EventStartDates = new List<EventDates>();
     List<EventsAMS> AMS = new List<EventsAMS>();
     for (int i = 1; i <= 12; i++)
     {
         EventStartDates.Add(new EventDates { StartsDate = Convert.ToString(i) });
     }
     AMS.Add(new EventsAMS { AMS = "AM" });
     AMS.Add(new EventsAMS { AMS = "PM" });
     EventModel userEvent = new EventModel()
     {
         EventStartDates = EventStartDates,
         AMS = AMS
     };
     return View(userEvent);
 }
Ejemplo n.º 2
0
        public ActionResult CreateEvent(EventModel userEventModel, HttpPostedFileBase BannerImage, IEnumerable<HttpPostedFileBase> Gallery)
        {
            List<EventDates> EventStartDates = new List<EventDates>();
            List<EventsAMS> AMS = new List<EventsAMS>();
            for (int i = 1; i <= 12; i++)
            {
                EventStartDates.Add(new EventDates { StartsDate = Convert.ToString(i) });
            }
            AMS.Add(new EventsAMS { AMS = "AM" });
            AMS.Add(new EventsAMS { AMS = "PM" });
            EventModel userEvent = new EventModel()
            {
                EventStartDates = EventStartDates,
                AMS = AMS
            };
            if (ModelState.IsValid)
            {
                var Tickets = 0;
                foreach (var TicketsQuantity in userEventModel.Quantity)
                {
                    Tickets += TicketsQuantity;
                }
                if (Tickets > userEventModel.TotalNoOfTickets || Tickets < userEventModel.TotalNoOfTickets)
                {
                    TempData["SuccessMessage"] = "Total Tickets must equal to Tickets Quantity";
                    return View(userEvent);
                }
                else
                {
                    var fileName = Path.GetFileName(BannerImage.FileName);
                    var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName));
                    BannerImage.SaveAs(path);
                    var FilePath = "/UserProfilePictures/" + fileName;
                    Def_Events Events = new Def_Events()
                    {
                        EventName = userEventModel.EventName,
                        BannerImage = FilePath,
                        EventStartdate = userEventModel.EventStartdate,
                        EndDate = userEventModel.EndDate,
                        MobileNumber = userEventModel.MobileNumber,
                        Email = userEventModel.Email,
                        EventVenue = userEventModel.EventVenue,
                        EventDescription = userEventModel.EventDescription,
                        TotalNoOfTickets = userEventModel.TotalNoOfTickets,
                        StartTime = userEventModel.StartTime + userEventModel.StartAfter,
                        EndTime = userEventModel.EndTime + userEventModel.StartEve,
                        Status = true,
                        CreatedOn = DateTime.Now
                    };
                    Def_Events AdminEvents = EventService.Create(Events);
                    if (userEventModel.Heading.Count != 0 && userEventModel.Description.Count != 0 && userEventModel.Price.Count != 0 && userEventModel.Quantity.Count != 0)
                    {

                        for (int i = 0; i < userEventModel.Heading.Count; i++)
                        {
                            for (int j = i; j < userEventModel.Description.Count; j++)
                            {
                                for (int k = i; k < userEventModel.Price.Count; k++)
                                {
                                    for (int l = i; l < userEventModel.Quantity.Count; l++)
                                    {

                                        Event_TicketTypes TicketTypes = new Event_TicketTypes()
                                        {
                                            Heading = userEventModel.Heading[i],
                                            EventId = AdminEvents.EventId,
                                            Price = userEventModel.Price[i],
                                            Description = userEventModel.Description[i],
                                            Quantity = userEventModel.Quantity[i],
                                            Status = true,
                                            CreatedOn = DateTime.Now,
                                        };
                                        EventTicketTypeservices.Create(TicketTypes);

                                        break;
                                    }
                                    break;
                                }
                                break;
                            }
                        }
                    }
                    TempData["SuccessMessage"] = "Event Added successfully";
                    return RedirectToAction("CreateEvent", "Events", new { area = "Admin" });
                }
            }
            return View(userEvent);
        }
Ejemplo n.º 3
0
        public ActionResult UpdateEvent(EventModel userEventModel, HttpPostedFileBase BannerImage, IEnumerable<HttpPostedFileBase> Gallery)
        {
            List<EventDates> EventStartDates = new List<EventDates>();
            List<EventsAMS> AMS = new List<EventsAMS>();
            for (int i = 1; i <= 12; i++)
            {
                EventStartDates.Add(new EventDates { StartsDate = Convert.ToString(i) });
            }
            AMS.Add(new EventsAMS { AMS = "AM" });
            AMS.Add(new EventsAMS { AMS = "PM" });
            EventModel userEvent = new EventModel()
            {
                EventStartDates = EventStartDates,
                AMS = AMS
            };

            if (userEventModel.EventId != null)
            {
                var FilePath = "";
                if (BannerImage != null)
                {
                    var fileName = Path.GetFileName(BannerImage.FileName);
                    var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName));
                    BannerImage.SaveAs(path);
                    FilePath = "/UserProfilePictures/" + fileName;
                }

                Def_Events Events = new Def_Events()
                {
                    EventId = userEventModel.EventId,
                    EventName = userEventModel.EventName,
                    BannerImage = FilePath,
                    EventStartdate = userEventModel.EventStartdate,
                    EndDate = userEventModel.EndDate,
                    MobileNumber = userEventModel.MobileNumber,
                    Email = userEventModel.Email,
                    EventVenue = userEventModel.EventVenue,
                    EventDescription = userEventModel.EventDescription,
                    TotalNoOfTickets = userEventModel.TotalNoOfTickets,
                    StartTime = userEventModel.StartTime + userEventModel.StartAfter,
                    EndTime = userEventModel.EndTime + userEventModel.StartEve,
                    Status = true,
                    CreatedOn = DateTime.Now
                };
                EventService.EVentsUpdate(Events);

                if (userEventModel.Heading.Count != 0 && userEventModel.Description.Count != 0 && userEventModel.Price.Count != 0 && userEventModel.Quantity.Count != 0)
                {
                    if (userEventModel.TicketTypeId != null)
                    {
                        if (userEventModel.TicketTypeId.Count != 0)
                        {

                            for (int i = 0; i < userEventModel.Heading.Count; i++)
                            {
                                for (int j = i; j < userEventModel.Description.Count; j++)
                                {
                                    for (int k = i; k < userEventModel.Price.Count; k++)
                                    {
                                        for (int l = i; l < userEventModel.Quantity.Count; l++)
                                        {
                                            for (int m = i; m < userEventModel.TicketTypeId.Count; m++)
                                            {
                                                if (userEventModel.TicketTypeId[m] != 0)
                                                {

                                                    Event_TicketTypes TicketTypes = new Event_TicketTypes()
                                                    {
                                                        Heading = userEventModel.Heading[i],
                                                        EventId = userEventModel.EventId,
                                                        Price = userEventModel.Price[i],
                                                        Description = userEventModel.Description[i],
                                                        Quantity = userEventModel.Quantity[i],
                                                        Status = true,
                                                        TypeId = userEventModel.TicketTypeId[m],
                                                        CreatedOn = DateTime.Now,
                                                    };
                                                    EventTicketTypeservices.UpdateEvent(TicketTypes);

                                                    break;
                                                }
                                                else
                                                {

                                                    Event_TicketTypes TicketTypes = new Event_TicketTypes()
                                                    {
                                                        Heading = userEventModel.Heading[i],
                                                        EventId = userEventModel.EventId,
                                                        Price = userEventModel.Price[i],
                                                        Description = userEventModel.Description[i],
                                                        Quantity = userEventModel.Quantity[i],
                                                        Status = true,
                                                        CreatedOn = DateTime.Now,
                                                    };
                                                    EventTicketTypeservices.Create(TicketTypes);
                                                }
                                            }
                                            break;
                                        }
                                        break;
                                    }
                                    break;
                                }
                            }
                        }
                        else
                        {

                        }
                    }
                    else
                    {
                        if (userEventModel.Heading.Count != 0 && userEventModel.Description.Count != 0 && userEventModel.Price.Count != 0 && userEventModel.Quantity.Count != 0)
                        {

                            for (int i = 0; i < userEventModel.Heading.Count; i++)
                            {
                                for (int j = i; j < userEventModel.Description.Count; j++)
                                {
                                    for (int k = i; k < userEventModel.Price.Count; k++)
                                    {
                                        for (int l = i; l < userEventModel.Quantity.Count; l++)
                                        {

                                            Event_TicketTypes TicketTypes = new Event_TicketTypes()
                                            {
                                                Heading = userEventModel.Heading[i],
                                                EventId = userEventModel.EventId,
                                                Price = userEventModel.Price[i],
                                                Description = userEventModel.Description[i],
                                                Quantity = userEventModel.Quantity[i],
                                                Status = true,
                                                CreatedOn = DateTime.Now,
                                            };
                                            EventTicketTypeservices.Create(TicketTypes);

                                            break;
                                        }
                                        break;
                                    }
                                    break;
                                }
                            }
                        }
                    }

                }
            }

            else
            {

            }
            TempData["SuccessMessage"] = "Event Updated Successfully..";
            return RedirectToAction("AdminEvents", "Events", new { area = "Admin" });
        }