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 }); } } }
async private void GetCustomerDetailsByLeadID(int leadID) { DTO_Lead ld = new DTO_Lead(); DTO_Customer cu = new DTO_Customer(); DTO_Address ad = new DTO_Address(); ld.LeadID = leadID; await s1.GetLeadByLeadID(ld); ld = s1.Lead; ad.AddressID = ld.AddressID; cu.CustomerID = ld.CustomerID; await s1.GetCustomerByID(cu); await s1.GetAddressByID(ad); cu = s1.Cust; ad = s1.Address1; FinishedName = ""; if (cu.FirstName != string.Empty) { FinishedName += cu.FirstName + " "; } if (cu.MiddleName != string.Empty) { FinishedName += cu.MiddleName + " "; } if (cu.LastName != string.Empty) { FinishedName += cu.LastName + " "; } if (cu.Suffix != string.Empty) { FinishedName += cu.Suffix; } if (cu.PrimaryNumber != string.Empty) { leadPriPhoneText.Text = cu.PrimaryNumber; } if (cu.SecondaryNumber != string.Empty) { leadSecPhoneText.Text = cu.SecondaryNumber; } if (cu.Email != string.Empty) { leadEmailAddressText.Text = cu.Email; } //MessageBox.Show(FinishedName); leadNameText.Text = FinishedName; AddressZipcodeValidation citystatefromzip = new AddressZipcodeValidation(); string citystate = citystatefromzip.CityStateLookupRequest(ad.Zip); string city = citystate.Substring(citystate.IndexOf("<City>") + 6, citystate.IndexOf("</City>") - citystate.IndexOf("<City>") - 6); string state = AddressZipcodeValidation.ConvertStateToAbbreviation(citystate.Substring(citystate.IndexOf("<State>") + 7, citystate.IndexOf("</State>") - citystate.IndexOf("<State>") - 7)); leadAddressText.Text = ad.Address.ToString(); string[] w = city.Split(' '); city = ""; int i = 0; foreach (string t in w) { city += t.Substring(0, 1).ToUpper(); city += t.Substring(1, t.Length - 1).ToLower(); if (i > 0) { city += " "; } } // city.ToLower(); // TextInfo textinfo = new CultureInfo("en-US", false).TextInfo; // textinfo.ToTitleCase(city); //city = Regex.Replace(city, @"(^\w)|(\s\w)", m => m.Value.ToUpper()); leadCitySTZipText.Text = city + ", " + state + " " + ad.Zip.ToString(); ShowOnMap(null, MakeAddress(ad.Address.ToString(), city, state, ad.Zip.ToString())); // this.dTO_LeadDataGrid.ItemsSource = s1.LeadList; }