コード例 #1
0
        public async Task GetEmployeeAppointments()
        {
            ServiceLayer s = ServiceLayer.getInstance();

            //await s.MakeRequest(new DTO_User { Username = usernameBox.Text, Pass = passwordBox.Text }, typeof(DTO_Employee), "Login");
            await s.MakeRequest(s.LoggedInEmployee, typeof(List <DTO_CalendarData>), "GetCalendarDataByEmployeeID");

            foreach (var calData in s.CalendarDataList)
            {
                await s.MakeRequest(new DTO_Lead { LeadID = (int)calData.LeadID }, typeof(DTO_Lead), "GetLeadByLeadID");

                await s.MakeRequest(new DTO_Address { AddressID = (int)s.Lead.AddressID }, typeof(DTO_Address), "GetAddressByID");

                MappedAppointments.Add(new MappedAppointment
                {
                    MappedSubject   = s.AppointmentTypes[calData.AppointmentTypeID - 1].AppointmentType,
                    MappedStartTime = calData.StartTime,
                    MappedEndTime   = calData.EndTime,
                    MappedNote      = calData.Note,
                    MappedLocation  = "Some Location",
                    CalendarDataID  = calData.EntryID,
                    LeadID          = (int)calData.LeadID,
                    AddressID       = s.Lead.AddressID
                });


                /* TODAYS APPOINTMENTS*/
                DateTime time = new DateTime(calData.StartTime.Year, calData.StartTime.Month, calData.StartTime.Day);
                //if(time == DateTime.Today)
                if (time == new DateTime(2016, 5, 10))
                {
                    await s.MakeRequest(new DTO_Lead { LeadID = (int)calData.LeadID }, typeof(DTO_Lead), "GetLeadByLeadID");

                    await s.MakeRequest(new DTO_Address { AddressID = (int)s.Lead.AddressID }, typeof(DTO_Address), "GetAddressByID");

                    AddressZipcodeValidation citystatefromzip = new AddressZipcodeValidation();
                    string citystate = citystatefromzip.CityStateLookupRequest(s.Address1.Zip);

                    string city = citystate.Substring(citystate.IndexOf("<City>") + 6, citystate.IndexOf("</City>") - citystate.IndexOf("<City>") + 6);
                    TodaysAppointments.Add(new TodaysAppointment
                    {
                        AppointmentType = s.AppointmentTypes[calData.AppointmentTypeID - 1].AppointmentType,
                        StartTime       = calData.StartTime.ToString("h:mm tt"), //calData.StartTime.TimeOfDay.ToString("tt"),
                        EndTime         = calData.EndTime.ToString("h:mm tt"),   //calData.EndTime.TimeOfDay.ToString(),
                        Note            = calData.Note,
                        Address         = s.Address1.Address + " " + s.Address1.Zip,
                        CalendarDataID  = calData.EntryID,
                        LeadID          = (int)calData.LeadID,
                        AddressID       = s.Lead.AddressID
                    });
                }
            }
        }
コード例 #2
0
        public async Task UpdateCalendarData(Syncfusion.UI.Xaml.Schedule.AppointmentEditorClosedEventArgs e)
        {
            MappedAppointment appointment = e.EditedAppointment as MappedAppointment;
            MappedAppointment original    = e.OriginalAppointment as MappedAppointment;

            appointment.CalendarDataID = original.CalendarDataID;
            appointment.LeadID         = original.LeadID;


            ServiceLayer s1 = ServiceLayer.getInstance();

            s1.CalData           = s1.CalendarDataList.Find(c => c.EntryID == appointment.CalendarDataID);
            s1.CalData.StartTime = appointment.MappedStartTime;
            s1.CalData.EndTime   = appointment.MappedEndTime;
            s1.CalData.Note      = appointment.MappedNote;

            await s1.MakeRequest(s1.CalData, typeof(DTO_CalendarData), "UpdateCalendarData");

            if (s1.CalData.SuccessFlag)
            {
                MessageBox.Show(s1.CalData.SuccessFlag.ToString(), "Success", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            else
            {
                MessageBox.Show(s1.CalData.SuccessFlag.ToString(), "Failure", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }