本文整理汇总了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;
}
示例2: BindGrid
void BindGrid()
{
objBAL = new ClsBAL();
DataSet ds = objBAL.GetRatings();
gvRating.DataSource = ds;
ViewState["Rating"] = ds.Tables[0];
gvRating.DataBind();
}