public HttpResponseMessage GetTicketingCategoryByEventID(int eventID) { List <Musika.Models.TicketingCategory> lstTicketingCategory = new List <Musika.Models.TicketingCategory>(); DataSet ds = new Musika.Repository.SPRepository.SpRepository().GetTicketCategoryListByEventId(eventID); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow dr = ds.Tables[0].Rows[i]; TicketingCategory model = new TicketingCategory(); model.CategoryName = Convert.ToString(dr[1].ToString()); lstTicketingCategory.Add(model); } return(Request.CreateResponse(HttpStatusCode.OK, JsonResponse.GetResponse(ResponseCode.Success, lstTicketingCategory.OrderByDescending(p => p.CategoryName)))); } else { return(Request.CreateResponse(HttpStatusCode.OK, JsonResponse.GetResponse(ResponseCode.Failure, null))); } }
public HttpResponseMessage GetTicketingEventsByUserID(string userID) { string result = string.Empty; List <Musika.Models.TicketingEventsNew> lstTicketingEvents = new List <Musika.Models.TicketingEventsNew>(); Models.TicketingEventsNewModel model = new TicketingEventsNewModel(); GenericRepository <TicketingEventsNew> _ticketingEntity = new GenericRepository <TicketingEventsNew>(_unitOfWork); GenericRepository <TicketingUsers> _UserEntity = new GenericRepository <TicketingUsers>(_unitOfWork); GenericRepository <TicketingEventNewStaff> _StaffEvents = new GenericRepository <TicketingEventNewStaff>(_unitOfWork); TicketingUsers user = new TicketingUsers(); _unitOfWork.StartTransaction(); try { user = _UserEntity.Repository.GetAll().Where(p => p.UserID == Convert.ToUInt32(userID)).FirstOrDefault(); if (user != null) { if (user.UserType == "Event Organizer") { lstTicketingEvents = _ticketingEntity.Repository.GetAll().Where(p => p.CreatedBy == Convert.ToInt32(userID) && p.ISDELETED != true && p.IsApproved == true).ToList(); } else if (user.UserType == "Staff") { List <TicketingEventNewStaff> lstEventStaff = new List <TicketingEventNewStaff>(); lstEventStaff = _StaffEvents.Repository.GetAll().Where(p => p.StaffId == Convert.ToInt32(userID)).ToList(); if (lstEventStaff.Count > 0) { for (int i = 0; i < lstEventStaff.Count; i++) { int evtId = Convert.ToInt32(lstEventStaff[i].EventId); TicketingEventsNew evt = new TicketingEventsNew(); evt = _ticketingEntity.Repository.GetAll().Where(p => p.EventID == evtId).FirstOrDefault(); lstTicketingEvents.Add(evt); } } } } List <Models.ViewTicketingEventListNew> lstEvents = new List <Models.ViewTicketingEventListNew>(); if (lstTicketingEvents.Count > 0) { for (int i = 0; i < lstTicketingEvents.Count; i++) { Models.ViewTicketingEventListNew temp = new Models.ViewTicketingEventListNew(); temp.EventID = lstTicketingEvents[i].EventID; temp.StartDate = lstTicketingEvents[i].StartDate ?? DateTime.Now; temp.StartTime = lstTicketingEvents[i].StartTime; temp.EndDate = lstTicketingEvents[i].EndDate ?? DateTime.Now; temp.EndTime = lstTicketingEvents[i].EndTime; temp.VenueName = lstTicketingEvents[i].VenueName; if (!String.IsNullOrEmpty(lstTicketingEvents[i].ArtistId.ToString())) { temp.ArtistName = new TicketingAPIController().GetArtistName(lstTicketingEvents[i].ArtistId); } else { temp.ArtistName = string.Empty; } if (!String.IsNullOrEmpty(lstTicketingEvents[i].EventImage)) { temp.EventImage = lstTicketingEvents[i].EventImage; } else { temp.EventImage = string.Empty; } lstEvents.Add(temp); } } return(Request.CreateResponse(HttpStatusCode.OK, JsonResponse.GetResponse(ResponseCode.Success, lstEvents.OrderByDescending(p => p.StartDate)))); } catch (Exception ee) { LogHelper.CreateLog3(ee, Request); _unitOfWork.RollBack();//RollBack Transaction return(Request.CreateResponse(HttpStatusCode.BadRequest, "")); } }
public HttpResponseMessage GetYourFriendPlans(Int32 UserID, Int16 Pageindex, Int16 Pagesize) { try { var users = (from A in db.UserFriends join B in db.UserGoing on A.Matched_UserID equals B.UserID into AB from B in AB.DefaultIfEmpty() join C in db.TourDate on B.TourDateID equals C.TourDateID into BD from C in BD.DefaultIfEmpty() where A.UserID == UserID && A.Matched_UserID != 0 && B.RecordStatus == "Going" && C.TicketingEventID == null select B.TourDateID).ToList(); int RemainingRecord = Pagesize; var _list = (from A in db.TourDate join B in db.Artists on A.ArtistID equals B.ArtistID into AB from B in AB.DefaultIfEmpty() join C in db.Venue on A.VenueID equals C.VenueID into AC from C in AC.DefaultIfEmpty() where users.Contains(A.TourDateID) && A.Tour_Utcdate > DateTime.Now && A.IsDeleted == false select new ViewYourFreiendplanlst() { TourDateID = A.TourDateID, ArtistID = A.ArtistID, ArtistName = B.ArtistName, ImageURL = B.ImageURL, BannerImage_URL = B.BannerImage_URL, Datetime_Local = A.Datetime_Local.Value, VenueName = C.VenueName, Going = (from G in db.UserFriends join H in db.Users on G.Matched_UserID equals H.UserID into GH from H in GH.DefaultIfEmpty() join I in db.UserGoing on H.UserID equals I.UserID into HI from I in HI.DefaultIfEmpty() where G.UserID == UserID && I.TourDateID == A.TourDateID && H.RecordStatus == "Going" select new ViewFriendPlans() { Email = H.Email, ImageURL = H.ImageURL, ThumbnailURL = H.ThumbnailURL, UserID = H.UserID, UserName = H.UserName }).ToList() }).OrderBy(x => x.ArtistID).Skip(Pageindex * Pagesize).Take(Pagesize).ToList(); RemainingRecord = RemainingRecord - _list.Count; var goingList = (from A in db.UserFriends join B in db.UserGoing on A.Matched_UserID equals B.UserID into AB from B in AB.DefaultIfEmpty() where A.UserID == UserID && A.Matched_UserID > 0 && B.RecordStatus == "Going" select new { TourDateID = B.TourDateID }).Distinct().ToList(); List <int?> userlist1 = new List <int?>(); foreach (var item in goingList) { userlist1.Add(Convert.ToInt32(item.TourDateID)); } if (RemainingRecord > 0) { var list2 = (from A in db.TicketingEventTicketConfirmation join B in db.TicketingEventsNew on A.EventID equals B.EventID into AB from B in AB.DefaultIfEmpty() join C in db.Artists on B.ArtistId equals C.ArtistID into BC from C in BC.DefaultIfEmpty() join D in db.Venue on B.VenueName equals D.VenueName into CD from D in CD.DefaultIfEmpty() join E in db.TourDate on B.EventID equals E.TicketingEventID into DE from E in DE.DefaultIfEmpty() where A.EventID > 0 && userlist1.Contains(A.TourDateID) select new ViewYourFreiendplanlst() { TourDateID = E.TourDateID, // EventID = A.EventID, ArtistID = B.ArtistId, ArtistName = C.ArtistName, ImageURL = C.ImageURL, BannerImage_URL = C.BannerImage_URL, //StartDate = B.StartDate, //StartTime = B.StartTime, VenueID = D.VenueID, VenueName = D.VenueName, Datetime_Local = B.StartDate.Value }).Distinct().OrderBy(x => x.ArtistID).Skip(0).Take(RemainingRecord).ToList(); foreach (var item in list2) { item.Going = (from G in db.UserFriends join H in db.Users on G.Matched_UserID equals H.UserID into GH from H in GH.DefaultIfEmpty() join I in db.UserGoing on H.UserID equals I.UserID into HI from I in HI.DefaultIfEmpty() where G.UserID == UserID && I.TourDateID == item.TourDateID && I.RecordStatus == "Going" && G.Matched_UserID > 0 select new ViewFriendPlans() { Email = H.Email, ImageURL = H.ImageURL, ThumbnailURL = H.ThumbnailURL, UserID = H.UserID, UserName = H.UserName }).Distinct().ToList(); item.GoingCount = item.Going.Count(); item.Date_Local = item.Datetime_Local.ToString("d"); } _list.AddRange(list2); } return(Request.CreateResponse(HttpStatusCode.OK, JsonResponse.GetResponse(ResponseCode.Success, _list, "FriendPlans"))); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, JsonResponse.GetResponse(ResponseCode.Info, ex.Message, "FriendPlans"))); } }