Beispiel #1
0
 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();
 }
Beispiel #2
0
        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");
        }
Beispiel #3
0
        //// 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();
        }
Beispiel #4
0
 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");
 }