public List <IAppointment> GetAppointments(long staffId, DateTime appointmentDate)
        {
            var request = new GetStaffAppointmentsRequest
            {
                // Set Source Credentials
                SourceCredentials = new SourceCredentials
                {
                    SourceName = "apidevhomework",
                    Password   = "******",
                    SiteIDs    = new ArrayOfInt {
                        -31100
                    }
                },
                // Set Staff Credentials
                StaffCredentials = new StaffCredentials
                {
                    Username = @"Owner",
                    Password = @"apidemo1234",
                    SiteIDs  = new ArrayOfInt {
                        -31100
                    }
                },
                // Inquire about this. Instructions say to use staff credentials in the format below, which doesn't yeild any results.
                // Using the owner creds with the StaffIds array does get the results that we are looking for. Bug in API Or User Error?
                // Note to Self: Change first parameter back to IStaff instead of long when this is working as instructions state
                //StaffCredentials = new StaffCredentials
                //    {
                //        Username = string.Format("{0}.{1}", staff.FirstName, staff.LastName),
                //        Password = string.Format("{0}{1}{2}", staff.FirstName[0], staff.LastName[0], staff.Id),
                //        SiteIDs = new ArrayOfInt {-31100}
                //    }
                StaffIDs = new ArrayOfLong {
                    staffId
                },
                StartDate = appointmentDate,
                EndDate   = appointmentDate
            };

            var proxy = new AppointmentServiceSoapClient();
            GetStaffAppointmentsResult response = proxy.GetStaffAppointments(request);

            return(response.Appointments.Select(appointment => new AppointmentModel
            {
                Id = appointment.ID,
                AppointmentDate = appointment.StartDateTime,
                StartTime = appointment.StartDateTime,
                EndTime = appointment.EndDateTime,
                ClientName = string.Format("{0} {1}", appointment.Client.FirstName, appointment.Client.LastName),
                SessionType = appointment.SessionType.Name
            }).Cast <IAppointment>().ToList());
        }
        public List<IAppointment> GetAppointments(long staffId, DateTime appointmentDate)
        {
            var request = new GetStaffAppointmentsRequest
                {
                    // Set Source Credentials
                    SourceCredentials = new SourceCredentials
                        {
                            SourceName = "apidevhomework",
                            Password = "******",
                            SiteIDs = new ArrayOfInt {-31100}
                        },
                    // Set Staff Credentials
                    StaffCredentials = new StaffCredentials
                        {
                            Username = @"Owner",
                            Password = @"apidemo1234",
                            SiteIDs = new ArrayOfInt {-31100}
                        },
                    // Inquire about this. Instructions say to use staff credentials in the format below, which doesn't yeild any results.
                    // Using the owner creds with the StaffIds array does get the results that we are looking for. Bug in API Or User Error?
                    // Note to Self: Change first parameter back to IStaff instead of long when this is working as instructions state
                    //StaffCredentials = new StaffCredentials
                    //    {
                    //        Username = string.Format("{0}.{1}", staff.FirstName, staff.LastName),
                    //        Password = string.Format("{0}{1}{2}", staff.FirstName[0], staff.LastName[0], staff.Id),
                    //        SiteIDs = new ArrayOfInt {-31100}
                    //    }
                    StaffIDs = new ArrayOfLong {staffId},
                    StartDate = appointmentDate,
                    EndDate = appointmentDate
                };

            var proxy = new AppointmentServiceSoapClient();
            GetStaffAppointmentsResult response = proxy.GetStaffAppointments(request);

            return response.Appointments.Select(appointment => new AppointmentModel
                {
                    Id = appointment.ID,
                    AppointmentDate = appointment.StartDateTime,
                    StartTime = appointment.StartDateTime,
                    EndTime = appointment.EndDateTime,
                    ClientName = string.Format("{0} {1}", appointment.Client.FirstName, appointment.Client.LastName),
                    SessionType = appointment.SessionType.Name
                }).Cast<IAppointment>().ToList();
        }
        public virtual List <IAppointment> GetStaffAppointments(IStaff staff, DateTime appointmentDate)
        {
            // Appointments might span midnight
            DateTime endDate = appointmentDate.AddDays(1);

            var request = new GetStaffAppointmentsRequest
            {
                SourceCredentials = new SourceCredentials
                {
                    SourceName = "MBO.Russel.Fritch",
                    Password   = "******",
                    SiteIDs    = new ArrayOfInt {
                        -31100
                    }
                },

                StaffCredentials = new StaffCredentials
                {
                    Username = string.Format("{0}.{1}", staff.FirstName, staff.LastName),
                    Password = string.Format("{0}{1}{2}", staff.FirstName.ToLower()[0], staff.LastName.ToLower()[0], staff.ID),
                    SiteIDs  = new ArrayOfInt {
                        -31100
                    }
                },
                StartDate = appointmentDate,
                EndDate   = endDate,
            };
            var proxy = new AppointmentServiceSoapClient();
            GetStaffAppointmentsResult response = proxy.GetStaffAppointments(request);

            return(response.Appointments.Select(appointment => new AppointmentModel
            {
                ID = appointment.ID,
                StartDateTime = appointment.StartDateTime,
                EndDateTime = appointment.EndDateTime,
                ClientName = string.Format("{0} {1}", appointment.Client.FirstName, appointment.Client.LastName),
                SessionType = appointment.SessionType.Name
            }).Cast <IAppointment>().ToList());
        }