Beispiel #1
0
        private void initTopUsers()
        {
            topUsersListView = FindViewById <ListView> (Resource.Id.TopUsersListView);

            topUsersList = MusicoConnUtil.GetTopUsers();



            int maxUsers = 2;

            if (topUsersList.Count <= 2)
            {
                maxUsers = topUsersList.Count - 1;
            }

            string[] items = new string[maxUsers + 1];

            int startIndex = 0;

            for (int i = maxUsers; i >= 0; i--)
            {
                items [startIndex] = topUsersList [i].UserName;
                startIndex++;
            }

            CustomListAdapter listAdapter = new CustomListAdapter(this, items);

            topUsersListView.SetAdapter(listAdapter);
            topUsersListView.Clickable = false;
        }
Beispiel #2
0
        private void initBandInfo()
        {
            bandName = this.Intent.GetStringExtra("name");

            band = MusicoConnUtil.GetBandByNameAsync(bandName);

            bandNameTV = FindViewById <TextView> (Resource.Id.BandName);

            avgPriceTV = FindViewById <TextView> (Resource.Id.AvgPrice);

            genreTV = FindViewById <TextView> (Resource.Id.Genre);

            locationTV = FindViewById <TextView> (Resource.Id.Location);

            requerimentsTV = FindViewById <TextView> (Resource.Id.Requeriments);

            eventsTV = FindViewById <TextView> (Resource.Id.Events);

            ratingRB = FindViewById <RatingBar> (Resource.Id.Rating);


            facebookIBTN = FindViewById <ImageButton> (Resource.Id.FbImageBtn);

            youtubeIBTN = FindViewById <ImageButton> (Resource.Id.YoImageBtn);

            bandNameTV.Text     = band.Name;
            avgPriceTV.Text     = "$" + band.AvgPrice;
            genreTV.Text        = band.Genre;
            locationTV.Text     = band.Location;
            requerimentsTV.Text = band.Requirements;

            facebookIBTN.Click += FacebookIBTN_Click;
            youtubeIBTN.Click  += YoutubeIBTN_Click;
        }
Beispiel #3
0
        async void BookBtn_Click(object sender, EventArgs e)
        {
            description = descriptionTV.Text;

            dateString = dateTV.Text;



            foreach (Booking booking in band.Bookings)
            {
                if (booking.Date.ToString("yyyy-MM-dd") == dateString)
                {
                    Toast.MakeText(this, "Sorry, this artist is not available in the date you selected", ToastLength.Long).Show();
                    return;
                }
            }
            int result = await MusicoConnUtil.AddBooking(description, Convert.ToDateTime(dateString), userId, band.Id);

            if (result < 0)
            {
                Toast.MakeText(this, "An error has ocurred, please try again", ToastLength.Short).Show();
                return;
            }

            Toast.MakeText(this, "You have booked this artist!", ToastLength.Long).Show();
            Intent intent = new Intent(this, typeof(HomeActivity));

            intent.PutExtra("id", userId);
            StartActivity(intent);
            Finish();
        }
Beispiel #4
0
        private void initTopBands()
        {
            topBandsListView = FindViewById <ListView> (Resource.Id.TopListView);
            topBandsList     = MusicoConnUtil.GetAllBandsAsync();

            topBandsList.Sort();



            int maxBands = 4;

            if (topBandsList.Count <= 4)
            {
                maxBands = topBandsList.Count - 1;
            }


            string[] items      = new string[maxBands + 1];
            int      startIndex = 0;

            for (int i = maxBands; i >= 0; i--)
            {
                items [startIndex] = topBandsList [i].Name;
                startIndex++;
            }

            CustomListAdapter listAdapter = new CustomListAdapter(this, items);

            topBandsListView.SetAdapter(listAdapter);
            topBandsListView.Clickable = true;

            topBandsListView.ItemClick += topBandClick_Click;
        }
Beispiel #5
0
        private void initBandRecommendation()
        {
            recomendedListView  = FindViewById <ListView> (Resource.Id.reccomendedListView);
            recommendedBandList = MusicoConnUtil.SearchBandsAsync("saskatoon", null, 0, 9999999, 0, new DateTime(), null);



            int maxBands = 5;

            if (recommendedBandList.Count < 5)
            {
                maxBands = recommendedBandList.Count;
            }

            string[] items = new string[maxBands];
            for (int i = 0; i < maxBands; i++)
            {
                items [i] = recommendedBandList [i].Name;
            }

            //ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(this, Android.Resource.Layout.SimpleListItem1, items);


            CustomListAdapter listAdapter = new CustomListAdapter(this, items);


            recomendedListView.SetAdapter(listAdapter);
            recomendedListView.Clickable  = true;
            recomendedListView.ItemClick += RecomendedListView_ItemClick;
        }
Beispiel #6
0
        private async void AddCommentBtn_Click(object sender, EventArgs e)
        {
            type    = qualificationSPN.SelectedItem.ToString();
            comment = commentTV.Text;

            int result = await MusicoConnUtil.AddComment(comment, type, bandId, userId);

            Intent intent = new Intent(this, typeof(CommentsActivity));

            intent.PutExtra("name", bandName);
            intent.PutExtra("id", userId);

            Toast.MakeText(this, "Comment added!", ToastLength.Short).Show();
            StartActivity(intent);
            Finish();
        }
Beispiel #7
0
        private void initBandInfo()
        {
            bandName = this.Intent.GetStringExtra("name");

            band = MusicoConnUtil.GetBandByNameAsync(bandName);

            bandNameTV = FindViewById <TextView> (Resource.Id.BandName);

            avgPriceTV = FindViewById <TextView> (Resource.Id.AvgPrice);

            genreTV = FindViewById <TextView> (Resource.Id.Genre);

            bandNameTV.Text = band.Name;
            avgPriceTV.Text = "$" + band.AvgPrice;
            genreTV.Text    = band.Genre;
        }
