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