public string GetTotalSearchFormat(_prop_SearchInput input)
        {
            string message = "";


            message += "7;";//type
            message += input.keyword.Trim() + ";";
            message += input.syno.Trim() + ";";
            message += input.syno_wb.Trim() + ";";
            message += ";";                     //th
            message += ";";                     //other
            message += ";";                     //nostraid
            message += input.AdminLevel4 + ";"; //adminlv4
            message += input.AdminLevel3 + ";"; //adminlv3
            message += input.AdminLevel2 + ";"; //adminlv2
            message += input.AdminLevel1 + ";"; //adminlv1

            message += input.houseNumber + ";";
            message += input.telephone + ";";

            message += input.category + ";";     //cat
            message += input.LocalCatCode + ";"; //subcode,localCatCode
            message += input.tag + ";";          //tag
            message += input.PostCode + ";";     //PostCode

            message += input.lat + ";";          //lat
            message += input.lon + ";";          //lon
            message += input.radius + ";";       //r
            message += input.maxReturn;          //return

            return(message);
        }
Exemple #2
0
        public _prop_SearchInput Check(string keyword, string AdminLevel3, string AdminLevel2, string AdminLevel1, string PostCode, string AdminLevel4, string houseNumber, string telephone, string category, string LocalCatCode, string tag, string lat, string lon, string radius, string RowsPerPage, string PageNumber, string token)
        {
            _prop_SearchInput input = new _prop_SearchInput();

            if (string.IsNullOrEmpty(RowsPerPage))
            {
                RowsPerPage = "20";
            }

            if (string.IsNullOrEmpty(PageNumber))
            {
                PageNumber = "1";
            }

            //(input > 0) ? "positive" : "negative";
            input.keyword = (string.IsNullOrEmpty(keyword)) ? "" : keyword;

            input.AdminLevel1 = (string.IsNullOrEmpty(AdminLevel1)) ? "" : AdminLevel1;
            input.AdminLevel2 = (string.IsNullOrEmpty(AdminLevel2)) ? "" : AdminLevel2;
            input.AdminLevel3 = (string.IsNullOrEmpty(AdminLevel3)) ? "" : AdminLevel3;
            input.AdminLevel4 = (string.IsNullOrEmpty(AdminLevel4)) ? "" : AdminLevel4;
            input.PostCode    = (string.IsNullOrEmpty(PostCode)) ? "" : PostCode;

            input.houseNumber = (string.IsNullOrEmpty(houseNumber)) ? "" : houseNumber;
            input.telephone   = (string.IsNullOrEmpty(telephone)) ? "" : telephone;

            input.category     = (string.IsNullOrEmpty(category)) ? "" : category;
            input.LocalCatCode = (string.IsNullOrEmpty(LocalCatCode)) ? "" : LocalCatCode;
            input.tag          = "";

            try
            {
                double tmp = 0;
                if (double.TryParse(lat, out tmp))
                {
                    input.lat = lat;
                }
                else
                {
                    input.lat = "";
                }

                if (double.TryParse(lon, out tmp))
                {
                    input.lon = lon;
                }
                else
                {
                    input.lon = "";
                }

                if (double.TryParse(radius, out tmp))
                {
                    tmp          = tmp * 1000;
                    input.radius = tmp.ToString();
                }
                else
                {
                    input.radius = "";
                }

                if (string.IsNullOrEmpty(input.lat) || string.IsNullOrEmpty(input.lon))
                {
                    input.lat    = "";
                    input.lon    = "";
                    input.radius = "";
                }
                else if (!string.IsNullOrEmpty(input.lat) && !string.IsNullOrEmpty(input.lon) && string.IsNullOrEmpty(input.radius))
                {
                    input.radius = "1000000";
                }
            }
            catch
            {
                input.lat    = "";
                input.lon    = "";
                input.radius = "";
            }

            input.RowsPerPage = (string.IsNullOrEmpty(RowsPerPage)) ? "" : RowsPerPage;
            input.PageNumber  = (string.IsNullOrEmpty(PageNumber)) ? "" : PageNumber;
            input.maxReturn   = MAXRETURN.ToString();

            return(input);
        }