예제 #1
0
        /// <summary>
        /// Method to get calendar events
        /// </summary>
        /// <param name="uId">uId</param>
        public List <CalendarEventInfo> GetCalendarEvents(string uId)
        {
            try {
                SqlParameter[] parms = { new SqlParameter("@UID", SqlDbType.VarChar, 50) };
                parms[0].Value = uId;

                var calEvents = new List <CalendarEventInfo>();
                using (var rdr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.Text, SqlText.SQL_SELECT_CALENDAR_GETCALENDAREVENTS, parms)) {
                    while (rdr.Read())
                    {
                        var calEvent = new CalendarEventInfo();
                        calEvent.EventID    = ComUtility.DBNullInt32Handler(rdr["EventID"]);
                        calEvent.CalendarID = ComUtility.DBNullInt32Handler(rdr["CalendarID"]);
                        calEvent.Title      = ComUtility.DBNullStringHandler(rdr["Title"]);
                        calEvent.StartDate  = ComUtility.DBNullDateTimeHandler(rdr["StartDate"]);
                        calEvent.EndDate    = ComUtility.DBNullDateTimeHandler(rdr["EndDate"]);
                        calEvent.IsAllDay   = ComUtility.DBNullNullableBooleanHandler(rdr["IsAllDay"]);
                        calEvent.Notes      = ComUtility.DBNullStringHandler(rdr["Notes"]);
                        calEvent.Location   = ComUtility.DBNullStringHandler(rdr["Location"]);
                        calEvent.Reminder   = ComUtility.DBNullStringHandler(rdr["Reminder"]);
                        calEvent.Url        = ComUtility.DBNullStringHandler(rdr["Url"]);
                        calEvent.IsNew      = ComUtility.DBNullNullableBooleanHandler(rdr["IsNew"]);
                        calEvent.UID        = ComUtility.DBNullStringHandler(rdr["UID"]);
                        calEvent.UpdateTime = ComUtility.DBNullDateTimeHandler(rdr["UpdateTime"]);
                        calEvents.Add(calEvent);
                    }
                }
                return(calEvents);
            } catch { throw; }
        }