public MemberModel ConvertToModel(Member member) { MemberModel result = new MemberModel(); PhotoRepository prepo = new PhotoRepository(new yslDataContext()); result.MemberId = member.MemberId; result.Name = member.Name; result.FirstName = member.Account.FirstName; result.LastName = member.Account.LastName; result.Email = member.Account.Email; result.Photo = prepo.getPhotoAsModel(member.Photo); return result; }
public ActionResult ProcessAddition(string meta) { string[] source = meta.Split(new char[] { '~' }); PhotoRepository photoRepository = new PhotoRepository(new yslDataContext()); AccountRepository accountRepository = new AccountRepository(new yslDataContext()); MemberRepository memberRepository = new MemberRepository(new yslDataContext()); Request.Cookies.Get("ysl"); string text = source.Last<string>(); string text2 = text; text2 = text2.Replace("/temp", ""); string text3 = Server.MapPath(text); string destFileName = text3.Replace("\\temp", ""); try { System.IO.File.Move(text3, destFileName); Account account = new Account { FirstName = source.First<string>(), LastName = source.ElementAt(1), Email = source.ElementAt(3), Password = "******" }; int accountId = accountRepository.addAccount(account); Photo photo = new Photo { AccountId = accountId, Title = "", Description = "", Location = text2 }; int value = photoRepository.addPhoto(photo); memberRepository.addMember(new Member { AccountId = accountId, Name = source.ElementAt(2), PhotoId = new int?(value) }); } catch { } return View(); }
public ArtistModel ConvertToModel(Artist artist) { MemberRepository mRepo = new MemberRepository(new yslDataContext()); PhotoRepository pRepo = new PhotoRepository(new yslDataContext()); ArtistModel result = new ArtistModel(); result.ArtistId = artist.ArtistId; result.Bio = artist.Bio; result.Name = artist.Name; result.Photo = pRepo.getPhotoAsModel(artist.Photo); result.Members = new List<MemberModel>(); foreach (var m in artist.ArtistMembers) { var mem = mRepo.ConvertToModel(m.Member); result.Members.Add(mem); } return result; }
public ActionResult Processsingle(string meta, string uploads) { string[] array = uploads.Split(new char[] { ';' }); string[] array2 = meta.Split(new char[] { '~' }); new AudioRepository(new yslDataContext()); base.Request.Cookies.Get("ysl"); int value = 1; DateTime.Now.ToString("MMMM dd, yyyy"); IAudioAlbumRepository audioAlbumRepository = new AudioAlbumRepository(new yslDataContext()); new AudioAlbumItemRepository(new yslDataContext()); IPhotoRepository photoRepository = new PhotoRepository(new yslDataContext()); string text = array2[2]; text = text.Replace("/temp", ""); string text2 = HostingEnvironment.MapPath(array2[2]); string destFileName = text2.Replace("\\temp", ""); int value2 = 0; try { System.IO.File.Move(text2, destFileName); value2 = photoRepository.addPhoto(new Photo { AccountId = 5, Location = text, Title = "", Description = "" }); } catch { } AudioAlbum audioAlbum = new AudioAlbum { ArtistId = new int?(value), Title = array2[0], Description = array2[1], PhotoId = new int?(value2), IsSingle = true, IsFeatured = bool.Parse(array2[3]) }; int audioAlbumId = audioAlbumRepository.addAudioAlbum(audioAlbum); AudioAlbum audioAlbum2 = audioAlbumRepository.getAudioAlbum(audioAlbumId); string[] array3 = array; for (int i = 0; i < array3.Length; i++) { string text3 = array3[i]; if (!string.IsNullOrWhiteSpace(text3)) { string[] array4 = text3.Split(new char[] { ',' }); text = array4[0]; text = text.Replace("/temp", ""); text2 = HostingEnvironment.MapPath(array4[0]); destFileName = text2.Replace("\\temp", ""); var dLink = text; if (!array2[4].Trim().Equals("autoGen")) dLink = array2[4].Trim(); try { System.IO.File.Move(text2, destFileName); Audio audio = new Audio { AccountId = 5, Title = array2[0], Description = array2[1], Location = text }; audioAlbum2.AudioAlbumItems.Add(new AudioAlbumItem { Audio = audio, Track = audioAlbum.AudioAlbumItems.Count + 1, AudioAlbum = audioAlbum, DownloadLink = dLink }); } catch { } } } audioAlbumRepository.updateAudioAlbum(audioAlbum2); return base.RedirectToAction("Index"); }
public PhotoAlbumData getPhotoAlbumDataForJSON(int id) { PhotoAlbumData result; var pRepo = new PhotoRepository(new yslDataContext()); try { PhotoAlbum photoAlbum = this.db.PhotoAlbums.Single((PhotoAlbum a) => a.PhotoAlbumId == id); List<PhotoAlbumItemData> photos = ( from a in this.db.PhotoAlbums where a.PhotoAlbumId == id select a).Join(this.db.PhotoAlbumItems, (PhotoAlbum a) => a.PhotoAlbumId, (PhotoAlbumItem p) => p.PhotoAlbumId,(a,p) => new PhotoAlbumItemData{photo = pRepo.getPhotoAsModel(p.Photo), photoAlbumItemId = a.PhotoAlbumId}).ToList(); PhotoAlbumData photoAlbumData = new PhotoAlbumData { photoAlbumId = id, description = photoAlbum.Description, title = photoAlbum.Title, photos = photos }; result = photoAlbumData; } catch (Exception) { result = new PhotoAlbumData(); } return result; }
//// GET: Event //public ActionResult Index() //{ // EventRepository eventRepository = new EventRepository(new yslDataContext()); // var events = eventRepository.getArtistEvents(1); // ViewBag.events = events; // return View(); //} //// GET: Event //public ActionResult View(int id) //{ // var eRepo = new EventRepository(new yslDataContext()); // var _event = eRepo.getEvent(id); // var events = eRepo.getArtistEvents(1); // events.Remove(_event); // ViewBag._event = _event; // ViewBag.events = events; // return View(); //} public ActionResult Processupload( string meta, string uploads, string people) { string[] source = uploads.Split(new char[] { '~' }); PhotoRepository photoRepository = new PhotoRepository(new yslDataContext()); EventArtistRepository eventArtistRepository = new EventArtistRepository(new yslDataContext()); EventRepository eventRepository = new EventRepository(new yslDataContext()); ArtistRepository artistRepository = new ArtistRepository(new yslDataContext()); Request.Cookies.Get("ysl"); var text = source.Last<string>().Split(',').ToList(); string text2 = text.First(); text2 = text2.Replace("/temp", ""); var useDefaultImage = text2.Trim().ToLower().Equals("none"); string text3 = ""; string destFileName = ""; string photoName = ""; if (!useDefaultImage) { text3 = Server.MapPath(text.First()); destFileName = text3.Replace("\\temp", ""); photoName = text.Last(); } int accountId = int.Parse(System.Web.HttpContext.Current.User.Identity.GetUserId()) ; var metaFields = meta.Split('~').ToList(); try { if (!useDefaultImage) { System.IO.File.Move(text3, destFileName); } Photo photo = new Photo { AccountId = accountId, Title = photoName, Description = "", Location = text2, Uploaded = DateTime.Now, Updated = DateTime.Now }; int value = (useDefaultImage) ? GlobalVariables.DefaultEventImageId : photoRepository.addPhoto(photo); var ys = artistRepository.getArtist(1); Event ev = new Event(); ev.AccountId = accountId; ev.Title = metaFields[0]; ev.Start = DateTime.Parse(metaFields[1] + " " + metaFields[2]); ev.Ending = DateTime.Parse(metaFields[3] + " " + metaFields[4]); ev.Location = metaFields[5]; ev.Description = metaFields[6]; ev.Venue = metaFields[7]; ev.PhotoId = value; ev.Created = DateTime.Now; var evId = eventRepository.addEvent(ev); EventArtist eva = new EventArtist() { ArtistId = ys.ArtistId, EventId = evId }; eventArtistRepository.addEventArtist(eva); } catch { } return View(); }
public AudioAlbumDataForJSON getLatestSingle(int artistId) { var pRepo = new PhotoRepository(new yslDataContext()); var aRepo = new AudioAlbumItemRepository(new yslDataContext()); AudioAlbumDataForJSON result; try { List<AudioAlbumDataForJSON> source = ( from b in this.db.AudioAlbums where b.ArtistId == artistId select b into s orderby s.Created descending select s).Join(this.db.Photos, (AudioAlbum a) => a.PhotoId, (Photo p) => p.PhotoId, (AudioAlbum, Photo) => new AudioAlbumDataForJSON { artist = AudioAlbum.Artist.Name, audioAlbumId = AudioAlbum.AudioAlbumId, photo = pRepo.getPhotoAsModel(Photo), title = AudioAlbum.Title, tracks = aRepo.getAudioAlbumItemAsModel(AudioAlbum.AudioAlbumItems.ToList()) }).ToList<AudioAlbumDataForJSON>(); result = source.First<AudioAlbumDataForJSON>(); } catch { result = new AudioAlbumDataForJSON(); } return result; }
public ActionResult Processupload(string meta, string uploads) { string[] array = uploads.Split(new char[] { ';' }); string[] array2 = meta.Split(new char[] { '~' }); ArtistRepository artistRepository = new ArtistRepository(new yslDataContext()); Request.Cookies.Get("ysl"); int accountId = 2; DateTime.Now.ToString("MMMM dd, yyyy"); MemberRepository memberRepository = new MemberRepository(new yslDataContext()); ArtistMemberRepository artistMemberRepository = new ArtistMemberRepository(new yslDataContext()); IPhotoRepository photoRepository = new PhotoRepository(new yslDataContext()); string text = array2[1]; text = text.Replace("/temp", ""); string text2 = Server.MapPath(array2[1]); string destFileName = text2.Replace("\\temp", ""); int value = 0; try { System.IO.File.Move(text2, destFileName); value = photoRepository.addPhoto(new Photo { AccountId = accountId, Location = text, Title = "", Description = "" }); } catch { } Artist artist = new Artist { Name = array2[0], PhotoId = new int?(value), Bio = array2[2] }; int artistId = artistRepository.addArtist(artist); string[] array3 = array; for (int i = 0; i < array3.Length; i++) { string text3 = array3[i]; if (!string.IsNullOrWhiteSpace(text3)) { try { Member member = memberRepository.getMember(text3.Trim()); ArtistMember member2 = new ArtistMember { ArtistId = artistId, MemberId = member.MemberId }; artistMemberRepository.addArtistMember(member2); } catch { } } } return RedirectToAction("Index"); }