Esempio n. 1
0
        public static RSR_CalItems FromRSR(RSR rsr)
        {
            RSR_CalItems _twsr = new RSR_CalItems();

            _twsr.Reason = rsr.Reason;
            _twsr.Result = rsr.Result;

            return(_twsr);
        }
Esempio n. 2
0
            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);
                }
            }