当前位置: 首页>>代码示例>>C#>>正文


C# ClsBAL.GetRatings方法代码示例

本文整理汇总了C#中BAL.ClsBAL.GetRatings方法的典型用法代码示例。如果您正苦于以下问题:C# ClsBAL.GetRatings方法的具体用法?C# ClsBAL.GetRatings怎么用?C# ClsBAL.GetRatings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BAL.ClsBAL的用法示例。


在下文中一共展示了ClsBAL.GetRatings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDataset

    private static String[] GetDataset(DataTable dtroutes)
    {
        String[] returnval = new String[dtroutes.Rows.Count + 2];

        try
        {
            decimal max = 0; decimal min = 0; decimal dec = 0; decimal din = 0;

            #region Get bus rating

            ClsBAL objManabusBAL = new ClsBAL();
            DataTable dtRating = objManabusBAL.GetRatings().Tables[0];

            #endregion

            #region Get distinct travels

            DataTable dtTravels = ((DataTable)(HttpContext.Current.Session["dtRoutes"])).DefaultView.ToTable(true, "Travels");

            DataRow[] drTravels = dtTravels.Select("", "Travels ASC");

            StringBuilder sbTravels = new StringBuilder();

            if (drTravels.Length > 0)
            {
                sbTravels.Append("<select id=\"ddlOperator\" name=\"ddlOperator\"  multiple=\"multiple\"  class=\"Dropdownlist\" onchange=\"LoadFilteredRoutes(event,''); return false;\" >");//multiple=\"multiple\"

                //sbTravels.Append("<option value=''>All Operators</option>");

                string strOperator = "";
                if (HttpContext.Current.Session["travelOperatorSelected"] != null)
                {
                    strOperator = HttpContext.Current.Session["travelOperatorSelected"].ToString();
                }
                foreach (DataRow item in drTravels)
                {
                    if (strOperator != item["Travels"].ToString())
                    {
                        sbTravels.Append("<option value=" + "\"" + item["Travels"].ToString() + "\"" + ">" + item["Travels"].ToString() + "</option>");
                    }
                    else
                    {
                        sbTravels.Append("<option selected='selected' value=" + "\"" + item["Travels"].ToString() + "\"" + ">" + item["Travels"].ToString() + "</option>");
                    }
                }
                sbTravels.Append("</select>");
            }

            returnval[dtroutes.Rows.Count] = sbTravels.ToString();

            #endregion

            for (int i = 0; i < dtroutes.Rows.Count; i++)
            {
                DataRow[] dr = null;
                if (dtroutes.Rows[i]["Travels"].ToString().Length >= 5)
                {
                    dr = dtRating.Select("BusOperatorName LIKE '" + dtroutes.Rows[i]["Travels"].ToString().Substring(0, 5) + "%'");
                }
                else { dr = dtRating.Select("BusOperatorName LIKE '" + dtroutes.Rows[i]["Travels"].ToString() + "%'"); }

                String sRating = dr.Length > 0 ? "Images/star" + dr[0]["Rating"].ToString() + ".png" : "Images/star3.png";
                //sRating = "";

                string sDuration = dtroutes.Rows[i]["Duration"].ToString();
                if (sDuration == "") { sDuration = " - "; }
                string sArrTime = dtroutes.Rows[i]["ArrTime"].ToString();
                if (sArrTime == "") { sArrTime = " - "; }
                string sBusType = dtroutes.Rows[i]["BusType"].ToString();
                if (sBusType.Length > 50) { sBusType = sBusType.Substring(0, 48); }

                returnval[i] = dtroutes.Rows[i]["API"].ToString() + "~" + dtroutes.Rows[i]["SNo"].ToString() + "~"
                                + dtroutes.Rows[i]["Travels"].ToString() + "~" + sBusType + "~"
                                + dtroutes.Rows[i]["DepTime"].ToString() + "~" + sArrTime + "~"
                                + sDuration + "~" + dtroutes.Rows[i]["Fare"].ToString() + "~"
                                + dtroutes.Rows[i]["ReservationId"].ToString() + "~"
                                + dtroutes.Rows[i]["ServiceId"].ToString() + "~" + dtroutes.Rows[i]["CoachTypeId"].ToString() + "~"
                                + dtroutes.Rows[i]["ServiceNumber"].ToString() + "~"
                                + dtroutes.Rows[i]["BoardingPointsWithIds"].ToString() + "~" + dtroutes.Rows[i]["DropingPointsWithIds"].ToString() + "~"
                                + dtroutes.Rows[i]["lblS"].ToString() + "~"
                                + dtroutes.Rows[i]["lblB"].ToString() + "~"
                                + sRating + "~" + dtroutes.Rows[i]["AvailableSeats"].ToString();

                if (i == 0) { max = min = Convert.ToDecimal(Convert.ToDecimal(dtroutes.Rows[i]["Fare"].ToString()).ToString("0", System.Globalization.CultureInfo.InvariantCulture)); }
                dec = din = Convert.ToDecimal(Convert.ToDecimal(dtroutes.Rows[i]["Fare"].ToString()).ToString("0", System.Globalization.CultureInfo.InvariantCulture));
                if (dec > max) { max = dec; }
                if (din < min) { min = din; }
            }
            if (dtroutes.Rows.Count != 0)
            {
                returnval[dtroutes.Rows.Count + 1] = min + "|" + max;
            }
            else { returnval[dtroutes.Rows.Count + 1] = "1" + "|" + "2500"; }
        }
        catch (Exception e)
        {
            //
        }
        return returnval;
    }
开发者ID:srisai339,项目名称:LoveJourney_Working,代码行数:100,代码来源:ShowTrips.aspx.cs

示例2: BindGrid

 void BindGrid()
 {
     objBAL = new ClsBAL();
     DataSet ds = objBAL.GetRatings();
     gvRating.DataSource = ds;
     ViewState["Rating"] = ds.Tables[0];
     gvRating.DataBind();
 }
开发者ID:srisai339,项目名称:LoveJourney_Working,代码行数:8,代码来源:Rating.aspx.cs


注:本文中的BAL.ClsBAL.GetRatings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。