public List<sp_Availablity_DM> ListVolunteerAvailability(Guid? VolID)
        {
            List<sp_Availablity_DM> list = new List<sp_Availablity_DM>();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    list = (from result in context.sp_Availability_Select(VolID)
                            select new sp_Availablity_DM
                            {
                                VolID = result.VolID,
                                AddrID = result.AddrID,
                                AvailDateID = result.AvailDateID,
                                AvailStartDate = result.AvailStartDate,
                                AvailEndDate = result.AvailEndDate,
                                DayID = result.DayID,
                                StartTime = result.StartTime,
                                EndTime = result.EndTime
                            }).ToList();
                } // Guaranteed to close the Connection
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return list;
        }
示例#2
0
        public IEnumerable<Appointment> ListVolunteerAvailability(Guid? VolID, int AddrID)
        {
            List<Appointment> apts = new List<Appointment>();

            List<sp_Availablity_DM> listAvailability = new List<sp_Availablity_DM>();
            try
            {
                using (VolTeerEntities context = new VolTeerEntities())
                {
                    listAvailability = (from result in context.sp_Availability_Select(VolID, AddrID)
                                        select new sp_Availablity_DM
                     {
                         VolID = result.VolID,
                         AddrID = result.AddrID,
                         AvailID = result.AvailID,
                         AvailStart = result.AvailStart,
                         AvailEnd = result.AvailEnd,
                         Reminder = result.Reminder,
                         Annotations = result.Annotations,
                         Description = result.Description,
                         RecurrenceParentID = result.RecurrenceParentID,
                         Subject = result.Subject,
                         RecurrenceRule = result.RecurrenceRule

                         //Start = result.AvailStart,
                         //End = result.AvailEnd,
                         //Description = result.Description,
                         //RecurrenceParentID = result.RecurrenceParentID,
                         //RecurrenceRule = result.RecurrenceRule,
                         //Subject = result.Subject
                     }).ToList();

                    foreach (sp_Availablity_DM cAvailability in listAvailability)
                    {
                        Appointment apt = new Appointment();
                        apt.Start = cAvailability.AvailStart;
                        apt.End = cAvailability.AvailEnd;
                        apt.Description = cAvailability.Description;
                        apt.RecurrenceParentID = cAvailability.RecurrenceParentID;
                        apt.RecurrenceRule = cAvailability.RecurrenceRule;
                        apt.Subject = cAvailability.Subject;

                        apt.Attributes.Add("VolID", cAvailability.VolID.ToString());
                        apt.Attributes.Add("AddrID", cAvailability.AddrID.ToString());
                        apt.Attributes.Add("AvailID", cAvailability.AvailID.ToString());

                        apts.Add(apt);
                    }

                    return apts;
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            return apts;
        }