视频页面的分页以及显示

前台代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BaseDisplayVedio.aspx.cs" Inherits="舟山物联.ZS_Site.BaseMonitor.BaseDisplayVedio" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate" />
    <meta http-equiv="Expires" content="0" />
    <title>视频信息</title>
    <link href="/CSS/demo.css" rel="stylesheet" />
    <link href="/CSS/basic.css" rel="stylesheet" />
    <link href="/CSS/style.css" rel="stylesheet" />
    <script type="text/javascript">
        document.write("<link type=‘text/css‘ href=‘/CSS/demo.css?version=" + new Date().getTime() + "‘ rel=‘stylesheet‘ />");
    </script>
</head>
<body style="padding: 0;">
    <form runat="server">
        <div class="bg_bg" style=" padding:0 10px;"><span class="fl" style="display:block;">视频 </span><a class="fr" style="display:block;cursor:pointer; font-size:26px;"  onclick="clickStopRealPlay(0);" >×</a></div>
        <div >
            <div class="yujingk_main">
                <ul class="mt10 ml10 pc_overflow fl">
                    <li class="yujingk_main_ti fl ml10">方向控制:</li>
                    <li class="ship fl ml10"><a href="#" onmousedown="mouseDownPTZControl(1);" onmouseup="mouseUpPTZControl();">上</a></li>
                    <li class="ship fl ml10"><a href="#" onmousedown="mouseDownPTZControl(2);" onmouseup="mouseUpPTZControl();">下</a></li>
                    <li class="ship fl ml10"><a href="#" onmousedown="mouseDownPTZControl(3);" onmouseup="mouseUpPTZControl();">左</a></li>
                    <li class="ship fl ml10"><a href="#" onmousedown="mouseDownPTZControl(4);" onmouseup="mouseUpPTZControl();">右</a></li>
                    <li class="ship fl ml10"><a href="#" onmousedown="PTZZoomIn()" onmouseup="PTZZoomStop()">放大</a></li>
                    <li class="ship fl ml10"><a href="#" onmousedown="PTZZoomout()" onmouseup="PTZZoomStop()">缩小</a></li>
                </ul>
                 <span style=" margin-top:10px; margin-right:10px;display: none;" id="lnkCtrl" class="fr pc_overflow">
                    <a href="/js/WebComponents.exe"><img src="/images/k_icon.png" /></a></span>
                <img id="next" src="/images/l-btn.png" style="z-index:9999;left: -674px;top: 400px; position: relative; background-color:#343434; width: 35px; height: 35px;" onclick="ImgFront();" />
                <img id="front" src="/images/r-btn.png" style="z-index:99999; position:relative;top: 400px;left:283px; background-color:#343434; width: 35px; height: 35px;" onclick="ImgNext();" />

                <div class="clear"></div>

                <div id="tablist2" style="background:#343434;">
                    <%--视频翻页--%>
                    <div class="m2yw_pic mt20" <%--style="height:683px;"--%>>
                        <div id="divPlugin" class="plugin" >
                        </div>
                        &nbsp;
                    </div>
                </div>
            </div>
        </div>

    </form>
