예제 #1
0
        /// <summary>
        /// 刷新数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RefreshTime(object sender, DirectEventArgs e)
        {
            try
            {
                string where = string.Empty;

                //DataTable dt = GetDataTable("1");
                DataTable dt = GetDataTable("10");
                //当有未处理的报警消息时或没有未处理的报警消息但界面上显示了未处理的报警消息需要刷新列表绑定数据
                if (dt.Rows.Count > 0)
                {
                    string BH = dt.Rows[0][0].ToString();
                    if (BH != FlowXh.Value.ToString())
                    {
                        string location_name = dt.Rows[0][1].ToString();
                        string KSSD          = dt.Rows[0][2].ToString();
                        string JSSD          = dt.Rows[0][3].ToString();
                        string bjsj          = dt.Rows[0][4].ToString();
                        string tjzq          = dt.Rows[0][5].ToString();
                        string bjfz          = dt.Rows[0][6].ToString();
                        string bl            = dt.Rows[0][7].ToString();
                        string ll            = dt.Rows[0][8].ToString();
                        string name          = dt.Rows[0][9].ToString();
                        string cljg          = dt.Rows[0][10].ToString();
                        string gxsj          = dt.Rows[0][11].ToString();
                        string msg           = GetHtml(location_name, bjsj, tjzq, bjfz, bl, ll, name, cljg, gxsj);

                        StoreFlow.DataSource = dt;// GetDataTable("10");
                        StoreFlow.DataBind();
                        FlowXh.Value = BH;
                        //string url = "../Sound/hmdalarm.WAV";
                        //switch (bjlx)
                        //{
                        //    case "5":
                        //        url = "../Sound/speedalarm.WAV";
                        //        break;

                        //    case "1":
                        //    case "3":
                        //        url = "../Sound/hmdalarm.WAV";
                        //        break;

                        //    default:
                        //        url = "../Sound/otheralarm.WAV";
                        //        break;
                        //}

                        //string js = "soundPlay(\"" + url + "\");";
                        //this.ResourceManager1.RegisterAfterClientInitScript(js);
                        //surl1 = dataCommon.ChangePoliceIp(surl1);
                        //surl2 = dataCommon.ChangePoliceIp(surl2);
                        //ApplyImage(surl1, surl2);
                        ApplyText(msg);
                        string sNum  = "共" + dt.Rows.Count.ToString() + "条。";
                        string sShot = "报警卡口:" + location_name + "\r\n\r\n\r\n报警时间:" + bjsj;
                        FlowInforNotice(sNum, sShot, false);
                        RowSelectionModel1.SelectFirstRow();
                    }
                }
                else if (((dt.Rows.Count == 0) && (FlowXh.Value.ToString() != string.Empty)))
                {
                    StoreFlow.DataSource = dt;
                    StoreFlow.DataBind();
                    FlowXh.Value = string.Empty;
                    //ApplyImage(string.Empty, string.Empty);
                    ApplyText(string.Empty);
                    string sNum  = "共0条。";
                    string sShot = "10分钟内没有新的报警消息。";
                    FlowInforNotice(sNum, sShot, true);
                }
            }
            catch (Exception ex)
            {
                ILog.WriteErrorLog(ex);
                logManager.InsertLogError("FlowMonitor.aspx-RefreshTime", ex.Message, "RefreshTime has an exception");
            }
        }
        /// <summary>
        /// 刷新数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RefreshTime(object sender, DirectEventArgs e)
        {
            try
            {
                string where = string.Empty;

                DataTable dt = GetDataTable("10");

                //当有未处理的报警消息时或没有未处理的报警消息但界面上显示了未处理的报警消息需要刷新列表绑定数据
                int nCurNum = dt.Rows.Count;
                if (nCurNum > 0)
                {
                    string xh = dt.Rows[0][0].ToString();
                    if ((xh != AlarmXh.Value.ToString()) || (_nGridRowNum != nCurNum))
                    {
                        string surl1  = dt.Rows[0][14].ToString();
                        string surl2  = dt.Rows[0][15].ToString();
                        string hpzl   = dt.Rows[0][1].ToString();
                        string hphm   = dt.Rows[0][3].ToString();
                        string hpzlms = dt.Rows[0][5].ToString();
                        string gwsj   = dt.Rows[0][6].ToString();
                        string xlsd   = dt.Rows[0][10].ToString();
                        string bjlx   = dt.Rows[0][19].ToString();
                        string bjyy   = dt.Rows[0][20].ToString();
                        string bklx   = dt.Rows[0][28].ToString();
                        string msg    = GetHtml(hpzl, hphm, hpzlms, gwsj, xlsd, bjlx, bjyy);

                        StoreAlarm.DataSource = dt;// GetDataTable("10");
                        StoreAlarm.DataBind();
                        AlarmXh.Value = xh;
                        string url = "../Sound/hmdalarm.WAV";
                        switch (bjlx)
                        {
                        case "5":
                            url = "../Sound/speedalarm.WAV";
                            break;

                        case "1":
                        case "3":
                            url = "../Sound/hmdalarm.WAV";
                            break;

                        default:
                            url = "../Sound/otheralarm.WAV";
                            break;
                        }

                        string js = "soundPlay(\"" + url + "\");";
                        this.ResourceManager1.RegisterAfterClientInitScript(js);
                        //surl1 = dataCommon.ChangePoliceIp(surl1);
                        //surl2 = dataCommon.ChangePoliceIp(surl2);
                        ApplyImage(surl1, surl2);
                        ApplyText(msg);
                        string sNum   = "" + GetLangStr("AlarmMonitor21", "共") + "" + dt.Rows.Count.ToString() + "" + GetLangStr("AlarmMonitor22", "条。") + "";
                        string sShot1 = "" + GetLangStr("AlarmMonitor23", "布控类型:") + "" + bklx;
                        string sShot2 = "" + GetLangStr("AlarmMonitor24", "号牌号码:") + "" + hphm;
                        string sShot3 = "" + GetLangStr("AlarmMonitor25", "过车时间:") + "" + gwsj;
                        _nGridRowNum = nCurNum;
                        AlarmInforNotice(sNum, sShot1, sShot2, sShot3, false);
                        RowSelectionModel1.SelectFirstRow();
                    }
                }
                else if (((dt.Rows.Count == 0) && (AlarmXh.Value.ToString() != string.Empty)))
                {
                    StoreAlarm.DataSource = dt;
                    StoreAlarm.DataBind();
                    AlarmXh.Value = string.Empty;
                    ApplyImage(string.Empty, string.Empty);
                    ApplyText(string.Empty);
                    string sNum  = GetLangStr("AlarmMonitor26", "共0条。");
                    string sShot = GetLangStr("AlarmMonitor27", "10分钟内没有新的报警消息。");
                    AlarmInforNotice(sNum, sShot, "", "", true);
                }
            }
            catch (Exception ex)
            {
                ILog.WriteErrorLog(ex);
                logManager.InsertLogError("AlarmMonitor.aspx-RefreshTime", ex.Message + ";" + ex.StackTrace, "RefreshTime has an exception");
            }
        }