コード例 #1
0
    public string getSrchResults(string zipOrCity, string distance, string bizDetails)
    {
        string ZipSqlStr = " ", returnHtmlTag = " ";

        if (string.IsNullOrEmpty(zipOrCity))
        {
            return("Error : Zip Code or City Cannot be empty");
        }

        if (string.IsNullOrEmpty(distance) | (!CommonFunctions.isNumeric(distance)))
        {
            return("Error : Invalid Value Entered for Distance");
        }


        zipCodeUtil zipper = new zipCodeUtil(zipOrCity, Convert.ToInt16(distance));



        if (zipper.RtnCode > 0)

        {
            return("Error : " + zipper.Rtnmessage);
        }

        int[] zipCodeList = zipper.getZipCodesInRange(Convert.ToInt16(distance));

        if (zipper.RtnCode > 0)
        {
            return("Error : " + zipper.Rtnmessage);
        }

        //ZipSqlStr = "'" + zipper.RadiusBoxZips[0].ToString() + "',";

        for (int i = 0; i < zipper.RadiusBoxZips.Count() - 1; i++)
        {
            ZipSqlStr += zipper.RadiusBoxZips[i].ToString() + ",";
        }

        ZipSqlStr += zipper.RadiusBoxZips[zipper.RadiusBoxZips.Count() - 1].ToString();

        //system.windows.forms.messagebox.Show(ZipSqlStr);
        /* Check if ZipCode range is available on the Cache */

        string    CacheName = "sqlDataset#" + zipper.ZipCode + "#" + zipper.Distance + "#" + bizDetails;
        DataTable listTable = CommonFunctions.generateCacheDataTab(CacheName, ZipSqlStr, zipper.ZipCode, bizDetails);

        //system.windows.forms.messagebox.Show("Count is " + listTable.DefaultView.Count);


        if (listTable.DefaultView.Count > 0)
        {
            returnHtmlTag  = generateListingPageHtml(listTable, 1);
            returnHtmlTag +=
                "<input type='hidden' id='bConDSTempName' value='" + CacheName + "' />";
        }
        else
        {
            returnHtmlTag = "No data found";
        }

        return(returnHtmlTag);
    }
コード例 #2
0
    public string getAdditionalPage(string tempTabs, string pageNum)
    {
        try
        {
            DataTable listTable = (DataTable)HttpRuntime.Cache.Get(tempTabs);

            if (listTable == null)
            {
                string[] zipdetails = tempTabs.Split('#');
                string   zCode      = zipdetails[1];
                string   zDistance  = zipdetails[2];
                string   zbizType   = zipdetails[3];

                if (string.IsNullOrEmpty(zCode))
                {
                    return("Error : Invalid Input data or unsafe data detected - EGAP19001");
                }

                if (string.IsNullOrEmpty(zDistance) | (!CommonFunctions.isNumeric(zDistance)))
                {
                    return("Error : Invalid Input data or unsafe data detected - EGAP19002");
                }


                zipCodeUtil zipper = new zipCodeUtil(zCode, Convert.ToInt16(zDistance));



                if (zipper.RtnCode > 0)
                {
                    return("Error : Invalid Input data or unsafe data detected - EGAP19003");
                }

                int[] zipCodeList = zipper.getZipCodesInRange(Convert.ToInt16(zDistance));

                if (zipper.RtnCode > 0)
                {
                    return("Error : Invalid Input data or unsafe data detected - EGAP19004");
                }

                //ZipSqlStr = "'" + zipper.RadiusBoxZips[0].ToString() + "',";
                string ZipSqlStr = " ";
                for (int i = 0; i < zipper.RadiusBoxZips.Count() - 1; i++)
                {
                    ZipSqlStr += zipper.RadiusBoxZips[i].ToString() + ",";
                }

                ZipSqlStr += zipper.RadiusBoxZips[zipper.RadiusBoxZips.Count() - 1].ToString();

                //system.windows.forms.messagebox.Show(ZipSqlStr);
                /* Check if ZipCode range is available on the Cache */

                string CacheName = "sqlDataset#" + zipper.ZipCode + "#" + zipper.Distance + "#" + zbizType;
                listTable = CommonFunctions.generateCacheDataTab(CacheName, ZipSqlStr, zipper.ZipCode, zbizType);
            }

            return(generateListingPageHtml(listTable, Convert.ToInt16(pageNum)));
        }
        catch (Exception err) {
            return(err.Message);
        }
    }