public static int AddAppointment(Appointment newAppointment, Band b)
        {
            AddBandWrapper abWrapper = new AddBandWrapper(b, newAppointment);
            WebResponse resp = POST(Uri + "/rest/bands/appointments", JsonConvert.SerializeObject(abWrapper));

            String id = new StreamReader(resp.GetResponseStream()).ReadToEnd();
            return int.Parse(JsonConvert.DeserializeObject<String>(id));
        }
        public static Boolean AddBand(Band b, String username)
        {
            AddBandWrapper abWrapper = new AddBandWrapper(b, username);
            WebResponse resp = POST(Uri + "/rest/bands", JsonConvert.SerializeObject(abWrapper));

            if (((HttpWebResponse)resp).StatusCode != HttpStatusCode.OK && ((HttpWebResponse)resp).StatusCode != HttpStatusCode.Created &&
                ((HttpWebResponse)resp).StatusCode != HttpStatusCode.NoContent)
            {
                return false;
            }

            return true;
        }
        public BandmemberManagement(Band signedInBand)
        {
            InitializeComponent();

            currentBand = signedInBand;

            //set datagrids
            this.currentBand.Musicians = WebserviceManager.GetMusiciansOfBand(currentBand.Name);
            this.dgCurrentBandmembers.ItemsSource = this.currentBand.Musicians;

            this.currentBand.AppearanceRequests = WebserviceManager.GetAppearanceRequestsOfBand(currentBand.Name);
            this.dgReceivedAppearanceRequests.ItemsSource = this.currentBand.AppearanceRequests;

            this.currentBand.Appointments = WebserviceManager.GetAppointmentsOfBand(currentBand.Name);
            this.dgAppointments.ItemsSource = this.currentBand.Appointments;

            this.currentBand.RehearsalRequests = WebserviceManager.GetRehearsalRequestsOfBand(currentBand.Name);
            this.dgRehearsalRequests.ItemsSource = this.currentBand.RehearsalRequests;

            DisplaySignedInData();
        }
        private void dgRehearsalRequests_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            RehearsalRequest rehRequestToFix = (RehearsalRequest)this.dgRehearsalRequests.SelectedItem;

            if (rehRequestToFix != null)
            {
                //select available times where person has min duration-time between start and end
                currentBand = WebserviceManager.GetAvailableTimesOfBand(currentBand);  //set the ones to the mitarbeiter and send band back?

                //calculate times where all members have time and add them to list
                List<AvailableTime> listEntries = calcBestTimesForRehRequest(rehRequestToFix);
                this.lvSuggestedTimesRehearsalRequest.ItemsSource = listEntries;
            }
            else
            {
                this.lvSuggestedTimesRehearsalRequest.ItemsSource = null;
            }
        }
 public static void UpdateBand(Band currentBand)
 {
     PUT(Uri + "/rest/bands", JsonConvert.SerializeObject(currentBand));
 }
 public static void RemoveMusicianFromBand(Band b, string username)
 {
     AddBandWrapper abWrapper = new AddBandWrapper(b, username);
     DELETE(Uri + "/rest/bands/members", JsonConvert.SerializeObject(abWrapper));
 }
        public static Band GetAvailableTimesOfBand(Band currentBand)
        {
            WebResponse resp = PUT(Uri + "/rest/bands/availableTimes", JsonConvert.SerializeObject(currentBand));

            String data = new StreamReader(resp.GetResponseStream()).ReadToEnd();
            return (Band)JsonConvert.DeserializeObject<Band>(data);
        }
        public static bool AllMembersOfBandAccepted(Band currentBand, Appointment appointmentToUpdate)
        {
            String data = GET(Uri + "/rest/appointments/"+ currentBand.Name + "/" + appointmentToUpdate.Id);

            return Boolean.Parse(JsonConvert.DeserializeObject<String>(data));
        }
        public static int AddRehearsalRequest(Band b, RehearsalRequest rehRequest)
        {
            AddBandWrapper abWrapper = new AddBandWrapper(b, rehRequest);
            WebResponse resp = POST(Uri + "/rest/bands/rehearsalRequests", JsonConvert.SerializeObject(abWrapper));

            String id = new StreamReader(resp.GetResponseStream()).ReadToEnd();
            return int.Parse(JsonConvert.DeserializeObject<String>(id));
        }