Exemplo n.º 1
0
    protected void initlboxDisplaySelected(string programValue)
    {
        lboxDisplaySelected.Items.Clear();
        string programID = programValue.Split('#')[0];

        mSelectedElement = dbll.getElementsName(programID);
        if (mSelectedElement.Length != 0)
        {
            for (int i = 0; i < mSelectedElement.Length; i++)
            {
                ListItem liSelectedElement = new ListItem();
                liSelectedElement.Value = mSelectedElement[i].ElementID.ToString();
                liSelectedElement.Text  = mSelectedElement[i].ElementNameCN;
                lboxDisplaySelected.Items.Add(liSelectedElement);
            }
        }
    }
Exemplo n.º 2
0
    protected void fillGV(GridView gvShow, Model.RecordeData par_mrd, string timeSXID)
    {
        gvShow.DataSource = null;
        if (timeSXID == "选择时效")
        {
            try
            {
                mRecordeData = dbll.getZBData(par_mrd);
            }
            catch
            {
                mRecordeData = null;
            }
        }
        else
        {
            try
            {
                mRecordeData = dbll.getZBDataBySX(par_mrd);
            }
            catch
            {
                mRecordeData = null;
            }
        }
        if (mRecordeData != null && mRecordeData.Length != 0)
        {
            try//20090813byHan
            {
                showTip(mRecordeData[0]);
                if (lb_titleTime.Text == "昨天之前数据,不可查看!")
                {
                    gvShow.DataSource = null;
                }
                else
                {
                    gvShow.DataSource = mRecordeData;
                    Model.ChannelProgram mcp = new Model.ChannelProgram();
                    mcp.DataTypeID = par_mrd.DataType;
                    mcp.TimeTypeID = par_mrd.TimeType;
                    string cpid = dbll.getZBcpid(mcp).CP_ID.ToString();

                    if (mStationRelation == null)
                    {
                        mStationRelation = dbll.getZBStations(mcp);
                    }

                    if (mElementRelation == null)
                    {
                        mElementRelation = dbll.getElementsName(cpid);
                    }

                    if (alTransCode.Count == 0)
                    {
                        alTransCode = transCodeArrayList(cpid);
                    }

                    string rt = mRecordeData[0].ReportTime + "";


                    noExistStation();

                    mRecordeData_Pre = dbll.getZBDataPre(par_mrd, rt);

                    cmpCurTemPre();
                }
            }
            catch { }
        }

        else
        {
            if (mRecordeData == null)
            {
                p_noExistStation.Visible    = true;
                lb_noExistStation.Text      = "该栏目还没有进行配置!";
                lb_noExistStation.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                p_noExistStation.Visible    = true;
                lb_noExistStation.Text      = "本次查询无数据显示!";
                lb_noExistStation.ForeColor = System.Drawing.Color.Red;
            }
        }
        gvShow.DataBind();
    }
Exemplo n.º 3
0
    /// <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();
            }
        }
    }