public void testGetDataType() { BLL.DataBLL dbll = new BLL.DataBLL(); Model.RecordeData[] mrd2 = dbll.getDataType(null); for (int i = 0; i < mrd2.Length; i++) { al.Add(mrd2[i]); } }
protected void ddlDataTypeDataBind() { ddlDataType.Items.Clear(); Model.RecordeData[] mDataType = dbll.getDataType(null); for (int i = 0; i < mDataType.Length; i++) { ListItem liDataType = new ListItem(); liDataType.Value = mDataType[i].DataType.ToString(); liDataType.Text = mDataType[i].DataTypeName; ddlDataType.Items.Add(liDataType); } ddlDataType.Items.Insert(0, new ListItem("-- 请选择 --", "-1")); }
protected void initDDLDataType() { ddl_dt.Items.Clear(); ListItem li = new ListItem(); li.Value = "选择数据类型"; li.Text = "选择数据类型"; ddl_dt.Items.Add(li); mDataType = dbll.getDataType(null); for (int i = 0; i < mDataType.Length; i++) { ListItem liDataType = new ListItem(); liDataType.Value = mDataType[i].DataType.ToString(); liDataType.Text = mDataType[i].DataTypeName; ddl_dt.Items.Add(liDataType); } }
/// <summary> /// 查询按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void b_commit_Click(object sender, EventArgs e) { ////计算时效取值 List <string> sx = new List <string> (); foreach (ListItem li in cbl_timeSX.Items) { if (li.Selected == true) { sx.Add(li.Value); } } if (sx != null) { try { string[] programInfo = ddl_program.SelectedValue.Split('#'); string programIDStr = programInfo[0]; int programID = Convert.ToInt32(programIDStr); int dtID = Convert.ToInt32(programInfo[1]); int ttID = Convert.ToInt32(programInfo[2]); //根据不同的时效取结果集 //如果是是一个时效或者全部时效,调用getData2函数,效率更高些 //全部时效,参数为null if (sx.Count == cbl_timeSX.Items.Count) { mRecordeData = dbll.getData2(programID, dtID, ttID, null, null); } else { switch (sx.Count) { case 0: /// <summary> /// 清除数据内容显示 /// 显示说明信息 /// syy 20130627 清除当前的记录的同时也清除前一天的记录信息 /// 清除解释代码 /// 清除Elment关系 /// </summary> resetVar(); break; case 1: int time = Convert.ToInt32(sx[0]); mRecordeData = dbll.getData2(programID, dtID, ttID, null, time); break; //部分时效,参数为24#48。。。 default: string times = ""; for (int i = 0; i < sx.Count; i++) { times += sx[i] + "#"; } times = times.Substring(0, times.Length - 1); mRecordeData = dbll.getData2X(programID, dtID, ttID, null, times); break; } } if (mRecordeData != null && mRecordeData.Length != 0) { //Element关系,Element01--天气 mElementRelation = dbll.getElementsName(programIDStr); //转码实际气象信息内容,Element01--00--晴 elTransCode = transElCode(programIDStr); //缺失或者数据异常站点信息 ExpStationMessage = new ExpStation(); //提示信息。频道、栏目、预报时间、数据类型等等 TipMessageInfo = new TipMessage(); TipMessageInfo.Channel = ddl_channel.SelectedItem.Text; TipMessageInfo.Program = ddl_program.SelectedItem.Text; int datatypeID = Convert.ToInt32(programInfo[1]); RecordeData[] rdDataType = dbll.getDataType(datatypeID); TipMessageInfo.DataType = rdDataType[0].DataTypeName + TipMessageInfo.DataTypeMessage; //为了避免第一行的数据ReportTime为NULL,取不出来,做循环取出结果值 DateTime rt = new DateTime(); for (int i = 0; i < mRecordeData.Length; i++) { if (mRecordeData[i].ReportTime != null) { rt = mRecordeData[i].ReportTime.Value; TipMessageInfo.ReportTime = mRecordeData[i].ReportTime.Value.ToString(); break; } } //取前一天的天气,进行气温对比 DateTime rtYesterday = rt.AddDays(-1); //根据不同的时效取结果集 //如果是是一个时效或者全部时效,调用getData2函数,效率更高些 //全部时效,参数为null if (sx.Count == cbl_timeSX.Items.Count) { mRecordeData_Pre = dbll.getData2(programID, dtID, ttID, rtYesterday, null); } else { switch (sx.Count) { case 0: mRecordeData_Pre = null; //不会走到 break; case 1: int time = Convert.ToInt32(sx[0]); mRecordeData_Pre = dbll.getData2(programID, dtID, ttID, rtYesterday, time); break; //部分时效,参数为24#48。。。 default: string times = ""; for (int i = 0; i < sx.Count; i++) { times += sx[i] + "#"; } times = times.Substring(0, times.Length - 1); mRecordeData_Pre = dbll.getData2X(programID, dtID, ttID, rtYesterday, times); break; } } gv_citydata.DataSource = mRecordeData; gv_citydata.DataBind(); showTipInfo(); // Label1.Text = "sssssssssssssssssssssss"; //内容显示 showContent(true); //清除说明 showIllustration(false); } } catch { resetVar(); } } }