public CalendarEventTypeModel(CalendarEventType t)
 {
     this.CalendarEventTypeId = t.CalendarEventTypeId;
     this.ColorName = t.ColorName;
     this.ColorTempSelected = t.ColorTempSelected;
     this.EventType = t.EventType;
     this.EventTypeName = t.EventTypeName;
     this.PointsForExcused = t.PointsForExcused;
     this.PointsForNotPresent = t.PointsForNotPresent;
     this.PointsForPartial = t.PointsForPartial;
     this.PointsForPresent = t.PointsForPresent;
     this.PointsForTardy = t.PointsForTardy;
 }
 public ActionResult CalendarEditEventType(CalendarEventType eventType)
 {
     try
     {
         long eventTypeid = CalendarFactory.UpdateCalendarEventType(eventType);
     }
     catch (Exception exception)
     {
         ErrorDatabaseManager.AddException(exception, exception.GetType());
     }
     return Redirect(Url.Content("~/calendar/settings/" + eventType.OwnerEntity.ToString() + "/" + eventType.CalendarId.ToString().Replace("-", "") + "?u=" + SiteMessagesEnum.et));
 }
 public CalendarEventPortable()
 {
     //PointsForEvent = new List<CalendarEventPoint>();
     Attendees = new List<CalendarAttendance>();
     EventType = new CalendarEventType();
     Location = new Location.Location();
     MembersApartOfEvent = new List<CalendarAttendance>();
     MembersToCheckIn = new List<CalendarAttendance>();
     GroupsForEvent = new List<LeagueGroup>();
 }
示例#4
0
        public static RDN.Portable.Classes.Controls.Calendar.Calendar GetCalendar(Guid id, CalendarOwnerEntityEnum ownerEntity)
        {
            RDN.Portable.Classes.Controls.Calendar.Calendar newCal = new RDN.Portable.Classes.Controls.Calendar.Calendar();
            try
            {
                var dc = new ManagementContext();
                var calDb = (from xx in dc.Calendar
                             where xx.CalendarId == id
                             select new
                             {
                                 xx.CalendarId,
                                 xx.AllowSelfCheckIn,
                                 xx.NotPresentCheckIn,
                                 xx.DisableBirthdaysFromShowing,
                                 xx.DisableStartSkatingDays,
                                 xx.ImportFeedUrl,
                                 xx.CalendarImportTypeEnum,
                                 xx.TimeZone,
                                 xx.TimeZoneSelection,
                                 xx.IsCalendarInUTC
                             }).FirstOrDefault();

                if (calDb == null)
                    return null;

                newCal.CalendarId = id;
                newCal.OwnerEntity = ownerEntity;
                newCal.AllowSelfCheckIn = calDb.AllowSelfCheckIn;
                newCal.NotPresentCheckIn = calDb.NotPresentCheckIn;
                newCal.DisableSkatingStartDates = calDb.DisableStartSkatingDays;
                newCal.DisableBirthdays = calDb.DisableBirthdaysFromShowing;
                newCal.ImportFeedType = (CalendarImportTypeEnum)calDb.CalendarImportTypeEnum;
                newCal.ImportFeedUrl = calDb.ImportFeedUrl;
                if (calDb.TimeZoneSelection != null)
                    newCal.TimeZoneId = calDb.TimeZoneSelection.ZoneId;
                newCal.TimeZone = (int)calDb.TimeZone;

                newCal.TimeZones = Classes.Location.TimeZoneFactory.GetTimeZones();

                newCal.IsCalendarInUTC = calDb.IsCalendarInUTC;

                var types = dc.CalendarEventTypes.Where(x => x.CalendarOwner.CalendarId == id);
                foreach (var type in types)
                {
                    CalendarEventType t = new CalendarEventType();
                    t.CalendarEventTypeId = type.CalendarEventTypeId;
                    t.EventTypeName = type.EventTypeName;
                    t.PointsForExcused = type.PointsForExcused;
                    t.PointsForNotPresent = type.PointsForNotPresent;
                    t.PointsForPartial = type.PointsForPartial;
                    t.PointsForPresent = type.PointsForPresent;
                    t.PointsForTardy = type.PointsForTardy;
                    if (type.DefaultColor != null)
                    {
                        var c = Color.FromArgb(type.DefaultColor.ColorIdCSharp);
                        t.ColorTempSelected = ColorTranslator.ToHtml(c);
                        t.ColorName = type.DefaultColor.ColorName;
                    }
                    newCal.EventTypes.Add(t);
                }
            }
            catch (Exception exception)
            {
                ErrorDatabaseManager.AddException(exception, exception.GetType());
            }
            return newCal;
        }
