Beispiel #1
0
        [TestCase("3/12/2017", "07:30:00 PM", "Mon, 13 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"));
        }
Beispiel #2
0
        public static RSR_CalItems GetCalendarItemsForTeam(string sLinkID)
        {
            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 = (select TeamID from rwllcalendarlinks where linkid='{0}')", Sql.Sqlify(sLinkID)), SqlWhere.Op.And);

                rsr = RSR.FromSR(Sql.ExecuteQuery(null, sw.GetWhere(RwpSlot.s_sSqlQueryString), slots,
                                                  Startup._sResourceConnString));

                if (!rsr.Succeeded)
                {
                    rci        = RSR_CalItems.FromRSR(rsr);
                    rci.Reason = String.Format("{0} {1}", rci.Reason, Startup._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       = slot.SlotStart;
                        ci.End         = slot.SlotStart.AddMinutes(slot.SlotLength);
                        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.SlotStart.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, sLinkID);
                return(rci);
            }
        }