public void UpdatePerformance(Performance performance)
 {
     var request = new RestRequest("api/Performance/UpdatePerformance", Method.POST);
     request.RequestFormat = DataFormat.Json;
     request.AddBody(performance);
     client.Execute(request);
 }
 public Performance CreatePerformance(DateTime date, Artist artist, Venue venue)
 {
     Performance param = new Performance(0, date, artist.Id, venue.Id);
     var request = new RestRequest("api/Performance/CreatePerformance", Method.POST);
     request.RequestFormat = DataFormat.Json;
     request.AddBody(param);
     return client.Execute<Performance>(request).Data;
 }
Ejemplo n.º 3
0
        private String GenerateTableRow(Venue venue, Performance[] performances)
        {
            String tableRow = "<tr class='h4 tableCellCenter small'>";
            tableRow += "<td class='warning '><strong>" + HttpUtility.HtmlEncode(venue.Shortcut) + " <br>" + HttpUtility.HtmlEncode(venue.Name) + "</strong></td>";
            for (var i = 0; i < performances.Length; i++) {
                if (performances[i] == null) {
                    tableRow += "<td></td>";
                } else {
                    Artist a = aS.GetArtistById(performances[i].ArtistId);
                    tableRow += "<td><strong>" + HttpUtility.HtmlEncode(a.Name) + " / "+ HttpUtility.HtmlEncode(catS.GetCategoryById(a.CategoryId).Shortcut)+ "</strong></br> (" + HttpUtility.HtmlEncode(couS.GetCountryById(a.CountryId).Name)+")</td>";
                }

            }
            tableRow += "</tr>";
            return tableRow;
        }
Ejemplo n.º 4
0
        private String GenerateTableBody(List<Performance> performances, int beginHour, int endHour)
        {
            String tableContent = "<tbody>";
            performances.Sort((perf1, perf2) => {
                Venue v1 = vS.GetVenueById(perf1.VenueId);
                Venue v2 = vS.GetVenueById(perf2.VenueId);
                int result = v1.Shortcut.CompareTo(v2.Shortcut);
                if (result != 0) {
                    return result;
                }
                return perf1.Date.CompareTo(perf2.Date);
            });
            uint curVId = performances[0].VenueId;

            Performance[] curVenuePerf = new Performance[endHour - beginHour + 1];
            var last = performances[performances.Count - 1];
            foreach (var p in performances) {

                if (p.VenueId == curVId) {
                    curVenuePerf[p.Date.Hour - beginHour] = p;
                } else {
                    tableContent += GenerateTableRow(vS.GetVenueById(curVId), curVenuePerf);
                    for (int i = 0; i < curVenuePerf.Length; i++) {
                        curVenuePerf[i] = null;
                    }
                    curVId = p.VenueId;
                    curVenuePerf[p.Date.Hour - beginHour] = p;
                }
                if(last == p) {
                    tableContent += GenerateTableRow(vS.GetVenueById(curVId), curVenuePerf);
                }
            }
            tableContent += "</tbody>";
            return tableContent;
        }
Ejemplo n.º 5
0
 public bool UpdatePerformance(Performance performance)
 {
     DbCommand cmd = db.CreateCommand(UPDATE_CMD);
     db.DefineParameter(cmd, "@id", System.Data.DbType.UInt32, performance.Id);
     db.DefineParameter(cmd, "@date", System.Data.DbType.DateTime, db.ConvertDateTimeToDbFormat(performance.Date));
     db.DefineParameter(cmd, "@artistId", System.Data.DbType.UInt32, performance.ArtistId);
     db.DefineParameter(cmd, "@venueId", System.Data.DbType.UInt32, performance.VenueId);
     return db.ExecuteNonQuery(cmd) >= 1;
 }
Ejemplo n.º 6
0
 public bool DeletePerformance(Performance performance)
 {
     DbCommand cmd = db.CreateCommand(DELETE_CMD);
     db.DefineParameter(cmd, "@id", System.Data.DbType.UInt32, performance.Id);
     return cmd.ExecuteNonQuery() >= 1;
 }