</body>
<script src="/js/jquery-1.8.2.min.js"></script>
<script src="/js/webVideoCtrl.js"></script>
<script src="/js/demo.js"></script>
<script type="text/javascript">
    var sreenview = new Array();
    var StrCurrentVideoIDs = "";
    var BaseID = <%=BaseID%>

    // 登录
    $(function () {
        changeWndNum(1)
        StrCurrentVideoIDs = "";
        if (StrCurrentVideoIDs == "") {
            GetFrist();
        }
    });

    // 窗口分割数
    function changeWndNum(iType) {
        iType = parseInt(iType, 10);
        WebVideoCtrl.I_ChangeWndNum(iType);
    }

    //视频的翻页
    function BindData() {
        //if (0 < sreenview.length && sreenview.length <= 1) {
        //    CountVedio = 1;
        //} else if (1 < sreenview.length && sreenview.length <= 4) {
        //    CountVedio = 2;
        //} else if (4 < sreenview.length && sreenview.length <= 9) {
        //    CountVedio = 3;
        //} else {
        //    CountVedio = 4;
        //}

        //changeWndNum(CountVedio);

        if (sreenview.length > 0) {
            //判断显示在第几个窗口:
            for (var i = 0; i < sreenview.length; i++) {
                clickLoginPLay(sreenview[i].IP, sreenview[i].IPort, sreenview[i].CUserName, sreenview[i].CPassWord, i);
            }
        }
        else {
            //clickLoginPLay(‘192.168.0.65‘, 80, ‘admin‘, ‘qwer1234‘, 0);
            alert("没有更多的视频信息了!");
        }
    }

    // 停止预览
    function clickStopRealPlay(count) {
        var oWndInfo = WebVideoCtrl.I_GetWindowStatus(count),
            szInfo = "";

        if (oWndInfo != null) {
            var iRet = WebVideoCtrl.I_Stop();
            if (0 == iRet) {
                szInfo = "停止预览成功!";
            } else {
                szInfo = "停止预览失败!";
            }
        }
        //alert(parent.document.getElementById("myModa"));
        //关闭当前页面
        window.parent.location.href = "BaseMonitor.aspx?BaseID=" + BaseID;

        //parent.document.getElementById("myModa").style.display = "none";
    }

    //下一页
    function ImgNext() {
        sreenview = new Array();
        $.ajax({
            type: ‘post‘,
            url: ‘/Ajax/Video.ashx?type=1&StrCurrentVideoIDs=‘ + StrCurrentVideoIDs + ‘&BaseID=‘ + BaseID,
            success: function (Data) {
                if (Data == "[]") {
                    alert("没有更多的视频信息了!");
                    return;
                } else {
                    var result = eval("(" + Data + ")");
                    StrCurrentVideoIDs = "";
                    for (var i = 0; i < result.length; i++) {
                        if (i == result.length - 1) {
                            StrCurrentVideoIDs += result[i].ID;
                        } else {
                            StrCurrentVideoIDs += result[i].ID + ",";
                        }
                        var temp = {
                            IP: result[i].CDeviceIp,
                            IPort: result[i].Port,
                            CUserName: result[i].FName,
                            CPassWord: result[i].Parameter
                        };
                        sreenview.push(temp);
                    }
                    BindData();
                }
            }
        })
    }

    //上一页
    function ImgFront() {
        sreenview = new Array();
        $.ajax({
            type: ‘post‘,
            url: ‘/Ajax/Video.ashx?type=2&StrCurrentVideoIDs=‘ + StrCurrentVideoIDs + ‘&BaseID=‘ + BaseID,
            success: function (Data) {
                if (Data == "[]") {
                    alert("没有更多的视频信息了!");
                    return;
                } else {
                    var result = eval("(" + Data + ")");
                    StrCurrentVideoIDs = "";

                    for (var i = 0; i < result.length; i++) {
                        if (i == result.length - 1) {
                            StrCurrentVideoIDs += result[i].ID;
                        } else {
                            StrCurrentVideoIDs += result[i].ID + ",";
                        }
                        var temp = {
                            IP: result[i].CDeviceIp,
                            IPort: result[i].Port,
                            CUserName: result[i].FName,
                            CPassWord: result[i].Parameter
                        };
                        sreenview.push(temp);
                    }
                    BindData();
                }

            }
        })
    }

    function GetFrist() {
        sreenview = new Array();
        $.ajax({
            type: ‘post‘,
            url: ‘/Ajax/Video.ashx?type=0&StrCurrentVideoIDs=‘ + StrCurrentVideoIDs + ‘&BaseID=‘ + BaseID,
            success: function (Data) {
                if (Data == "没有视频信息!") {
                    alert(Data);
                    return;
                } else {
                    var result = eval("(" + Data + ")");

                    for (var i = 0; i < result.length; i++) {
                        if (i == result.length - 1) {
                            StrCurrentVideoIDs += result[i].ID;
                        } else {
                            StrCurrentVideoIDs += result[i].ID + ",";
                        }
                        var temp = {
                            IP: result[i].CDeviceIp,
                            IPort: result[i].Port,
                            CUserName: result[i].FName,
                            CPassWord: result[i].Parameter
                        };
                        sreenview.push(temp);
                    }
                    BindData();
                }
            }
        })
    }
</script>
</html>

后台代码:传值

Video.ashx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FS.Extend;
using LD_Model.DB;
using LD_Logic.IOT;
using Newtonsoft.Json;