示例#5
0
 public static long AddCalendarEventType(CalendarEventType calendarEventType)
 {
     try
     {
         var dc = new ManagementContext();
         RDN.Library.DataModels.Calendar.CalendarEventType t = new DataModels.Calendar.CalendarEventType();
         t.CalendarOwner = dc.Calendar.Where(x => x.CalendarId == calendarEventType.CalendarId).FirstOrDefault();
         t.EventTypeName = calendarEventType.EventTypeName;
         t.PointsForExcused = calendarEventType.PointsForExcused;
         t.PointsForNotPresent = calendarEventType.PointsForNotPresent;
         t.PointsForPartial = calendarEventType.PointsForPartial;
         t.PointsForPresent = calendarEventType.PointsForPresent;
         t.PointsForTardy = calendarEventType.PointsForTardy;
         if (!String.IsNullOrEmpty(calendarEventType.ColorTempSelected))
         {
             Color c = ColorTranslator.FromHtml(calendarEventType.ColorTempSelected);
             int arb = c.ToArgb();
             t.DefaultColor = dc.Colors.Where(x => x.ColorIdCSharp == arb).FirstOrDefault();
         }
         dc.CalendarEventTypes.Add(t);
         int cc = dc.SaveChanges();
         return t.CalendarEventTypeId;
     }
     catch (Exception exception)
     {
         ErrorDatabaseManager.AddException(exception, exception.GetType());
     }
     return 0;
 }
示例#6
0
        public static List<CalendarEventType> GetEventTypesOfCalendar(Guid calendarId)
        {
            List<CalendarEventType> newEventTypes = new List<CalendarEventType>();

            try
            {
                var dc = new ManagementContext();
                var locations = (from xx in dc.CalendarEventTypes
                                 where xx.CalendarOwner.CalendarId == calendarId
                                 select new
                                 {
                                     xx.CalendarEventTypeId,
                                     xx.EventTypeName,
                                     xx.PointsForExcused,
                                     xx.PointsForNotPresent,
                                     xx.PointsForPartial,
                                     xx.PointsForPresent,
                                     xx.PointsForTardy,
                                     xx.DefaultColor
                                 }).ToList();
                foreach (var even in locations)
                {
                    CalendarEventType ty = new CalendarEventType();
                    ty.CalendarId = calendarId;
                    ty.CalendarEventTypeId = even.CalendarEventTypeId;
                    ty.EventTypeName = even.EventTypeName;
                    ty.PointsForExcused = even.PointsForExcused;
                    ty.PointsForNotPresent = even.PointsForNotPresent;
                    ty.PointsForPartial = even.PointsForPartial;
                    ty.PointsForPresent = even.PointsForPresent;
                    ty.PointsForTardy = even.PointsForTardy;
                    if (even.DefaultColor != null)
                    {
                        var c = Color.FromArgb(even.DefaultColor.ColorIdCSharp);
                        ty.ColorTempSelected = ColorTranslator.ToHtml(c);
                        ty.ColorName = even.DefaultColor.ColorName;
                    }
                    newEventTypes.Add(ty);
                }
            }
            catch (Exception exception)
            {
                Error.ErrorDatabaseManager.AddException(exception, exception.GetType());
            }
            return newEventTypes;
        }
示例#7
0
 public static CalendarEventType GetEventType(long eventTypeId)
 {
     CalendarEventType ty = new CalendarEventType();
     try
     {
         var dc = new ManagementContext();
         var locations = (from xx in dc.CalendarEventTypes
                          where xx.CalendarEventTypeId == eventTypeId
                          select new
                          {
                              xx.CalendarEventTypeId,
                              xx.EventTypeName,
                              xx.PointsForExcused,
                              xx.PointsForNotPresent,
                              xx.PointsForPartial,
                              xx.PointsForPresent,
                              xx.PointsForTardy,
                              xx.DefaultColor
                          }).FirstOrDefault();
         if (locations != null)
         {
             ty.CalendarEventTypeId = locations.CalendarEventTypeId;
             ty.EventTypeName = locations.EventTypeName;
             ty.PointsForExcused = locations.PointsForExcused;
             ty.PointsForNotPresent = locations.PointsForNotPresent;
             ty.PointsForPartial = locations.PointsForPartial;
             ty.PointsForPresent = locations.PointsForPresent;
             ty.PointsForTardy = locations.PointsForTardy;
             if (locations.DefaultColor != null)
             {
                 var c = Color.FromArgb(locations.DefaultColor.ColorIdCSharp);
                 ty.ColorTempSelected = ColorTranslator.ToHtml(c);
                 ty.ColorName = locations.DefaultColor.ColorName;
             }
             return ty;
         }
     }
     catch (Exception exception)
     {
         Error.ErrorDatabaseManager.AddException(exception, exception.GetType());
     }
     return ty;
 }