public void BindTrainType(JumboECMS.DBUtility.DbOperHandler _doh, System.Web.UI.WebControls.DropDownList ddlTrainType) { _doh.Reset(); _doh.SqlCmd = "Select TrainType From [T_TrainType] ORDER BY id asc"; DataTable dt = _doh.GetDataTable(); ddlTrainType.Items.Clear(); ddlTrainType.Items.Add(new ListItem("所有车次", "0")); for (int i = 0; i < dt.Rows.Count; i++) { ddlTrainType.Items.Add(new ListItem(dt.Rows[i]["TrainType"].ToString(), dt.Rows[i]["TrainType"].ToString())); } dt.Clear(); dt.Dispose(); }
/// <summary> /// 热门车次查询 /// </summary> /// <param name="_doh"></param> /// <returns></returns> public string Hot_CheCi(JumboECMS.DBUtility.DbOperHandler _doh) { string _Str = ""; _doh.Reset(); _doh.SqlCmd = "select top 30 lineID from [T_LineInfo] where [seqNumber]=1 ORDER BY SearchNum DESC,lineID asc"; DataTable dt = _doh.GetDataTable(); for (int i = 0; i < dt.Rows.Count; i++) { _Str += "<li><a href=\"javascript:void(0);\" onclick=\"ShowCheCi('" + dt.Rows[i]["lineID"].ToString().ToUpper() + "');return false;\">" + dt.Rows[i]["lineID"].ToString().ToUpper() + "</a></li>"; } dt.Clear(); dt.Dispose(); return(_Str); }
/// <summary> /// 热门路线查询 /// </summary> /// <param name="_doh"></param> /// <returns></returns> public string Hot_LuXian(JumboECMS.DBUtility.DbOperHandler _doh) { string _Str = ""; _doh.Reset(); _doh.SqlCmd = "select top 30 ShiFa,Zhongdian from [T_TrainInfo] ORDER BY SearchNum DESC,ShiFa asc,Zhongdian asc"; DataTable dt = _doh.GetDataTable(); for (int i = 0; i < dt.Rows.Count; i++) { _Str += "<li><a href=\"javascript:void(0);\" onclick=\"ShowStation2Station('" + dt.Rows[i]["ShiFa"].ToString().ToUpper() + "','" + dt.Rows[i]["Zhongdian"].ToString().ToUpper() + "');return false;\">" + dt.Rows[i]["ShiFa"].ToString() + " - " + dt.Rows[i]["ZhongDian"].ToString() + "</a></li>"; } dt.Clear(); dt.Dispose(); return(_Str); }
/// <summary> /// 热门车站查询 /// </summary> /// <param name="_doh"></param> /// <returns></returns> public string Hot_CheZhan(JumboECMS.DBUtility.DbOperHandler _doh) { string _Str = ""; _doh.Reset(); _doh.SqlCmd = "select top 30 Area_Name from [T_TrainArea] ORDER BY SearchNum DESC,Area_Name asc"; DataTable dt = _doh.GetDataTable(); for (int i = 0; i < dt.Rows.Count; i++) { _Str += "<li><a href=\"javascript:void(0);\" onclick=\"ShowCheZhan('" + dt.Rows[i]["Area_Name"].ToString().ToUpper() + "');return false;\">" + dt.Rows[i]["Area_Name"].ToString().ToUpper() + "</a></li>"; } dt.Clear(); dt.Dispose(); return(_Str); }
/// <summary> /// 需要修改数据时取出数据库中的记录填充到表单中。 /// </summary> public void BindWhenModify() { if (alBinderItems.Count == 0) { return; } BinderItem bi; int i = 0; StringBuilder sbSqlCmd = new StringBuilder("SELECT TOP 1 "); for (i = 0; i < alBinderItems.Count; i++) { bi = (BinderItem)alBinderItems[i]; sbSqlCmd.Append(bi.field); sbSqlCmd.Append(","); } sbSqlCmd.Remove(sbSqlCmd.Length - 1, 1);//去掉多余的一个逗号 sbSqlCmd.Append(" from "); sbSqlCmd.Append(TableName); sbSqlCmd.Append(" where 1=1 and "); sbSqlCmd.Append(this.ConditionExpress); doh.Reset(); doh.SqlCmd = sbSqlCmd.ToString(); myDt = doh.GetDataTable(); //如果指定记录不存在则抛出异常 if (myDt.Rows.Count == 0) { throw new ArgumentException("Record does not exist."); } DataRow dr = myDt.Rows[0]; for (i = 0; i < alBinderItems.Count; i++) { bi = (BinderItem)alBinderItems[i]; bi.SetValue(dr[bi.field].ToString()); } this.OnBindBeforeModifyOk(System.EventArgs.Empty); }