namespace 舟山物联.Ajax
{
    /// <summary>
    /// Video 的摘要说明
    /// </summary>
    public class Video : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int type = context.Request["type"].ConvertType(0);
            string StrCurrentVideoIDs = context.Request["StrCurrentVideoIDs"];
            int BaseID = context.Request["BaseID"].ConvertType(0);

            DeviceControlLogic vedio = new DeviceControlLogic();

            //获取当前基地下并且状态=视频选出来,不重复的controlID集合;
            List<int?> lstGetAllControlID = DeviceConfigDB.Data.Where(o => o.BaseID == BaseID && o.IDeviceType == DeviceControlDB.eumIDeviceType.Video).ToList().Select(o => o.ControlID).Distinct().ToList();

            if (lstGetAllControlID.Count > 0)
            {
                List<DeviceControlDB> lstGetControl = new List<DeviceControlDB>();
                switch (type)
                {
                    //首页
                    case 0:
                        {
                            lstGetControl = vedio.GetVideo(lstGetAllControlID, 1);
                            break;
                        }
                    //下一页
                    case 1:
                        {
                            lstGetControl = vedio.GetVedioPageNext(1, StrCurrentVideoIDs, lstGetAllControlID);
                            break;
                        }
                    //上一页
                    case 2:
                        {
                            lstGetControl = vedio.GetVedioPageFront(1, StrCurrentVideoIDs, lstGetAllControlID);
                            break;
                        }
                }
                 var result = JsonConvert.SerializeObject(lstGetControl);
                 context.Response.Write(result);
            }
            else {
                context.Response.Write("没有视频信息!");
            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

model层写的sql语句

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LD_Model.DB;
using System.Data;
using System.Reflection;
using System.Data.SqlClient;
namespace LD_Logic.IOT
{
    public partial class DeviceControlLogic
    {
        public DeviceControlLogic()
        {}

        /// <summary>
        /// 添加修改气象站
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public bool Save(DeviceControlDB info)
        {
            if (info.ID > 0)
            {
                return DeviceControlDB.Data.Update(info);
            }
            else
            {
                return DeviceControlDB.Data.Insert(info);
            }
        }

        /// <summary>
        /// 根据ID删除气象站
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public bool Delete(int ID)
        {
            return DeviceControlDB.Data.Delete(ID);
        }

        /// <summary>
        /// 根据ID获取一个实体
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public DeviceControlDB GetModel(int ID)
        {
            return DeviceControlDB.Data.Where(o => o.ID == ID).ToInfo();
        }

        /// <summary>
        /// 获取所有信息
        /// </summary>
        /// <returns></returns>
        public List<DeviceControlDB> GetList()
        {
            return DeviceControlDB.Data.Where(o => o.IDeviceType == LD_Model.DB.DeviceControlDB.eumIDeviceType.Sensor).ToList();
        }

        /// <summary>
        /// 视频
        /// </summary>
        /// <param name="lstGetControlID"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public List<DeviceControlDB> GetVideo(List<int?> lstGetControlID, int count)
        {
            StringBuilder strSql = new StringBuilder();
            string StrIDs = string.Join(",",lstGetControlID.ToArray());
            strSql.AppendFormat("  select top {1} * from dbo.TB_Device_Control where ID in ({0}) order by ID desc  ", StrIDs,count);
            var dataset = LD_Logic.IOT.Common.CommonDAL.Query(strSql.ToString());

            return DataSetToIList<DeviceControlDB>(dataset, 0);
        }

        /// <summary>
        /// 视频翻页(下一页)
        /// ids当前视频的ID,lstGetControlID为当前基地下所有的视频ID
        /// </summary>
        public List<DeviceControlDB> GetVedioPageNext(int vedioCount, string StrIds, List<int?> lstGetControlID)
        {
            StringBuilder strSql = new StringBuilder();
            //string StrIds = string.Join(",", ids.ToArray());
            string StrControlIds = string.Join(",", lstGetControlID.ToArray());
            strSql.AppendFormat(" select top {0} * from dbo.TB_Device_Control  where  ID in ({2}) and ID < (select MIN(ID) from  dbo.TB_Device_Control where  ID in ({1}) ) order by ID desc ", vedioCount, StrIds, StrControlIds);
            var dataset = LD_Logic.IOT.Common.CommonDAL.Query(strSql.ToString());

            return DataSetToIList<DeviceControlDB>(dataset, 0);
        }

        /// <summary>
        /// 视频翻页(上一页)
        /// </summary>
        public List<DeviceControlDB> GetVedioPageFront(int vedioCount, string StrIds, List<int?> lstGetControlID)
        {
            StringBuilder strSql = new StringBuilder();
            //string StrIds = string.Join(",", ids.ToArray());
            string StrControlIds = string.Join(",", lstGetControlID.ToArray());
            strSql.AppendFormat(" select top {0} * from dbo.TB_Device_Control  where  ID in ({2})  and ID > (select max(ID) from dbo.TB_Device_Control where  ID in ({1})) order by ID asc ", vedioCount, StrIds, StrControlIds);
            var dataset = LD_Logic.IOT.Common.CommonDAL.Query(strSql.ToString());

            return DataSetToIList<DeviceControlDB>(dataset, 0);
        }

        /// <summary>
        /// 右上角预警信息浮动同一传感器只显示最新一条数据
        /// </summary>
        public List<AlarmLogDB> lstAlarmInfo(int CID)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.AppendFormat("select * from dbo.TB_AlarmLog a where exists(select * from (select DeviceID,max(AlarmAt) as FTime from dbo.TB_AlarmLog group by DeviceID) x where x.DeviceID=a.DeviceID and a.AlarmAt=x.FTime and CID= {0} )", CID);
            var dataset = LD_Logic.IOT.Common.CommonDAL.Query(strSql.ToString());
            return DataSetToIList<AlarmLogDB>(dataset, 0);
        }

        /// <summary>
        /// DataSet装换为泛型集合
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="p_DataSet">DataSet</param>
        /// <param name="p_TableIndex">待转换数据表索引</param>
        /// <returns></returns>
        public static List<T> DataSetToIList<T>(DataSet p_DataSet, int p_TableIndex)
        {
            if (p_DataSet == null || p_DataSet.Tables.Count < 0)
                return null;
            if (p_TableIndex > p_DataSet.Tables.Count - 1)
                return null;
            if (p_TableIndex < 0)
                p_TableIndex = 0;

            DataTable p_Data = p_DataSet.Tables[p_TableIndex];
            // 返回值初始化
            List<T> result = new List<T>();
            for (int j = 0; j < p_Data.Rows.Count; j++)
            {
                T _t = (T)Activator.CreateInstance(typeof(T));
                PropertyInfo[] propertys = _t.GetType().GetProperties();
                foreach (PropertyInfo pi in propertys)
                {
                    for (int i = 0; i < p_Data.Columns.Count; i++)
                    {
                        // 属性与字段名称一致的进行赋值 (枚举类型无法转换,单独拎出来)
                        if (pi.Name.Equals(p_Data.Columns[i].ColumnName))
                        {
                            if (pi.Name == "IDeviceType")
                            {
                                pi.SetValue(_t, DeviceControlDB.eumIDeviceType.Video, null);
                            }
                            else if (pi.Name == "Status")
                            {
                                if (p_Data.Rows[j][i] != DBNull.Value)
                                {
                                    if (Convert.ToInt32(p_Data.Rows[j][i]) == 0)
                                    {
                                        pi.SetValue(_t, DeviceControlDB.eumStatusType.Error, null);
                                    }
                                    else if (Convert.ToInt32(p_Data.Rows[j][i]) == 2)
                                    {
                                        pi.SetValue(_t, DeviceControlDB.eumStatusType.Warning, null);
                                    }
                                    else
                                    {
                                        pi.SetValue(_t, DeviceControlDB.eumStatusType.Normal, null);
                                    }
                                }
                            }
                            else if (pi.Name == "AlarmType")
                            {
                                pi.SetValue(_t, LD_Entity.enums.eumAlarmType.Warning, null);
                            }
                            else if (pi.Name == "AlarmStatus")
                            {
                                pi.SetValue(_t, LD_Entity.enums.eumAlarmStatusType.High, null);
                            }
                            else {
                                // 数据库NULL值单独处理
                                if (p_Data.Rows[j][i] != DBNull.Value)
                                    pi.SetValue(_t, p_Data.Rows[j][i], null);
                                else
                                    pi.SetValue(_t, null, null);
                            }
                            break;
                        }
                    }
                }
                result.Add(_t);
            }
            return result;
        }

    }
}
时间: 2024-10-31 06:32:13

视频页面的分页以及显示的相关文章

.NET生成静态页面并分页

因为公司的产品用asp开发, 前一段时间用asp写了一个生成静态页面并分页的程序,但缘于对.net的热爱,写了这个.net下的生成静态页面并分页的程序. 主要的原理就是替换模板里的特殊字符. 1.静态模板页面 template.html,主要是定义了一些特殊字符,用来被替换. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dt

TERSUS画画一样开发软件 显示元件介绍-分页面及左右栏显示元件

TERSUS无代码手机电脑管理类软件开发,其中页面框架设计的显示元件包括:分页面显示元件(Tabbed Pane).左右可调大小两栏显示元件(Split Pane) 分页面显示元件(Tabbed Pane):是一个含多个显示页面的容器,每个页面以一个横放栏位的形式出现,默认放有两个页面: 1.可以对分页中的每个显示块进行改名,显示块名称即是导航栏位的名称.可以右键添加更多显示块: 2.对每个分页元件中的子元件,标题栏中元件等进行属性定义,用"html.style"或"html

通用分页后台显示

通用分页 目的:作用通用的分页查询方法 它主要实现的就是通用,将普通查询方法进行反射优化,转变成一个可以被所有实体类dao层所继承的通用查询方法. 实例一 普通分页: 首先我们写一个普通的分页方法,然后再将其进行反射优化,之后就可以看出通用分页的优势了, 1.连接(关闭数据库),使用的是mysql数据库 package com.yuan.util; import java.io.InputStream; import java.sql.Connection; import java.sql.Dr

javascript页面详细信息的显示和隐藏

页面详细信息的显示和隐藏 <!DOCTYPE html> <html> <head> <title></title> </head> <body> <script type="text/javascript"> function show_detail(detail){ var p=document.getElementById('p'); if(detail.open){ p.style.

AngularJS进阶(二十八)解决AngualrJS页面刷新导致异常显示问题

解决AngualrJS页面刷新导致异常显示问题 绪 俗话说,细节决定成败,编程亦是如此.编程过程中我们可能会不自觉的忽视一些细节问题,殊不知,这些细节正是导致页面显示出现问题的地方.今略举一例,与君共勉之. 页面正常加载后,显示如下: 按F5刷新之后,页面如下所示: 很明显,页面显示出现了异常.回过头再看看Chrome的错误提示, 具体代码如下: 正是以上代码导致了错误的发生. 追根溯源 让我们回顾一下,错误到底是如何发生的.正常加载情况下,页面正常显示很容易理解,程序是按照既定的数据流走的.但

jquery实现的点击页面其他地方隐藏显示的元素

jquery实现的点击页面其他地方隐藏显示的元素:在实际应用中,可能有这样的效果,那就是有这样一个弹出层,点击层本身的时候,这个层不会隐藏,而点击除去层之外的页面其他地方则会将这个层隐藏,下面就通过代码实例介绍一下如何实现此效果.代码如下: <!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="

检查当前管理员是否有权限访问这个页面,后台只显示当前管理员有权限访问的按钮

/** * 检查当前管理员是否有权限访问这个页面 */ public function chkPri() { // 获取当前管理员正要访问的模型名称.控制器名称.方法名称 // tP中正带三个常量 //MODULE_NAME , CONTROLLER_NAME , ACTION_NAME $adminId = session('id'); // 如果是超级管理员直接返回 TRUE if($adminId == 1) return TRUE; $arModel = D('admin_role');

MUI——页面的创建、显示、关闭

一.打开子页面 mui.init({ subpages:[{ url:your-subpage-url,//子页面HTML地址,支持本地地址和网络地址 id:your-subpage-id,//子页面标志 styles:{ top:subpage-top-position,//子页面顶部位置 bottom:subpage-bottom-position,//子页面底部位置 width:subpage-width,//子页面宽度,默认为100% height:subpage-height,//子页

html2canvas页面截图图片不显示

前两天在一个群里,有人问使用html2canvas屏幕截图的时候为什么页面的图片不显示只显示了文字,我没有做过屏幕截图的需求,所以不是很清楚,今天稍稍测试了一下. 在github上将html2canvas源码下载到本地,examples文件夹里有三个示例demo,这三个demo都是纯文字不包含图片的,前两个demo是打开之后直接就生成图片展示出来了,第三个是一个按钮触发生成,这里使用第三个demo来修改进行测试. 一.这是初始页面,上面带有背景颜色的是要截取的部分(id名为'content'),