public Def_Events EVentsUpdate(Def_Events UpdateEvent) { using (var context = _dbContextFactory.CreateConnection()) { Def_Events Events = context.Def_Events.Where(x => x.EventId == UpdateEvent.EventId && x.Status == true).FirstOrDefault(); Events.EventName = UpdateEvent.EventName; if (UpdateEvent.BannerImage != "") { Events.BannerImage = UpdateEvent.BannerImage; } Events.EventStartdate = UpdateEvent.EventStartdate; Events.EndDate = UpdateEvent.EndDate; Events.MobileNumber = UpdateEvent.MobileNumber; Events.Email = UpdateEvent.Email; Events.EventVenue = UpdateEvent.EventVenue; Events.EventDescription = UpdateEvent.EventDescription; if (UpdateEvent.StartTime != "00") { Events.StartTime = UpdateEvent.StartTime; } if (UpdateEvent.EndTime != "00") { Events.EndTime = UpdateEvent.EndTime; } Events.Status = true; Events.UpdatedOn = DateTime.Now; context.SaveChanges(); return(UpdateEvent); } }
public List <Events> GetGoingUsers(int Eventid) { List <Events> Eventsusers = new List <Events>(); using (var context = _dbContextFactory.CreateConnection()) { List <Events> GoingUsers = (from a in context.Event_UserPayments join b in context.Event_UserSelections on a.UserSelectionId equals b.EventSelectionId where (b.EventId == Eventid && a.Status == true) select new Events { UserId = a.UserId }).Distinct().Take(10).ToList(); Def_Events Events = context.Def_Events.Where(x => x.EventId == Eventid && x.Status == true).FirstOrDefault(); foreach (var GoingUsres in GoingUsers) { View_UserDetails details = context.View_UserDetails.Where(x => x.UserId == GoingUsres.UserId).FirstOrDefault(); if (details.Batch != null) { Eventsusers.Add(new Events { UserName = details.FirstName, LName = details.LastName, UserImage = details.ProfilePicture, Batch = details.Batch, Branch = details.CourseCategoryName, Course = details.CourseName }); } else { Eventsusers.Add(new Events { UserName = details.FirstName, LName = details.LastName, UserImage = details.ProfilePicture, Batch = details.WorkingFrom, WorkingTO = details.WorkingTo, Course = details.DepartmentName }); } } } return(Eventsusers); }
public Alumini.Core.Def_Events Get(int id) { using (var context = _dbContextFactory.CreateConnection()) { Def_Events Events = context.Def_Events.Where(x => x.EventId == id).FirstOrDefault(); return(Events); } }
public bool Delete(int id) { using (var context = _dbContextFactory.CreateConnection()) { Def_Events Events = context.Def_Events.Where(x => x.EventId == id).FirstOrDefault(); Events.Status = false; Events.UpdatedOn = DateTime.Now; context.SaveChanges(); return(true); } }
public ActionResult EventGoing(int id) { Def_Events events = EventServices.Get(id); Session["Jobid"] = id; EventsModel Events = new EventsModel() { Eventid = events.EventId, EventAddress = events.EventVenue, EventDesc = events.EventDescription, EventHeading = events.EventName, EventsGoing = EventServices.GetGoingUsers(id), StartDate = events.EventStartdate, EndDate = events.EndDate, Bannerimage = events.BannerImage, StartTime = events.StartTime, EndTime = events.EndTime }; return(View(Events)); }
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)); }
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" })); }
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); }
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" }); }
public Def_Events Create(Def_Events obj) { return(_IEventCategoryRepo.Create(obj)); }
public Def_Events EVentsUpdate(Def_Events UpdateEvent) { return(_IEventCategoryRepo.EVentsUpdate(UpdateEvent)); }