Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lawsonDivisionNumber"></param>
        /// <returns></returns>
        private string GetZipCodesForLawsonDivisionNumber(string lawsonDivisionNumber)
        {
            RSG_ZipCodes          zCodes     = new RSG_ZipCodes();
            string                zipCodes   = "";
            ServiceLocationClient wcLocation = new ServiceLocationClient();

            try
            {
                if (wcLocation != null)
                {
                    zCodes = wcLocation.GetZipCodesByLawsonDivisionNumbers(lawsonDivisionNumber);
                    if (zCodes != null)
                    {
                        if (zCodes.RSG_ZipCode.Count() > 0)
                        {
                            foreach (RSG_ZipCode cd in zCodes.RSG_ZipCode)
                            {
                                if (zipCodes == "")
                                {
                                    zipCodes = cd.ZipCode;
                                }
                                else
                                {
                                    zipCodes += "," + cd.ZipCode;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingService.LogErrorInULS(ex);
            }
            finally
            {
                if (wcLocation.State == System.ServiceModel.CommunicationState.Faulted)
                {
                    wcLocation.Abort();
                }
                else
                {
                    wcLocation.Close();
                }
            }

            return(zipCodes);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="lawsonDivisionNumber"></param>
        /// <returns></returns>
        private string GetZipCodesForLawsonDivisionNumberAsString(string zipCode)
        {
            RSG_LawsonDivisionNumber zCodes  = new RSG_LawsonDivisionNumber();
            string lawsonDivisionNos         = "";
            ServiceLocationClient wcLocation = new ServiceLocationClient();

            try
            {
                if (wcLocation != null)
                {
                    zCodes = wcLocation.GetLawsonDivisionNumbersByZipCode(zipCode);
                    if (zCodes != null)
                    {
                        foreach (LawsonDivisionNumber cd in zCodes.LawsonDivisionNumber)
                        {
                            if (lawsonDivisionNos == "")
                            {
                                lawsonDivisionNos = cd.LawsonDivisonNumber;
                            }
                            else
                            {
                                lawsonDivisionNos += "," + cd.LawsonDivisonNumber;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingService.LogErrorInULS(ex);
                lblNoResults.Text    = string.Format("Error : {0} - StackTracke : {1}", ex.Message, ex.StackTrace);
                lblNoResults.Visible = true;
            }
            finally
            {
                if (wcLocation.State == System.ServiceModel.CommunicationState.Faulted)
                {
                    wcLocation.Abort();
                }
                else
                {
                    wcLocation.Close();
                }
            }

            return(lawsonDivisionNos);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="zipCode"></param>
        /// <returns></returns>
        private DataTable GetZipCodesForLawsonDivisionNumberAsDataTable(string zipCode)
        {
            DataTable dt = new DataTable("LawsonDivisionNumbers");

            dt.Columns.Add(new DataColumn("LawsonDivisionNo", typeof(string)));

            RSG_LawsonDivisionNumber zCodes     = new RSG_LawsonDivisionNumber();
            ServiceLocationClient    wcLocation = new ServiceLocationClient();

            try
            {
                if (wcLocation != null)
                {
                    zCodes = wcLocation.GetLawsonDivisionNumbersByZipCode(zipCode);
                    if (zCodes != null)
                    {
                        foreach (LawsonDivisionNumber cd in zCodes.LawsonDivisionNumber)
                        {
                            dt.Rows.Add(cd.LawsonDivisonNumber.ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LoggingService.LogErrorInULS(ex);

                lblNoResults.Text    = string.Format("Error : {0} - StackTracke : {1}", ex.Message, ex.StackTrace);
                lblNoResults.Visible = true;
            }
            finally
            {
                if (wcLocation.State == System.ServiceModel.CommunicationState.Faulted)
                {
                    wcLocation.Abort();
                }
                else
                {
                    wcLocation.Close();
                }
            }

            return(dt);
        }