public IHttpActionResult DeleteSlotsByYear(int year) { RSR sr; sr = RwpSlots.ClearYear(year); return(Ok(sr)); }
public IHttpActionResult DeleteAllSlots() { RSR sr; sr = RwpSlots.ClearAll(); return(Ok(sr)); }
[TestCase("3/18/2017", "07:30:00 PM", "Sun, 19 Mar 2017 02:30:00 GMT")] // after PDT public static void TestStartTimeFromDateAndTime(string sStartDate, string sTime, string sExpected) { DateTime dttmStart = DateTime.Parse(sStartDate); DateTime dttmActual = RwpSlots.StartTimeFromDateAndTime(dttmStart, sTime); Assert.AreEqual(sExpected, dttmActual.ToString("r")); }
public Stream GetCsvSlots() { Stream stm = new MemoryStream(4096); RwpSlots slots = new RwpSlots(); slots.GetCsv(stm); stm.Flush(); stm.Seek(0, SeekOrigin.Begin); return(stm); }
public static RSR_CalItems GetCalendarItemsForTeam(string sTeam) { SqlWhere sw = new SqlWhere(); RSR rsr; RSR_CalItems rci; RwpSlots slots = new RwpSlots(); sw.AddAliases(RwpSlot.s_mpAliases); try { sw.Add(String.Format("$$rwllpractice$$.Reserved = '{0}'", Sql.Sqlify(sTeam)), SqlWhere.Op.And); rsr = RSR.FromSR(Sql.ExecuteQuery(null, sw.GetWhere(RwpSlot.s_sSqlQueryString), slots, _sResourceConnString)); if (!rsr.Succeeded) { rci = RSR_CalItems.FromRSR(rsr); rci.Reason = String.Format("{0} {1}", rci.Reason, _sResourceConnString); return(rci); } rci = RSR_CalItems.FromRSR(RSR.FromSR(SR.Success())); List <CalItem> plci = new List <CalItem>(); if (slots.Slots != null) { foreach (RwpSlot slot in slots.Slots) { CalItem ci = new CalItem(); ci.Start = StartTimeFromDateAndTime(slot.SlotDate, slot.StartTime); ci.End = StartTimeFromDateAndTime(slot.SlotDate, slot.EndTime); ci.Location = String.Format("{0}: {1}", slot.Venue, slot.Field); ci.Title = String.Format("Team Practice: {0}", slot.Reserved); ci.Description = String.Format("Redmond West Little League team practice at {0} ({1}), for team {2}", slot.Venue, slot.Field, slot.Reserved); ci.UID = String.Format("{0}-rwllpractice-{1}", slot.Slot, slot.SlotDate.ToString("yyyyMMdd")); plci.Add(ci); } } rci.TheValue = plci; return(rci); } catch (Exception e) { rci = RSR_CalItems.FromRSR(RSR.Failed(e)); rci.Reason = String.Format("{0} ({1})", rci.Reason, sTeam); return(rci); } }
public IHttpActionResult PutSlots(HttpRequestMessage request) { string TimeZoneID = "Pacific Standard Time"; Task <Stream> stm = request.Content.ReadAsStreamAsync(); // need to figure out how to pass this as a parameter TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(TimeZoneID); if (tzi == null) { throw new Exception($"cannot load timezone {TimeZoneID}"); } stm.Wait(); RSR sr; sr = RwpSlots.ImportCsv(stm.Result, tzi); return(Ok(sr)); }
public HttpResponseMessage GetSlots(string TimeZoneID) { Stream stm = new MemoryStream(4096); RwpSlots slots = new RwpSlots(); TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(TimeZoneID); if (tzi == null) { throw new Exception($"cannot load timezone {TimeZoneID}"); } slots.GetCsv(stm, tzi); stm.Flush(); stm.Seek(0, SeekOrigin.Begin); HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new StreamContent(stm); result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); return(result); }
public IHttpActionResult GetCalendarForTeam(string linkID) { RSR_CalItems items = RwpSlots.GetCalendarItemsForTeam(linkID); return(Ok(items)); }
public RSR ClearYear(int nYear) { return(RwpSlots.ClearYear(nYear)); }
public RSR ClearSlots() { return(RwpSlots.ClearAll()); }
public RSR ImportCsvSlots(Stream stmCsv) { return(RwpSlots.ImportCsv(stmCsv)); }
public RSR_CalItems GetCalendarForTeam(string sTeamName) { return(RwpSlots.GetCalendarItemsForTeam(sTeamName)); }