Beispiel #8
0
        private void initBandInfo()
        {
            band = MusicoConnUtil.GetBandByNameAsync(bandName);

            bandNameTV = FindViewById <TextView> (Resource.Id.BandName);

            avgPriceTV = FindViewById <TextView> (Resource.Id.AvgPrice);

            genreTV = FindViewById <TextView> (Resource.Id.Genre);

            locationTV = FindViewById <TextView> (Resource.Id.Location);

            ratingRB = FindViewById <RatingBar> (Resource.Id.Rating);

            bandNameTV.Text = band.Name;
            avgPriceTV.Text = "$" + band.AvgPrice;
            genreTV.Text    = band.Genre;
            locationTV.Text = band.Location;
            ratingRB.Rating = band.AvgRate;
        }
Beispiel #9
0
        public async void AddReviewBtn_Click(object sender, EventArgs e)
        {
            comment     = commentTV.Text;
            overall     = overallRB.Rating;
            quality     = qualityRB.Rating;
            punctuality = punctualityRB.Rating;
            flexibility = flexibilityRB.Rating;
            enthusiasm  = enthusiasmRB.Rating;
            similarity  = similarityRB.Rating;

            int result = await MusicoConnUtil.AddReview(comment, overall, quality, punctuality, flexibility, enthusiasm, similarity, userId, bandId);

            Intent intent = new Intent(this, typeof(ReviewsActivity));

            intent.PutExtra("name", bandName);
            intent.PutExtra("id", userId);

            Toast.MakeText(this, "Review added!", ToastLength.Short).Show();
            StartActivity(intent);
            Finish();
        }
Beispiel #10
0
        public async void BtnLogin_Click(object sender, EventArgs e)
        {
            email    = login_accounts.Text;
            password = login_password.Text;
            bool isNetWorking = Utils.isNetworkAvailable(this);


            if (isNetWorking == true)
            {
                if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
                {
                    DialogFactory.ToastDialog(this, "Login", "Username and password cannot be empty!", 0);
                }
                else
                {
                    //check email
                    Match match = Regex.Match(email, "^(\\w)+(\\.\\w+)*@(\\w)+((\\.\\w{2,3}){1,3})$");
                    //if (match.Success) {

                    ll_loginpage.Alpha = 0.5f;

                    try {
                        result = await MusicoConnUtil.AuthenticateUser(email, password);
                    } catch (Exception) {
                        ll_loginpage.Alpha = 1.0f;
                        AlertDialog.Builder ab = new AlertDialog.Builder(this);
                        ab.SetTitle("Server busy");
                        ab.SetMessage("Server is busy,please try again later!");
                        ab.SetPositiveButton("confirm", delegate(object sndr, DialogClickEventArgs ee) {
                        });
                        ab.Create().Show();
                    }

                    if (result > 0)
                    {
                        //login successfull

                        Toast.MakeText(this, "Login successfull!", ToastLength.Short).Show();
                        Intent intent = new Intent(this, typeof(HomeActivity));
                        intent.PutExtra("email", email);
                        intent.PutExtra("id", result + "");
                        StartActivity(intent);
                        Finish();
                    }
                    else
                    {
                        ll_loginpage.Alpha = 1.0f;
                        //failed
                        DialogFactory.ToastDialog(this, "Login", "Username or password is not correct!", 0);                                         //to do:specific error msg
                    }

                    //} else {
                    //	ll_loginpage.Alpha = 1.0f;
                    //	DialogFactory.ToastDialog (this, "Login", "Email format is incorrent!", 0);
                    //}
                }
            }
            else
            {
                DialogFactory.ToastDialog(this, "Connect Error", "There is no internet,please connect the internet!", 0);
            }
        }
Beispiel #11
0
        void SearchBTN_Click(object sender, EventArgs e)
        {
            List <Band> foundBands;

            name = null;

            if (nameTV.Text.Length > 0)
            {
                name = nameTV.Text;
            }

            genre = null;

            if (genreTV.Text.Length > 0)
            {
                genre = genreTV.Text;
            }

            location = null;

            if (locationTV.Text.Length > 0)
            {
                location = locationTV.Text;
            }

            date = null;

            if (dateTV.Text.Length == 10)
            {
                date = dateTV.Text;
            }

            minRating = 0;

            if (minRatingBar.Rating > 0.0)
            {
                minRating = minRatingBar.Rating;
            }

            int minRatingI = (int)Math.Round(minRating, 0);

            minPrice = minPriceSeekBar.Progress;

            maxPrice = 0;

            if (maxPriceSeekBar.Progress > 0)
            {
                maxPrice = maxPriceSeekBar.Progress;
            }

            foundBands = MusicoConnUtil.SearchBandsAsync(location, genre, minPrice, maxPrice, minRatingI, Convert.ToDateTime(date), name);
            foundBands.Sort();

            string[] names   = new string[foundBands.Count];
            float[]  prices  = new float[foundBands.Count];
            float[]  ratings = new float[foundBands.Count];

            int j = foundBands.Count - 1;

            for (int i = 0; i < foundBands.Count; i++)
            {
                names [j]   = foundBands [i].Name;
                prices [j]  = foundBands [i].AvgPrice;
                ratings [j] = foundBands [i].AvgRate;
                j--;
            }

            Intent intent = new Intent(this, typeof(BandListActivity));

            intent.PutExtra("names", names);
            intent.PutExtra("prices", prices);
            intent.PutExtra("ratings", ratings);
            intent.PutExtra("id", userId);
            StartActivity(intent);
        }