public async Task <ActionResult> GetExhibitorForSpecificEvent(string Token, int eventId) { Exhibitors SponsorBusiness = new Exhibitors(); var data = await SponsorBusiness.GetExhibitorsForSpecificEvent(eventId); var result = Json(new { data = data.Select(x => new { x.ID, x.Name, Thumbnail = imageToUrlConvertionHandler(x.Thumbnail), //Helpers.ImageToBase64(MvcCustom.APiImagePath(x.Thumbnail)), x.Status, //iconimage = Helpers.ImageToBinary(MvcCustom.APiImagePath(x.UserPackageType.iconimage)), iconimage = imageToUrlConvertionHandler(x.ExhibitorsEvents.FirstOrDefault(y => y.EventID == eventId)?.UserPackageType?.iconimage), x.Description, x.DocURL, x.ExhibitorsEvents.FirstOrDefault(y => y.EventID == eventId)?.BoothNo, Documents = x.Documents.Select(y => new { y.ID, y.DocumentName, FilePath = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, MvcCustom.ApiDocumentPath(y.FilePath)) }), x.TwitterURL, x.WebsiteURL, }) }, JsonRequestBehavior.AllowGet); result.MaxJsonLength = int.MaxValue; return(result); }
public async Task <ActionResult> ExhibitorById(string Token, int id, int eventID) { Exhibitors attendesBusiness = new Exhibitors(); var x = await attendesBusiness.GetExhibitorsById(id); var eventExhibitor = x.ExhibitorsEvents.FirstOrDefault(y => y.EventID == eventID); var floorMapping = eventExhibitor?.FloorMapLocation?.FloorRegionMappings.FirstOrDefault(); return(Json(new { data = new { x.ID, x.Name, x.Description, x.DocURL, Thumbnail = imageToUrlConvertionHandler(x.Thumbnail), //Helpers.ImageToBase64(MvcCustom.APiImagePath(x.Thumbnail)), ExhibitorPackageType = x.ExhibitorsEvents.FirstOrDefault(y => y.EventID == eventID)?.UserPackageType?.Name, x.Status, Documents = x.Documents.Select(y => new { y.ID, y.DocumentName, FilePath = string.Format("{0}://{1}{2}", Request.Url.Scheme, Request.Url.Authority, MvcCustom.ApiDocumentPath(y.FilePath)) }), x.TwitterURL, x.WebsiteURL, eventExhibitor?.BoothNo, eventExhibitor?.StartTime, eventExhibitor?.EndTime, Note = x.Notes.FirstOrDefault(y => y.UserID == CurrentUserSession.AttendesID.Value && y.EventID == eventID)?.Text, FloorMap = floorMapping != null ? new { floorMapping?.FloorMapping?.ID, FloorName = eventExhibitor?.FloorMapLocation?.Location } : null } }, JsonRequestBehavior.AllowGet)); }
// GET: API/Exhibitor public async Task <ActionResult> Index(string Token, string term = "") { Exhibitors exhibitorBusiness = new Exhibitors(); var data = await exhibitorBusiness.GetExhibitors(term); return(Json(new { data = (await exhibitorBusiness.GetExhibitors(term)).Select(x => new { Description = x.Description, DocURL = x.DocURL, ID = x.ID, Name = x.Name, // iconimage = Helpers.ImageToBase64(MvcCustom.APiImagePath(x.UserPackageType.iconimage)), Status = x.Status, Thumbnail = imageToUrlConvertionHandler(x.Thumbnail), //Helpers.ImageToBase64(MvcCustom.APiImagePath(x.Thumbnail)), TwitterURL = x.TwitterURL, WebsiteURL = x.WebsiteURL }) }, JsonRequestBehavior.AllowGet)); }
public MainResponse AddUpdateExhibitor(ExhibitorRequest request, string actionBy) { if (request.ExhibitorId <= 0) { if (request.BackNumber != null) { var exhibitorBackNumberExist = _exhibitorRepository.GetSingle(x => x.BackNumber == request.BackNumber && x.IsActive == true && x.IsDeleted == false); if (exhibitorBackNumberExist != null && exhibitorBackNumberExist.ExhibitorId > 0) { _mainResponse.Message = Constants.BACKNUMBER_AlREADY_EXIST; _mainResponse.Success = false; return(_mainResponse); } } var address = new Addresses { Address = request.Address, CityId = request.CityId, ZipCodeId = request.ZipCodeId, CreatedBy = actionBy, CreatedDate = DateTime.Now }; var _address = _addressRepository.Add(address); var exhibitor = new Exhibitors { AddressId = _address.AddressId, FirstName = request.FirstName, LastName = request.LastName, BackNumber = request.BackNumber, BirthYear = request.BirthYear, IsNSBAMember = request.IsNSBAMember, IsDoctorNote = request.IsDoctorNote, QTYProgram = request.QTYProgram, PrimaryEmail = request.PrimaryEmail, SecondaryEmail = request.SecondaryEmail, Phone = request.Phone, Date = request.Date, CreatedBy = actionBy, CreatedDate = DateTime.Now, IsActive = true, IsDeleted = false }; var _exhibitor = _exhibitorRepository.Add(exhibitor); if (request.GroupId > 0) { var groupExhibitor = new GroupExhibitors { ExhibitorId = _exhibitor.ExhibitorId, GroupId = request.GroupId, CreatedBy = actionBy, CreatedDate = DateTime.Now, IsActive = true, IsDeleted = false }; var _groupExhibitor = _groupExhibitorRepository.Add(groupExhibitor); } if (_exhibitor != null && _exhibitor.ExhibitorId > 0 && request.exhibitorStallAssignmentRequests != null && request.exhibitorStallAssignmentRequests.Count > 0) { StallAssignment stallAssignment; foreach (var item in request.exhibitorStallAssignmentRequests) { stallAssignment = new StallAssignment(); stallAssignment.StallId = item.SelectedStallId; stallAssignment.StallAssignmentTypeId = item.StallAssignmentTypeId; stallAssignment.GroupId = 0; stallAssignment.ExhibitorId = _exhibitor.ExhibitorId; stallAssignment.BookedByType = "Exhibitor"; stallAssignment.IsActive = true; stallAssignment.IsDeleted = false; stallAssignment.CreatedDate = DateTime.Now; stallAssignment.Date = item.StallAssignmentDate; _stallAssignmentRepository.Add(stallAssignment); } } _mainResponse.Message = Constants.RECORD_ADDED_SUCCESS; _mainResponse.NewId = _exhibitor.ExhibitorId; _mainResponse.Success = true; } else { if (request.BackNumber != null) { var backNumber = _exhibitorRepository.GetSingle(x => x.ExhibitorId == request.ExhibitorId && x.BackNumber == request.BackNumber && x.IsActive == true && x.IsDeleted == false); if (backNumber == null) { var exhibitorBackNumberExist = _exhibitorRepository.GetSingle(x => x.BackNumber == request.BackNumber && x.IsActive == true && x.IsDeleted == false); if (exhibitorBackNumberExist != null && exhibitorBackNumberExist.ExhibitorId > 0) { _mainResponse.Message = Constants.BACKNUMBER_AlREADY_EXIST; _mainResponse.Success = false; return(_mainResponse); } } } var exhibitor = _exhibitorRepository.GetSingle(x => x.ExhibitorId == request.ExhibitorId && x.IsActive == true && x.IsDeleted == false); if (exhibitor != null && exhibitor.ExhibitorId > 0) { exhibitor.FirstName = request.FirstName; exhibitor.LastName = request.LastName; exhibitor.BackNumber = request.BackNumber; exhibitor.BirthYear = request.BirthYear; exhibitor.IsNSBAMember = request.IsNSBAMember; exhibitor.IsDoctorNote = request.IsDoctorNote; exhibitor.QTYProgram = request.QTYProgram; exhibitor.PrimaryEmail = request.PrimaryEmail; exhibitor.SecondaryEmail = request.SecondaryEmail; exhibitor.Phone = request.Phone; exhibitor.ModifiedDate = DateTime.Now; exhibitor.ModifiedBy = actionBy; _exhibitorRepository.Update(exhibitor); _mainResponse.Message = Constants.RECORD_UPDATE_SUCCESS; _mainResponse.NewId = request.ExhibitorId; _mainResponse.Success = true; var address = _addressRepository.GetSingle(x => x.AddressId == request.AddressId && x.IsActive == true && x.IsDeleted == false); if (address != null && address.AddressId > 0) { address.Address = request.Address; address.CityId = request.CityId; address.ZipCodeId = request.ZipCodeId; address.ModifiedBy = actionBy; address.ModifiedDate = DateTime.Now; _addressRepository.Update(address); } var stalls = _stallAssignmentRepository.RemoveAllExhibitorAssignedStalls(exhibitor.ExhibitorId); if (request.exhibitorStallAssignmentRequests != null && request.exhibitorStallAssignmentRequests.Count > 0) { foreach (var assignment in request.exhibitorStallAssignmentRequests) { StallAssignment stallAssignment = new StallAssignment(); stallAssignment.StallId = assignment.SelectedStallId; stallAssignment.StallAssignmentTypeId = assignment.StallAssignmentTypeId; stallAssignment.GroupId = 0; stallAssignment.ExhibitorId = exhibitor.ExhibitorId; stallAssignment.BookedByType = "Exhibitor"; stallAssignment.IsActive = true; stallAssignment.IsDeleted = false; stallAssignment.CreatedDate = DateTime.Now; stallAssignment.Date = assignment.StallAssignmentDate; _stallAssignmentRepository.Add(stallAssignment); } } if (request.GroupId > 0) { var groupExhibitor = _groupExhibitorRepository.GetSingle(x => x.ExhibitorId == exhibitor.ExhibitorId); if (groupExhibitor != null && groupExhibitor.GroupExhibitorId > 0) { groupExhibitor.GroupId = request.GroupId; groupExhibitor.ModifiedBy = actionBy; groupExhibitor.ModifiedDate = DateTime.Now; _groupExhibitorRepository.Update(groupExhibitor); } else { var group = new GroupExhibitors { GroupId = request.GroupId, ExhibitorId = request.ExhibitorId, CreatedBy = actionBy, CreatedDate = DateTime.Now }; _groupExhibitorRepository.Add(group); } } else { var groupExhibitor = _groupExhibitorRepository.GetSingle(x => x.ExhibitorId == exhibitor.ExhibitorId); if (groupExhibitor != null && groupExhibitor.GroupExhibitorId > 0) { groupExhibitor.IsActive = false; groupExhibitor.IsDeleted = true; _groupExhibitorRepository.Update(groupExhibitor); } } } else { _mainResponse.Message = Constants.NO_RECORD_EXIST_WITH_ID; _mainResponse.Success = false; } } return(_mainResponse); }