c# - QAS Pro. Problems with certain addresses -


i work call centre has been using qas pro near 2 years now. use resource dll inside access databases talk internally hosted qas server. use gather address details based on postcode. first function gets list of address postcode, inserts them combo box in access. after operator can select appropriate address , inserts correct fields.

this written developer no longer us. job fix code. testing i've been able verify c# code use , not addresses. test harness works fine.

the resource dll uses c# test code qas file few functions. i'm new c# , have never worked on before. appreciated.

this code written old colleague.

  namespace mangoqas {     using com.qas.proweb;     using system;     using system.runtime.compilerservices;     using system.runtime.interopservices;      [comvisible(true)]     public class qas     {         public qas()         {             quickaddress address = new quickaddress("http://10.10.15.7:2021") {                 engine = quickaddress.enginetypes.singleline,                 flatten = true             };             this.searchservice = address;         }          private string getmoniker(string p)         {             return this.searchservice.search("gbr", p, promptset.types.default, "database layout").picklist.items[0].moniker;         }          public string[] refinepostcode(string p)         {             string moniker = this.getmoniker(p);             formattedaddress formattedaddress = this.searchservice.getformattedaddress(moniker, "database layout");             return new string[] { formattedaddress.addresslines[0].line, formattedaddress.addresslines[1].line, formattedaddress.addresslines[2].line, formattedaddress.addresslines[3].line, formattedaddress.addresslines[4].line, formattedaddress.addresslines[5].line, formattedaddress.addresslines[6].line };         }          public string[] searchpostcodes(string postcode)         {             searchresult result = this.searchservice.search("gbr", postcode, promptset.types.oneline, "database layout");             string[] strarray = new string[result.picklist.length];             (int = 0; < result.picklist.length; i++)             {                 strarray[i] = result.picklist.items[i].text;             }             return strarray;         }          private quickaddress searchservice { get; set; }     } } 

searchpostcodes - brings list of addresses based on postcode. refinepostcode - takes address line , sends formatted address.

the problem seems refinepostcode. have tried formatting address string first thought didn't forward slashes. did not work.

for example, using postcode: pa169ae.
gives me: 0/1 15 brachelston street, greenock, renfrewshire, @ top of combobox.
if click on address send back: 1 crossgates, greenock road, pa7 5ju.
changing including postcode entered.

i believe problem refinepostcode or getmoniker. 2 blocks below sample code , unchanged, may required diagnose.

    public formattedaddress getformattedaddress(string smoniker, string slayout)     {         debug.assert((smoniker != null) && (slayout != null));         qagetaddress qagetaddress = new qagetaddress {             layout = slayout,             moniker = smoniker,             qaconfig = this.m_config,             language = this.m_languagestring         };         formattedaddress address2 = null;         try         {             address2 = new formattedaddress(this.searchservice.dogetaddress(qagetaddress).qaaddress);         }         catch (exception exception)         {             this.mapexception(exception);         }         return address2;     }       public searchresult search(string sdataid, string ssearch, promptset.types tpromptset, string slayout)     {         debug.assert(sdataid != null);         debug.assert(ssearch != null);         qasearch qasearch = new qasearch {             country = sdataid,             engine = this.m_engine         };         qasearch.engine.promptset = (promptsettype) tpromptset;         qasearch.engine.promptsetspecified = true;         qasearch.layout = slayout;         qasearch.qaconfig = this.m_config;         qasearch.search = ssearch;         qasearch.language = this.m_languagestring;         searchresult result = null;         try         {             result = new searchresult(this.searchservice.dosearch(qasearch));         }         catch (exception exception)         {             this.mapexception(exception);         }         return result;     } 

i've thoroughly searched google , cant seem find reason happen. can post more code samples if required.

did figure out?

from looks of it, think problem have here context of search. both qas server, , quickaddress class stateless - have no history of previous searches.

because of @ moment there nothing linking first search postcodes, , second search on address line. so, when call refinepostcode not refining @ all. instead performing brand new search uk wide on "0/1 15 brachelston street, greenock, renfrewshire". whilst qas pro can handle this, search generates few possibilities result after not first 1 returned.

there few possibilities here improve workflow. avoid making changes vba code , limit changes sample above introduce state class , change workflow passing in postcode search. similar following:

public class qas {     public qas()     {                // create new soap proxy can talk qas pro web            quickaddress address = new quickaddress("http://10.10.15.7:2021")          {             engine = quickaddress.enginetypes.singleline,             flatten = true         };          this.searchservice = address;     }      /// <summary>     /// supplied search, moniker can used format address.     /// </summary>     private string getmoniker(string p)     {         return this.searchservice.search("gbr", p, promptset.types.default, "database layout").picklist.items[0].moniker;     }      /// <summary>     /// return formatted address supplied search.      /// </summary>     public string[] refinepostcode(string p)     {         // append postcode our address speed , improve searches.         string search = p + "," + postcode;          searchresult result = this.searchservice.search("gbr",                                                          postcode,                                                         promptset.types.oneline,                                                         "database layout");         if ( result.picklist.items.length > 0 )         {          }         else         {             // workflow if address not found?         }         string moniker = this.getmoniker(search);         formattedaddress formattedaddress = this.searchservice.getformattedaddress(moniker, "database layout");         return new string[] { formattedaddress.addresslines[0].line, formattedaddress.addresslines[1].line, formattedaddress.addresslines[2].line, formattedaddress.addresslines[3].line, formattedaddress.addresslines[4].line, formattedaddress.addresslines[5].line, formattedaddress.addresslines[6].line };     }      /// <summary>     /// once postcode captured operator, return list of potential addresses.      /// </summary>     public string[] searchpostcodes(string postcode)     {         postcode = postcode;         searchresult result = this.searchservice.search("gbr",                                                          postcode,                                                         promptset.types.oneline,                                                         "database layout");          string[] strarray = new string[result.picklist.length];         (int = 0; < result.picklist.length; i++)         {             strarray[i] = result.picklist.items[i].text;         }         return strarray;     }      private quickaddress searchservice { get; set; }      /// <summary>     /// gets or sets postcode initial search.     /// </summary>     private string postcode     {         get;         set;     }  } 

if have time though, better go little further , fix workflow. context between searches in qas pro web handled through monikers. these tokens pro web provides after interactions server can use either formatted addresses or perform further searching with. there more details on in documentation provided.

after initial search on postcode, list of addresses , each of these has moniker associated it. if able store these monikers , associate these list put combo box when operator selects 1 can pass moniker straight getformatted address , should able capture addresses quicker, more accurately , less code!

hope helps! al.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -