コード例 #1
0
        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;
        }