コード例 #1
0
    public static String[] GetRoutes(String Sorting, String Filter)
    {
        String[] returnval = null;
        try
        {
            BaseClass baseCls = new BaseClass();
            baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

            if (Filter.ToLower() == "reset" && Sorting.ToLower() == "reset")
            {
                HttpContext.Current.Session["travelOperatorSelected"] = null;
                DataTable dt = (DataTable)HttpContext.Current.Session["dtRoutes"];
                returnval = GetDataset(dt);
            }

            else if (Sorting.ToLower() == "modify")
            {

                HttpContext.Current.Session["travelOperatorSelected"] = null;
                String[] filterparams = Filter.Split('*');

                baseCls.preLoadParams[0] = filterparams[0].ToString();
                baseCls.preLoadParams[1] = filterparams[1].ToString();
                baseCls.preLoadParams[2] = filterparams[2].ToString();
                baseCls.preLoadParams[3] = baseCls.preLoadParams[3].ToString();
                baseCls.preLoadParams[4] = filterparams[3].ToString();
                baseCls.preLoadParams[5] = filterparams[4].ToString();
                baseCls.preLoadParams[6] = baseCls.preLoadParams[6].ToString();

                HttpContext.Current.Session["Parameters"] = baseCls;

                KesineniDetails kesineniDetails = new KesineniDetails(KesineniConstants.LoginId, KesineniConstants.Password);
                BitlaDetails bitlaDetails = new BitlaDetails(BitlaConstants.URL, BitlaConstants.API_KEY);
                AbhiBusDetails abhiBusDetails = new AbhiBusDetails();
                KABCommon objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

                DataTable dtroutes = null;

                dtroutes = objCommon.GetRoutes(
                           baseCls.preLoadParams[0].ToString()
                           , baseCls.preLoadParams[1].ToString()
                           , baseCls.preLoadParams[2].ToString());

                HttpContext.Current.Session["dtRoutes"] = dtroutes;
                returnval = GetDataset(dtroutes);
            }

            else if (Filter.ToUpper() != "NONE")
            {
                String[] filterparams = Filter.Split(',');

                string minPrice = filterparams[5].ToString();
                string maxPrice = filterparams[6].ToString();
                string minDepTime = filterparams[7].ToString();
                string maxDepTime = filterparams[8].ToString();

                FilterBusesWithSliders(minPrice, maxPrice, minDepTime, maxDepTime);

                returnval = FilterBuses(
                    Boolean.Parse(filterparams[0])
                    , Boolean.Parse(filterparams[1])
                    , Boolean.Parse(filterparams[2])
                    , Boolean.Parse(filterparams[3])
                    , filterparams[4].ToString(), Sorting);
            }

            else
            {
                HttpContext.Current.Session["travelOperatorSelected"] = null;
                KesineniDetails kesineniDetails = new KesineniDetails(KesineniConstants.LoginId, KesineniConstants.Password);
                BitlaDetails bitlaDetails = new BitlaDetails(BitlaConstants.URL, BitlaConstants.API_KEY);
                AbhiBusDetails abhiBusDetails = new AbhiBusDetails();
                KABCommon objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

                DataTable dtroutes = null;
                baseCls = new BaseClass();
                baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

                dtroutes = objCommon.GetRoutes(
                           baseCls.preLoadParams[0].ToString()
                           , baseCls.preLoadParams[1].ToString()
                           , baseCls.preLoadParams[2].ToString());

                HttpContext.Current.Session["dtRoutes"] = dtroutes;
                returnval = GetDataset(dtroutes);
            }
        }
        catch (Exception ex)
        {

        }
        return returnval;
    }
コード例 #2
0
    public static String[] GetRoutes(String Sorting, String Filter)
    {
        String[] returnval = null;
        try
        {
            BaseClass baseCls = new BaseClass();
            baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

            if (Filter.ToLower() == "reset" && Sorting.ToLower() == "reset")
            {
                travelOperatorSelected = "";
                DataTable dt = (DataTable)HttpContext.Current.Session["dtRoutes"];
                returnval = GetDataset(dt);
            }

            else if (Sorting.ToLower() == "modify")
            {

                travelOperatorSelected = "";
                String[] filterparams = Filter.Split('*');

                //if (Convert.ToDateTime(filterparams[2].ToString()) < Convert.ToDateTime(System.DateTime.Now.Date.ToShortDateString()))
                //{
                //    ScriptManager.RegisterStartupScript(this, typeof(Page), "Alert", "<script>alert('" + "Travel Date should not be less than Current Date." + "');</script>", false);
                //}

                //baseCls.preLoadParams[0] = filterparams[0].ToString();
                //baseCls.preLoadParams[1] = filterparams[1].ToString();
                baseCls.preLoadParams[3] = filterparams[2].ToString();

                //baseCls.preLoadParams[4] = filterparams[3].ToString();
                //baseCls.preLoadParams[5] = filterparams[4].ToString();

                KesineniDetails kesineniDetails = new KesineniDetails(KesineniConstants.LoginId, KesineniConstants.Password);
                BitlaDetails bitlaDetails = new BitlaDetails(BitlaConstants.URL, BitlaConstants.API_KEY);
                AbhiBusDetails abhiBusDetails = new AbhiBusDetails();
                KABCommon objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

                DataTable dtroutes = null;

                dtroutes = objCommon.GetRoutes(
                           baseCls.preLoadParams[1].ToString()
                           , baseCls.preLoadParams[0].ToString()
                           , baseCls.preLoadParams[3].ToString());

                HttpContext.Current.Session["dtRoutes"] = dtroutes;
                returnval = GetDataset(dtroutes);
            }

            else if (Filter.ToUpper() != "NONE")
            {
                String[] filterparams = Filter.Split(',');

                string minPrice = filterparams[5].ToString();
                string maxPrice = filterparams[6].ToString();
                string minDepTime = filterparams[7].ToString();
                string maxDepTime = filterparams[8].ToString();

                FilterBusesWithSliders(minPrice, maxPrice, minDepTime, maxDepTime);

                returnval = FilterBuses(
                    Boolean.Parse(filterparams[0])
                    , Boolean.Parse(filterparams[1])
                    , Boolean.Parse(filterparams[2])
                    , Boolean.Parse(filterparams[3])
                    , filterparams[4].ToString(), Sorting);
            }

            else
            {
                KesineniDetails kesineniDetails = new KesineniDetails(KesineniConstants.LoginId, KesineniConstants.Password);
                BitlaDetails bitlaDetails = new BitlaDetails(BitlaConstants.URL, BitlaConstants.API_KEY);
                AbhiBusDetails abhiBusDetails = new AbhiBusDetails();
                KABCommon objCommon = new KABCommon(kesineniDetails, abhiBusDetails, bitlaDetails);

                DataTable dtroutes = null;
                travelOperatorSelected = "";
                baseCls = new BaseClass();
                baseCls = (BaseClass)(HttpContext.Current.Session["Parameters"]);

                dtroutes = objCommon.GetRoutes(
                           baseCls.preLoadParams[1].ToString()
                           , baseCls.preLoadParams[0].ToString()
                           , baseCls.preLoadParams[3].ToString());

                HttpContext.Current.Session["dtRoutes"] = dtroutes;
                returnval = GetDataset(dtroutes);
            }
        }
        catch (Exception ex)
        {

        }
        return returnval;
    }