public static Amnd.WSTransactionResponse[] GetTypes() { Amnd.WSTransactionResponse[] LicTypes = null; Amnd.WSTransactionRequest transObj = new Amnd.WSTransactionRequest(); Amnd.WSTransactionRequest[] transAr = new Amnd.WSTransactionRequest[] { transObj }; AClient ac = new AClient("WSAmandaServiceHttpSoap11Endpoint"); using (new OperationContextScope(ac.InnerChannel)) { HttpRequestMessageProperty requestProperty = new HttpRequestMessageProperty(); requestProperty.Headers["lid"] = Models.AmandaWS.Lid; OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestProperty; var types = ac.executeCustomTransaction(4002, transAr); LicTypes = types; } return(LicTypes); }
protected void Search_Click(object sender, EventArgs e) { int cnt = 0; err.Text = ""; lbresult.Text = ""; ShowSearchResult.Text = resultcont + row; string tempSNUMBER = txt_SNumber.Text; bool numeric = true; string result = ""; // pending int pendingCnt = 0; string licType = ""; string businessname = " "; string applicant = " "; // status codes: 14 pending, 2 issued, 7 closed #region AmandaWS client and search criteria AClient ac = new AClient("WSAmandaServiceHttpSoap11Endpoint"); using (new OperationContextScope(ac.InnerChannel)) { HttpRequestMessageProperty requestProperty = new HttpRequestMessageProperty(); requestProperty.Headers["lid"] = lid; OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestProperty; Amnd.WSValidOperator vo = ac.getValidOperators(); ASearch fTypes = new ASearch { tableName = "Folder", fieldName = "folderType", operatorSpecified = true, @operator = vo.IN, value = new string[] { "BROK", "CBOX", "GL", "FWKS" }, conjuctiveOperatorSpecified = true, conjuctiveOperator = vo.AND }; ASearch expDate = new ASearch { tableName = "Folder", fieldName = "expirydate", operatorSpecified = true, @operator = vo.GREATER_THAN, value = new string[] { String.Format("{0:dd-MMM-yyyy}", DateTime.Today.AddYears(-14)) }, negativeSpecified = true, negative = false, conjuctiveOperatorSpecified = true, conjuctiveOperator = vo.AND }; ASearch finalDate = new ASearch { tableName = "Folder", fieldName = "finaldate", operatorSpecified = true, @operator = vo.IS_NULL, conjuctiveOperatorSpecified = true, conjuctiveOperator = vo.AND, value = new string[] { vo.CLOSE_PARENTHESES.ToString() } }; ASearch exStatus = new ASearch { tableName = "Folder", fieldName = "statuscode", operatorSpecified = true, @operator = vo.EQUAL, value = new string[] { "7" }, negativeSpecified = true, negative = true, conjuctiveOperatorSpecified = true, conjuctiveOperator = vo.NONE }; ASearch notPending = new ASearch { tableName = "Folder", fieldName = "statuscode", operatorSpecified = true, @operator = vo.IN, value = new string[] { "14", "126" }, negativeSpecified = true, negative = true, conjuctiveOperatorSpecified = true, conjuctiveOperator = vo.AND }; ASearch pendingSearch = new ASearch { tableName = "Folder", fieldName = "statuscode", operatorSpecified = true, @operator = vo.IN, value = new string[] { "14", "126" }, negativeSpecified = true, negative = false, conjuctiveOperatorSpecified = true, conjuctiveOperator = vo.NONE }; ASearch bizSearch = new ASearch { tableName = "folderinfo", fieldName = "infovalue", value = new string[] { " " }, conjuctiveOperatorSpecified = true, operatorSpecified = true, @operator = vo.LIKE, conjuctiveOperator = vo.AND }; ASearch streetSearch = new ASearch(); ASearch civicNo = new ASearch(); ASearch[] query = new ASearch[] { fTypes, expDate, streetSearch, civicNo, finalDate, notPending, exStatus }; // address + issued ASearch[] pendingQuery = new ASearch[] { fTypes, streetSearch, civicNo, pendingSearch }; // pending + address ASearch[] bizQuery = new ASearch[] { fTypes, bizSearch, expDate, finalDate, notPending, exStatus }; // business name + issued ASearch[] pendingBiz = new ASearch[] { fTypes, bizSearch, expDate, pendingSearch }; // business name + pending #endregion #region Location Validity Check if ((txt_SNumber.Text.Length < 1) && (txtSName.Text.Length < 1) && (txtBName.Text.Length < 1)) { err.Text = err.Text + "<br />Please provide a location info or a business name."; err.Visible = true; } else if (((txt_SNumber.Text.Length > 1) || (txtSName.Text.Length > 1)) && (txtBName.Text.Length > 1)) { err.Text = err.Text + "<br />Please provide only a location info or a business name."; err.Visible = true; } else if (((txt_SNumber.Text.Length > 0) || (txtSName.Text.Length > 0) || (txtBName.Text.Length < 1))) { if (txt_SNumber.Text.Length > 0 || txtSName.Text.Length > 0) { if (txt_SNumber.Text.Trim() == "") { txt_SNumber.Text = "0"; } if (!IsNumeric(txt_SNumber.Text)) { err.Text = err.Text + "<br>" + "Street Number Must be Numric "; txt_SNumber.Text = ""; numeric = false; } #endregion #region Location Search else { ///////////////////////////////////////////////////////////// //sql = "SELECT * FROM property WHERE "; if (txtSName.Text.Length > 0) { //string UpperSName = txtSName.Text.Replace("'", "''").ToUpper(); //sql = sql + " UPPER(propstreet) LIKE('%" + UpperSName + "%') AND"; streetSearch.tableName = "Property"; streetSearch.fieldName = "propStreetUpper"; streetSearch.value = new string[] { txtSName.Text.ToUpper().Trim() }; streetSearch.operatorSpecified = true; streetSearch.@operator = vo.LIKE; streetSearch.conjuctiveOperatorSpecified = true; streetSearch.conjuctiveOperator = vo.AND; } if (txt_SNumber.Text.Length > 0 && txt_SNumber.Text != "0") { //sql = sql + " prophouse LIKE('" + txt_SNumber.Text + "') AND"; civicNo.tableName = "Property"; civicNo.fieldName = "propHouse"; civicNo.conjuctiveOperatorSpecified = true; civicNo.operatorSpecified = true; civicNo.@operator = vo.LIKE; civicNo.value = new string[] { txt_SNumber.Text.Trim() }; civicNo.conjuctiveOperator = vo.AND; } try { //(new System.Xml.Serialization.XmlSerializer(query.GetType())).Serialize(new System.IO.StreamWriter(@"c:\temp\text.xml"), query); cnt = ac.searchFolderCount(query); pendingCnt = ac.searchFolderCount(pendingQuery); if (cnt > 200) { if (err.Text != "") { err.Text += " "; } err.Text = err.Text + "More than " + cnt + " issued records" + "<br>"; return; } if (cnt > 0) { var folders = ac.searchFolder(query, 0, cnt, new string[] { "folder.folderRSN DESC", "folder.expiryDate DESC" }); foreach (var f in folders) { try { var p = ac.getProperty(Convert.ToInt32(f.propertyRSN)); var bizname = ac.getFolderInfoByInfoCode(Convert.ToInt32(f.folderRSN), new int[] { 40020, 40049 }); if (bizname != null) { if (!String.IsNullOrEmpty(bizname[0].infoValue)) { businessname = bizname[0].infoValue; } if (!String.IsNullOrEmpty(bizname[1].infoValue)) { applicant = bizname[1].infoValue; } } var fInfo = ac.getFolderFreeFormByCode(Convert.ToInt32(f.folderRSN), new int[] { 100 }); if (fInfo == null) { licType = " "; //TODO: custom query } else { licType = fInfo[0].c01; } ShowSearchResult.Text = ShowSearchResult.Text + box + inBox; ShowSearchResult.Text = ShowSearchResult.Text + TitleAdd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>PropID : </b>" + f.propertyRSN + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Civic Number : </b>" + p.propHouse + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Street Name : </b>" + p.propStreet + " " + p.propStreetType + liEnd; //ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Unit Number : </b>" + p.propUnit + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Postal Code : </b>" + p.propPostal + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + TitleLic; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>FolderID : </b>" + f.folderRSN + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Type : </b>" + licType + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Business Name : </b>" + businessname + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Applicant: </b> " + applicant + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>License Status : </b>" + f.statusDesc + liEnd; if (!Convert.IsDBNull(f.indate)) { ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Application Date : " + "</b>" + String.Format("{0:MMM d, yyyy}", f.indate) + liEnd; } if (!Convert.IsDBNull(f.issueDate)) { ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Issue Date : " + "</b>" + String.Format("{0:MMM d, yyyy}", f.issueDate) + liEnd; } if (!Convert.IsDBNull(f.expiryDate)) { ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Expiry Date : " + "</b>" + String.Format("{0:MMM d, yyyy}", f.expiryDate) + liEnd; } ShowSearchResult.Text = ShowSearchResult.Text + ulEnd + divEnd + divEnd; } catch { // skip record if bad data } } } if (pendingCnt < 1) { result += pendingPoint; //err.Text = err.Text + " No pending records." + "<br />"; } if (pendingCnt > 200) { if (err.Text != "") { err.Text += " <br />"; } err.Text = err.Text + "More than " + pendingCnt + " Pending records" + "<br />"; return; } if (pendingCnt > 0) { var pending = ac.searchFolder(pendingQuery, 0, pendingCnt, new string[] { "folder.folderRSN DESC", "folder.expiryDate DESC" }); foreach (var f in pending) { try { var p = ac.getProperty(Convert.ToInt32(f.propertyRSN)); var bizname = ac.getFolderInfoByInfoCode(Convert.ToInt32(f.folderRSN), new int[] { 40020, 40049 }); var fee = ac.getFolderFee(new int[] { Convert.ToInt32(f.folderRSN) }, true); var fInfo = ac.getFolderFreeFormByCode(Convert.ToInt32(f.folderRSN), new int[] { 100 }); if (bizname != null) { if (!String.IsNullOrEmpty(bizname[0].infoValue)) { businessname = bizname[0].infoValue; } if (!String.IsNullOrEmpty(bizname[1].infoValue)) { applicant = bizname[1].infoValue; } } double outFee = 0; if (fee != null) { outFee = fee.totalOutstanding; } if (fInfo == null) { licType = " "; //TODO: custom query } else { licType = fInfo[0].c01; } result = result + box + inBox; result += pendingPoint; result = result + pendingTitleAdd; result = result + item + "<b>Civic Number : </b>" + p.propHouse + liEnd; result = result + item + "<b>Street Name : </b>" + p.propStreet + " " + p.propStreetType + liEnd; //result = result + item + "<b>Unit Number : </b>" + p.propUnit + liEnd; result = result + item + "<b>City : </b>" + p.propCity + liEnd; result = result + item + "<b>Postal Code : </b>" + p.propPostal + liEnd; result = result + pendingTitleLic; result = result + item + "<b>Type : </b>" + licType + liEnd; result = result + item + "<b>Business Name : </b>" + businessname + liEnd; //result = result + item + "<b>Applicant : </b>" + applicant + liEnd; result = result + item + "<b>Status : </b> Pending<br>"; result = result + item + "<b>Application Date : </b>" + String.Format("{0:MMM d, yyyy}", f.indate) + liEnd; result = result + item + "<b>Outstanding Fee : </b>$" + outFee + liEnd; result = result + item + "<b>Outstanding Comments : </b>" + f.folderCondition + liEnd; result = result + ulEnd + divEnd + divEnd; } catch { // skip if bad data } } } } catch (Exception exp) { err.Visible = true; err.Text = err.Text + "<br>"; err.Text = err.Text + "Error : " + exp.Message + "<br>"; err.Text = err.Text + "Error Detail : " + exp.StackTrace + "<br>"; } #endregion }//if(!IsNumeric(txt_SNumber.Text)) txtSName.Text = txtSName.Text.Replace("''", "'"); txt_SNumber.Text = txt_SNumber.Text.Replace("''", "'"); if (cnt < 1 && numeric) { err.Text = err.Text + "No records for <b>location info " + txt_SNumber.Text + " " + txtSName.Text + "</b> in Issued records." + "<br/>"; } else if (numeric) { if (cnt > 1) { lbresult.Text = lbresult.Text + "<span class='badge'>" + cnt + "</span><span class='label label-primary'> Issued records</span>"; } else { lbresult.Text = lbresult.Text + "<span class='badge'>" + cnt + "</span><span class='label label-primary'> Issued record</span>"; } } if (pendingCnt > 1) { lbresult.Text = lbresult.Text + "<br /><span class='badge'>" + pendingCnt + "</span><a href='#pending'><span class='label label-danger'>Pending records</span></a>"; } else if (pendingCnt == 1) { lbresult.Text = lbresult.Text + "<br /><span class='badge'>" + pendingCnt + "</span><a href='#pending'><span class='label label-danger'>Pending record</span></a>"; } else { err.Text = err.Text + " No pending records." + "<br />"; } if (IsNumeric(txt_SNumber.Text)) { ShowSearchResult.Text = ShowSearchResult.Text + result; //+ GetPendingLicenses(txt_SNumber.Text, txtSName.Text, txtUnit.Text, txtBName.Text); } txtBName.Text = ""; txt_SNumber.Text = tempSNUMBER; } } // Location search #region Business Name Search else if (((txt_SNumber.Text.Length < 1) && (txtSName.Text.Length < 1)) && (txtBName.Text.Length > 0)) { err.Text = ""; ShowSearchResult.Text = ""; ShowSearchResult.Text = resultcont + row; bizSearch.value = new string[] { txtBName.Text.TrimEnd() }; //(new System.Xml.Serialization.XmlSerializer(query.GetType())).Serialize(new System.IO.StreamWriter(@"c:\temp\text.xml"), query); try { cnt = ac.searchFolderCount(bizQuery); pendingCnt = ac.searchFolderCount(pendingBiz); if (cnt == 0) { err.Text = err.Text + "No records for <b>Business Name including " + txtBName.Text + "</b> in Issued records." + "<br />"; } //else if (cnt == 0 && pendingCnt > 0) //{ // err.Text = err.Text + "No records for <b>Business Name including " + txtBName.Text + "</b> in Issued records." + "<br />"; //} //else //{ var folders = ac.searchFolder(bizQuery, 0, cnt, new string[] { "folder.folderRSN DESC", "folder.expiryDate DESC" }); if (cnt > 200) { if (err.Text != "") { err.Text += " "; } err.Text = err.Text + "More than " + cnt + " records" + "<br />"; return; } if (cnt > 0) { foreach (var fold in folders) { try { var f = ac.getFolder(Convert.ToInt32(fold.folderRSN)); var p = ac.getProperty(Convert.ToInt32(f.propertyRSN)); var bizname = ac.getFolderInfoByInfoCode(Convert.ToInt32(f.folderRSN), new int[] { 40020, 40049 }); var fInfo = ac.getFolderFreeFormByCode(Convert.ToInt32(f.folderRSN), new int[] { 100 }); if (bizname != null) { if (!String.IsNullOrEmpty(bizname[0].infoValue)) { businessname = bizname[0].infoValue; } if (!String.IsNullOrEmpty(bizname[1].infoValue)) { applicant = bizname[1].infoValue; } } if (fInfo == null) { licType = " "; //TODO: custom query } else { licType = fInfo[0].c01; } ShowSearchResult.Text = ShowSearchResult.Text + box + inBox; ShowSearchResult.Text = ShowSearchResult.Text + TitleAdd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>PropID : </b>" + f.propertyRSN + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Civic Number : </b>" + p.propHouse + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Street Name : </b>" + p.propStreet + " " + p.propStreetType + liEnd; //ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Unit Number : </b>" + p.propUnit + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Postal Code : </b>" + p.propPostal + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + TitleLic; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>FolderID : </b>" + f.folderRSN + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Type : </b>" + licType + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Business Name : </b>" + businessname + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Applicant: </b> " + applicant + liEnd; ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>License Status : </b>" + f.statusDesc + liEnd; if (!Convert.IsDBNull(f.indate)) { ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Application Date : " + "</b>" + String.Format("{0:MMM d, yyyy}", f.indate) + liEnd; } if (!Convert.IsDBNull(f.issueDate)) { ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Issue Date : " + "</b>" + String.Format("{0:MMM d, yyyy}", f.issueDate) + liEnd; } if (!Convert.IsDBNull(f.expiryDate)) { ShowSearchResult.Text = ShowSearchResult.Text + item + "<b>Expiry Date : " + "</b>" + String.Format("{0:MMM d, yyyy}", f.expiryDate) + liEnd; } ShowSearchResult.Text = ShowSearchResult.Text + ulEnd + divEnd + divEnd; } catch { // skip if bad data } } } #region Pending Search if (pendingCnt > 200) { if (err.Text != "") { err.Text += " <br />"; } err.Text = err.Text + "More than " + pendingCnt + " Pending records" + "<br />"; return; } if (pendingCnt < 1) { result += pendingPoint; err.Text = err.Text + " No pending records." + "<br />"; } if (pendingCnt > 0 && pendingCnt < 200) { var pending = ac.searchFolder(pendingBiz, 0, pendingCnt, new string[] { "folder.folderRSN DESC", "folder.expiryDate DESC" }); foreach (var f in pending) { try { var p = ac.getProperty(Convert.ToInt32(f.propertyRSN)); var bizname = ac.getFolderInfoByInfoCode(Convert.ToInt32(f.folderRSN), new int[] { 40020, 40049 }); var fee = ac.getFolderFee(new int[] { Convert.ToInt32(f.folderRSN) }, true); var fInfo = ac.getFolderFreeFormByCode(Convert.ToInt32(f.folderRSN), new int[] { 100 }); if (bizname != null) { if (!String.IsNullOrEmpty(bizname[0].infoValue)) { businessname = bizname[0].infoValue; } if (!String.IsNullOrEmpty(bizname[1].infoValue)) { applicant = bizname[1].infoValue; } } if (fInfo == null) { licType = " "; //TODO: custom query } else { licType = fInfo[0].c01; } double outFee = 0; if (fee != null) { outFee = fee.totalOutstanding; } result = result + box + inBox; result += pendingPoint; result = result + pendingTitleAdd; result = result + item + "<b>Civic Number : </b>" + p.propHouse + liEnd; result = result + item + "<b>Street Name : </b>" + p.propStreet + " " + p.propStreetType + liEnd; //result = result + item + "<b>Unit Number : </b>" + p.propUnit + liEnd; result = result + item + "<b>City : </b>" + p.propCity + liEnd; result = result + item + "<b>Postal Code : </b>" + p.propPostal + liEnd; result = result + pendingTitleLic; result = result + item + "<b>Type : </b>" + licType + liEnd; result = result + item + "<b>Business Name : </b>" + businessname + liEnd; //result = result + item + "<b>Applicant : </b>" + applicant + liEnd; result = result + item + "<b>Status : </b> Pending<br>"; result = result + item + "<b>Application Date : </b>" + String.Format("{0:MMM d, yyyy}", f.indate) + liEnd; result = result + item + "<b>Outstanding Fee : </b>$" + outFee + liEnd; result = result + item + "<b>Outstanding Comments : </b>" + f.folderCondition + liEnd; result = result + ulEnd + divEnd + divEnd; } catch { // skip if bad data } } } #endregion if (cnt == 1) { lbresult.Text = lbresult.Text + "<span class='badge'>" + cnt + "</span><span class='label label-primary'> Issued record</span>"; } else if (cnt > 1) { lbresult.Text = lbresult.Text + "<span class='badge'>" + cnt + "</span><span class='label label-primary'> Issued records</span>"; } if (pendingCnt > 1) { lbresult.Text = lbresult.Text + "<br /><span class='badge'>" + pendingCnt + "</span><a href='#pending'><span class='label label-danger'>Pending records</span></a>"; } else if (pendingCnt == 1) { lbresult.Text = lbresult.Text + "<br /><span class='badge'>" + pendingCnt + "</span><a href='#pending'><span class='label label-danger'>Pending record</span></a>"; } //} // else } catch (Exception ex) { err.Visible = true; err.Text = err.Text + "<br>"; err.Text = err.Text + "Error : " + ex.Message + "<br>"; err.Text = err.Text + "Error Detail : " + ex.StackTrace + "<br>"; } #endregion ShowSearchResult.Text = ShowSearchResult.Text + result; }//Business name search ShowSearchResult.Text = ShowSearchResult.Text + divEnd; err.ForeColor = Color.Red; } } // using
// primary function when the Search button is clicked on the Finder (query) page public void ExecuteQuery() { displayInfoList = new List <DisplayInfomation>(); string licNoQuery = " "; string licYrQuery = " "; // creates a SOAP client to perform the Web service methods AClient ac = new AClient("WSAmandaServiceHttpSoap11Endpoint"); using (new OperationContextScope(ac.InnerChannel)) { HttpRequestMessageProperty requestProperty = new HttpRequestMessageProperty(); requestProperty.Headers["lid"] = Models.AmandaWS.Lid; OperationContext.Current.OutgoingMessageProperties[HttpRequestMessageProperty.Name] = requestProperty; #region SearchCriteria Amnd.WSValidOperator vo = ac.getValidOperators(); ASearch fTypes = new ASearch { tableName = "Folder", fieldName = "folderType", operatorSpecified = true, @operator = vo.IN, value = new string[] { "GM", "CTR", "NEWS", "RVE" }, conjuctiveOperatorSpecified = true, conjuctiveOperator = vo.NONE }; ASearch firstName = new ASearch { tableName = "People", fieldName = "nameFirst", value = null, operatorSpecified = true, @operator = vo.LIKE, conjuctiveOperator = vo.AND, conjuctiveOperatorSpecified = true }; ASearch lastName = new ASearch { tableName = "People", fieldName = "nameLast", value = null, operatorSpecified = true, @operator = vo.LIKE, conjuctiveOperator = vo.AND, conjuctiveOperatorSpecified = true }; ASearch orgName = new ASearch { tableName = "People", fieldName = "organizationName", value = null, operatorSpecified = true, @operator = vo.LIKE, conjuctiveOperator = vo.AND, conjuctiveOperatorSpecified = true }; ASearch licenceType = new ASearch { tableName = "folder", fieldName = "subCode", value = null, @operator = vo.EQUAL, operatorSpecified = true, conjuctiveOperator = vo.AND, conjuctiveOperatorSpecified = true, }; ASearch licYear = new ASearch { tableName = "Folder", fieldName = "folderYear", @operator = vo.EQUAL, operatorSpecified = true, conjuctiveOperator = vo.AND, conjuctiveOperatorSpecified = true }; ASearch licenceNo = new ASearch { tableName = "Folder", fieldName = "foldersequence", @operator = vo.EQUAL, operatorSpecified = true, conjuctiveOperator = vo.NONE, conjuctiveOperatorSpecified = true }; ASearch opNameSearch = new ASearch { tableName = "FolderInfo", fieldName = "infoValue", infoCode = 40020, infoCodeSpecified = true, value = new string[] { searchData.opName }, conjuctiveOperator = vo.NONE, conjuctiveOperatorSpecified = true, @operator = vo.LIKE, operatorSpecified = true }; ASearch VinSearch = new ASearch { tableName = "FolderInfo", fieldName = "infoValue", infoCode = 40102, infoCodeSpecified = true, value = new string[] { searchData.vin }, conjuctiveOperator = vo.NONE, conjuctiveOperatorSpecified = true, @operator = vo.LIKE, operatorSpecified = true }; ASearch ONPlate = new ASearch { tableName = "FolderInfo", fieldName = "infoValue", infoCode = 40103, infoCodeSpecified = true, value = new string[] { searchData.plateNumber }, conjuctiveOperator = vo.NONE, conjuctiveOperatorSpecified = true, @operator = vo.LIKE, operatorSpecified = true }; ASearch CityPlate = new ASearch { tableName = "FolderInfo", fieldName = "infoValue", infoCode = 40104, infoCodeSpecified = true, value = new string[] { searchData.cityPlateNumber }, conjuctiveOperator = vo.NONE, conjuctiveOperatorSpecified = true, @operator = vo.LIKE, operatorSpecified = true }; ASearch[] search = new ASearch[] { firstName, lastName, licenceType, orgName, fTypes }; if (!String.IsNullOrEmpty(searchData.firstName)) { firstName.value = new string[] { searchData.firstName }; } if (!String.IsNullOrEmpty(searchData.lastName)) { lastName.value = new string[] { searchData.lastName }; } if (!String.IsNullOrEmpty(searchData.orgName)) { orgName.value = new string[] { searchData.orgName }; } if (!String.IsNullOrEmpty(searchData.licenseType)) { //licenceType.value = new string[] { searchData.licenseType }; licenceType.value = new string[] { searchData.SubCode[Array.IndexOf(searchData.LicTypes, searchData.licenseType)] }; } search = search.Where(c => c.value != null).ToArray(); //removes empty search criteria fields if (!String.IsNullOrEmpty(searchData.cityPlateNumber)) { search = null; search = new ASearch[] { CityPlate }; } if (!String.IsNullOrEmpty(searchData.plateNumber)) { search = null; search = new ASearch[] { ONPlate }; } if (!String.IsNullOrEmpty(searchData.vin)) { search = null; search = new ASearch[] { VinSearch }; } if (!String.IsNullOrEmpty(searchData.opName)) { search = null; search = new ASearch[] { opNameSearch }; } if (!String.IsNullOrEmpty(searchData.licenseNumber)) { if (searchData.licenseNumber.Length > 2) // exact search { // separates the search data for the folder year and folder sequence searches licNoQuery = Char.IsNumber(searchData.licenseNumber, 2) ? searchData.licenseNumber.Substring(2) : searchData.licenseNumber.Substring(3); licYrQuery = searchData.licenseNumber.Substring(0, 2); // searches folderYear column search = null; licenceNo.value = new string[] { licNoQuery }; licYear.value = new string[] { licYrQuery }; search = new ASearch[] { licYear, licenceNo }; } else // possibility to search license year with other criteria, if only to avoid app crashes when 2 chars are entered { search = null; licYear.value = new string[] { searchData.licenseNumber }; search = new ASearch[] { licYear, firstName, lastName, orgName, licenceType, fTypes }; search = search.Where(c => c.value != null).ToArray(); } } #endregion //(new System.Xml.Serialization.XmlSerializer(search.GetType())).Serialize(new System.IO.StreamWriter(@"c:\temp\text.xml"), search); int cnt = ac.searchFolderCount(search); Amnd.WSFolder[] result; if (cnt > 10) { result = ac.searchFolder(search, 0, 10, new string[] { "folder.folderRSN DESC", "folder.expiryDate DESC" }); OverTen = true; } else { result = ac.searchFolder(search, 0, cnt, new string[] { "folder.folderRSN DESC", "folder.expiryDate DESC" }); OverTen = false; } if (cnt > 0) { foreach (var r in result) { string vin = " "; string plate = " "; string modelyear = " "; string make = " "; string cityLic = " "; string alias = " "; var p = ac.getFolderPeople(Convert.ToInt32(r.folderRSN)); if (p != null) { // DOB var pInfo = ac.getPeopleInfo(Convert.ToInt32(p[0].peopleRSN)); string dob = " "; DateTime dobDb = DateTime.Today; Amnd.WSPeopleInfo dobRow = null; if (pInfo[0] != null && pInfo != null) { dobRow = Array.Find(pInfo, col => col.infoCode.Equals(40117)); if (!String.IsNullOrEmpty(dobRow.infoValue)) { if (DateTime.Parse(dobRow.infoValue) < DateTime.Today) { dobDb = DateTime.Parse(dobRow.infoValue).Date; dob = String.Format("{0:MMM d, yyyy}", dobDb); } } } // license type var fFree = ac.getFolderFreeFormByCode(Convert.ToInt32(r.folderRSN), new int[] { 100 }); string licType = (fFree == null && String.IsNullOrWhiteSpace(fFree[0].c01)) ? " " : fFree[0].c01; // vehicle details/InfoCode var fInfo = ac.getFolderInfoByInfoCode(Convert.ToInt32(r.folderRSN), new int[] { 40020, 40101, 40100, 40102, 40103, 40104 }); Amnd.WSFolderInfo aliasRow, modYrRow, mkRow, vinRow, ontRow, ctyRow; if (fInfo != null) //&& (!String.IsNullOrWhiteSpace(fInfo[0].infoValue) || (!String.IsNullOrEmpty(fInfo[0].infoValue))) { aliasRow = fInfo.FirstOrDefault(col => col.infoCode == 40020); alias = String.IsNullOrWhiteSpace(aliasRow.infoValue) ? " " : aliasRow.infoValue; if (fInfo.Length > 2) { mkRow = fInfo.FirstOrDefault(col => col.infoCode == 40101); make = String.IsNullOrWhiteSpace(mkRow.infoValue) ? " " : mkRow.infoValue; modYrRow = fInfo.FirstOrDefault(col => col.infoCode == 40100); modelyear = String.IsNullOrWhiteSpace(modYrRow.infoValue) ? " " : modYrRow.infoValue; vinRow = fInfo.FirstOrDefault(col => col.infoCode == 40102); vin = String.IsNullOrWhiteSpace(vinRow.infoValue) ? " " : vinRow.infoValue; ontRow = fInfo.FirstOrDefault(col => col.infoCode == 40103); plate = String.IsNullOrWhiteSpace(ontRow.infoValue) ? " " : ontRow.infoValue; ctyRow = fInfo.FirstOrDefault(col => col.infoCode == 40104); cityLic = String.IsNullOrWhiteSpace(ctyRow.infoValue) ? " " : ctyRow.infoValue; } } // license number string licNo = (String.IsNullOrWhiteSpace(r.folderYear) || String.IsNullOrWhiteSpace(r.folderSequence)) ? " " : (r.folderYear + " " + r.folderSequence); // first & last & org names string firstNm = String.IsNullOrWhiteSpace(p[0].nameFirst) ? (String.IsNullOrWhiteSpace(p[1].nameFirst) ? " " : p[1].nameFirst) : p[0].nameFirst; string lastNm = String.IsNullOrWhiteSpace(p[0].nameLast) ? (String.IsNullOrWhiteSpace(p[1].nameLast) ? " " : p[1].nameLast) : p[0].nameLast; string orgNm = String.IsNullOrWhiteSpace(p[0].organizationName) ? (String.IsNullOrWhiteSpace(p[1].organizationName) ? " " : p[1].organizationName) : p[0].organizationName; // address string addLine1 = String.IsNullOrWhiteSpace(p[0].addressLine1) ? " " : p[0].addressLine1; string cityStr = String.IsNullOrWhiteSpace(p[0].addrCity) ? (String.IsNullOrWhiteSpace(p[0].addressLine2) ? " " : p[0].addressLine2.Substring(0, p[0].addressLine2.Length - 7)) : p[0].addrCity; string postStr = String.IsNullOrWhiteSpace(p[0].addrPostal) ? (String.IsNullOrWhiteSpace(p[0].addressLine2) ? " " : p[0].addressLine2.Substring(p[0].addressLine2.Length - 7)) : p[0].addrPostal; DisplayInfomation displayInfo = new DisplayInfomation() { person = new Person(), card = new Card() }; displayInfo.person.personId = Convert.ToString(p[0].peopleRSN); //+ Convert.ToString(r.folderRSN); this actually doesn't matter displayInfo.person.firstName = firstNm; displayInfo.person.lastName = lastNm; displayInfo.person.organizationName = orgNm; displayInfo.person.dateOfBirth = String.Format("{0:MMM d, yyyy}", dob); displayInfo.person.address = addLine1; displayInfo.person.city = cityStr; displayInfo.person.postalCode = postStr; displayInfo.person.operatingName = alias; displayInfo.card.CardId = Convert.ToString(r.folderRSN); displayInfo.card.licenseNumber = licNo; displayInfo.card.vehicleMaker = make; displayInfo.card.vehicleModelYear = modelyear; displayInfo.card.issueDate = String.Format("{0:MMM d, yyyy}", r.indate); displayInfo.card.expiryDate = String.Format("{0:MMM d, yyyy}", r.expiryDate); displayInfo.card.licenseType = licType; displayInfo.card.vehiclePlateNumber = plate; displayInfo.card.cityLicensePlate = cityLic; displayInfo.card.vin = vin; displayInfo.card.personId = Convert.ToString(p[0].peopleRSN); //get photo try { var fa = ac.getFolderAttachment(Convert.ToInt32(r.folderRSN)); if (fa[0] != null) { var attach = Array.Find(fa, col => col.attachmentCode.Equals(40005)); //displayInfo.person.personId = Convert.ToString(Convert.ToInt32(attach.attachmentRSN)); var pic = ac.getAttachmentContent(Convert.ToInt32(attach.attachmentRSN)); displayInfo.card.imageData = pic.content; } } catch //(FaultException) { // abort photo check if no image exists or the file server cannot be accessed displayInfo.card.imageData = null; } displayInfoList.Add(displayInfo); } } } } // using }