美文网首页
2018-12-27添加多个手机号码VoiceAlarmSett

2018-12-27添加多个手机号码VoiceAlarmSett

作者: 1f658716b568 | 来源:发表于2018-12-27 16:01 被阅读0次

    aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="VoicePhoneSettings.aspx.cs" Inherits="THMS.page.SuperOption.VoicePhoneSettings" 
    EnableEventValidation="false"%>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>语音电话设置</title>
        <link href="../../CommonNew/css/main.css" rel="stylesheet" type="text/css"></link>
        <link href="../../CommonNew/css/animate.min.css" rel="stylesheet" type="text/css">
        </link>
    
        <script src="../../CommonNew/js/select-widget-min.js" type="text/javascript"></script>
    
        <script src="../../CommonNew/js/jquery-ui.min.js" type="text/javascript"></script>
    
        <script src="../../CommonNew/js/laydate.js" type="text/javascript"></script>
    
        <script src="../../CommonNew/js/tab.js" type="text/javascript"></script>
    
        <script src="../../Common/jquery-easyui-1.3.1/jquery-1.8.0.min.js" type="text/javascript"></script>
    
        <link href="../../Common/jquery-easyui-1.5/themes/default/easyui.css" rel="stylesheet"
            type="text/css" />
        <link href="../../Common/jquery-easyui-1.5/themes/icon.css" rel="stylesheet" type="text/css" />
    
        <script src="../../Common/jquery-easyui-1.5/jquery.easyui.min.js" type="text/javascript"></script>
        <style type="text/css">
            .ItemStyleNoDisplay
            {
                display: none;
            }
        </style>
        <script type="text/javascript" language="javascript">
            var PageSize = 100;
            $(function () {
                Query(1);
            });
            function Query(PageIndex) {
                var NodeNO = $("#QueryNodeNO").val();
                var NodeName = $("#QueryNodeName").val();
                var EquipNO = $("#QueryEquipNO").val();
                var EquipName = $("#QueryEquipName").val();
                var NodeVoiceAlarmTel = $("#NodeVoiceAlarmTel").val();
                var CompanyName = $("#CompanyName").val();
                var HasItSet = $('#HasItSet').val();
    
                $.ajax(
                    {
                        type: 'POST',
                        url: 'VoicePhoneSettings.aspx',
                        dataType: 'text',
                        data: { Action: 'Query', NodeNO: NodeNO, NodeName: NodeName, EquipNO: EquipNO, EquipName: EquipName, NodeVoiceAlarmTel: NodeVoiceAlarmTel,
                            CompanyName: CompanyName, HasItSet: HasItSet, PageSize: PageSize, PageIndex: PageIndex
                        },
                        cache: false,
                        beforeSend: function ShowdivShowChangeQueryInfo() { $(".divShowRoleInfo").show() },
                        success: function (strs) {
                            if (strs != "Empty") {
                                var str = strs.split("|");
                                if (str[1] == "0") {
                                    document.getElementById("NodePageNation").style.display = "none";
                                }
                                else {
                                    document.getElementById("<%=lblPageCount.ClientID %>").innerHTML = str[1];
                                    document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML = PageIndex;
                                    document.getElementById("NodePageNation").style.display = "block";
                                }
                                if (str[1] == "1") {
                                    $("#NodePageNation").hide();
                                    $("#ShowInfo").html(str[0]);
                                }
                                else if (str[1] == "0") {
                                    $("#NodePageNation").hide();
                                    $("#ShowInfo").html("<div style='text-align:center'>没有匹配的数据</div>");
                                }
                                else {
                                    $("#ShowInfo").html(str[0]);
                                    $("#NodePageNation").show();
                                }
                            }
                            else {
                                $("#NodePageNation").hide();
                                $("#ShowInfo").html("<div style='text-align:center'>没有匹配的数据</div>");
                            }
                        },
                        complete: function HidedivShowChangeQueryInfo() { $(".divShowRoleInfo").hide() }
                    });
                }
                function write(obj) {
                    var obj2;
                    obj2 = obj.id;
                    var node = obj2.split("_Revisebtn");
                    var NodeISAlarmForSMS = $("#" + node[0] + "_lbNodeISAlarmForSMS").html();
                    var NodeOneLevelIsOpen = $("#" + node[0] + "_lbNodeOneLevelIsOpen").html();
                    var NodeTwoLevelIsOpen = $("#" + node[0] + "_lbNodeTwoLevelIsOpen").html();
                    if (NodeISAlarmForSMS != "是") {
                        $('#txtNodeAlarmTel').unbind("click"); 
                        $("#txtNodeAlarmTel").click(function () {
                            $('#AddAlarmPhoneNumDiv').dialog('close');
                            alert("报警未开启,无法添加号码!");
                        });
                    } else { }
                    if (NodeOneLevelIsOpen != "是") {
                        $('#txtNode_OneLevelSMSTel').unbind("click"); 
                        $("#txtNode_OneLevelSMSTel").click(function () {
                            $('#AddAlarmPhoneNumDiv').dialog('close');
                            alert("预警未开启,无法添加号码!");
                        });
                    } else { }
                    if (NodeTwoLevelIsOpen != "是") {
                        $('#txtNode_TwoLevelSMSTel').unbind("click"); 
                        $("#txtNode_TwoLevelSMSTel").click(function () {
                            $('#AddAlarmPhoneNumDiv').dialog('close');
                            alert("严重报警未开启,无法添加号码!");
                        });
                    } else { }
                }
            //设置语音电话
                function Alter(obj) {
                    write(obj);
                //            debugger;
                var obj2;
                obj2 = obj.id;
                var node = obj2.split("_Revisebtn");
                var NodeNo = $("#" + node[0] + "_lbNodeNo").html();
                var NodeName = $("#" + node[0] + "_lbNodeName").html();
                var EquipNo = $("#" + node[0] + "_lbEquipNo").html();
    
                var NodeISAlarmForSMS = $("#" + node[0] + "_lbNodeISAlarmForSMS").html();
                var NodeVoiceAlarmTel = $("#" + node[0] + "_lbNodeVoiceAlarmTel").html();
                var NodeOneLevelIsOpen = $("#" + node[0] + "_lbNodeOneLevelIsOpen").html();
                var NodeOneLevelVoiceTel = $("#" + node[0] + "_lbNodeOneLevelVoiceTel").html();
                var NodeTwoLevelIsOpen = $("#" + node[0] + "_lbNodeTwoLevelIsOpen").html();
                var NodeTwoLevelVoiceTel = $("#" + node[0] + "_lbNodeTwoLevelVoiceTel").html();
    
                document.getElementById("<%=lbNodeNO.ClientID %>").innerHTML = NodeNo;
                document.getElementById("<%=lblNodeName.ClientID %>").innerHTML = NodeName;
                document.getElementById("<%=lblEquipNo.ClientID %>").innerHTML = EquipNo;
                document.getElementById("<%=lblNodeISAlarmForSMS.ClientID %>").innerHTML = NodeISAlarmForSMS;
                document.getElementById("<%=lblNodeOneLevelIsOpen.ClientID %>").innerHTML = NodeOneLevelIsOpen;
                document.getElementById("<%=lblNodeTwoLevelIsOpen.ClientID %>").innerHTML = NodeTwoLevelIsOpen;
    
    ;
                $("#txtNodeVoiceAlarmTel").val(NodeVoiceAlarmTel);
                $("#txtNodeOneLevelVoiceTel").val(NodeOneLevelVoiceTel);
                $("#txtNodeTwoLevelVoiceTel").val(NodeTwoLevelVoiceTel);
    
                var scrollY = document.documentElement.scrollTop || document.body.scrollTop;  // 获取鼠标滚动高度            
                $("#MaintenanceDialog").dialog({
                    top: scrollY
                });
                $('#MaintenanceDialog').dialog('open');
            }
            //保存修改
            function UpdateOrSaveTheMaintenance() {
                //            debugger;
                var NodeNo = document.getElementById("<%=lbNodeNO.ClientID %>").innerHTML;
                var NodeVoiceAlarmTel = $("#txtNodeVoiceAlarmTel").val();
                var NodeOneLevelVoiceTel = $("#txtNodeOneLevelVoiceTel").val();
                var NodeTwoLevelVoiceTel = $("#txtNodeTwoLevelVoiceTel").val();
    
                //            alert(BelEquipNO);
                $.ajax(
                    {
                        type: 'POST',
                        url: 'VoicePhoneSettings.aspx',
                        dataType: 'text',
                        data: { Action: 'Update', NodeNo: NodeNo, NodeVoiceAlarmTel: NodeVoiceAlarmTel,
                        NodeOneLevelVoiceTel: NodeOneLevelVoiceTel, 
                        NodeTwoLevelVoiceTel: NodeTwoLevelVoiceTel
                        },
                        cache: false,
                        success: function (strs) {
                            alert(strs);
                            $('#MaintenanceDialog').dialog('close');
                            var PageIndex = document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML;   //显示当前页
                            Query(PageIndex);
                        }
                    });
            }
    
            function PageNation(Type) {       //网关分页
                var PageIndex = document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML;   //显示当前页
    
                var PageCount = document.getElementById("<%=lblPageCount.ClientID %>").innerHTML;   //显示所有页
                if (Type == "Next") {
                    PageIndex++;
                    document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML = PageIndex;
                }
                else if (Type == "Last") {
                    PageIndex--;
                    document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML = PageIndex;
                }
                else if (Type == "First") {
                    PageIndex = 1;
                    document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML = PageIndex;
                }
                else if (Type == "End") {
                    PageIndex = PageCount;
                    document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML = PageIndex;
                }
                else if (Type == "Search") {
                    PageIndex = document.getElementById("<%=txtNewPageIndex.ClientID %>").value;
                    document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML = PageIndex;
                }
                if (parseInt(PageIndex) < 1) {
                    document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML = 1;
                    return;
                }
                else if (parseInt(PageIndex) > parseInt(PageCount)) {
                    document.getElementById("<%=lblPageIndex.ClientID %>").innerHTML = PageCount;
                    return;
                }
                $.ajax(
                    {
                        type: 'POST',
                        url: 'VoicePhoneSettings.aspx',
                        dataType: 'text',
                        data: { Action: "NodePageNation", PageIndex: PageIndex, PageSize: PageSize },
                        cache: false,
                        success: function (strs) {
                            if (strs != "Empty") {
                                $("#ShowInfo").html(strs);
                            } else {
                                $("#NodePageNation").hide();
                                $("#ShowInfo").html("<div style='text-align:center'>没有匹配的数据</div>");
                            }
                        }
                    });
                }
    
                function deletedNumRows(obj) {
                    var ele = document.getElementById("TableTr" + obj); //给每一行设置一个ID
                    ele.style.display = "none";
                    $("#txtAddNum" + obj + "").val("");
                }
                function AddNewRows() {
                    var tb = document.getElementById('AddNumTable');
                    var rowNum = tb.rows.length;
                    $("#AddNumTable").append("<tr class=\"wg_wh_bd\" id=\"TableTr" + (parseInt(rowNum) + 1) + "\"><td class=\"xianc\"  align=\"right\"><div class=\"t1\">添加手机号:</div><div class=\"t3\"><input id=\"txtAddNum" + (parseInt(rowNum) + 1) + "\" type=\"text\" /></div><div class=\"t4\"><a onclick=\"deletedNumRows('" + (parseInt(rowNum) + 1) + "');return false;\" class=\"bt_del fl\" href=\"#\"></a></div></td></tr>");
                }
                var TheAlarmNum;
                function AddAlarmPhoneNum(num) {
                    TheAlarmNum = num;
                    var tb = document.getElementById('AddNumTable');  //清空table
                    var rowNum = tb.rows.length;
                    for (i = 0; i < rowNum; i++) {
                        tb.deleteRow(i);
                        rowNum = rowNum - 1;
                        i = i - 1;
                    }
                    var OldNum;
                    if (num == '0') {
                        OldNum = $("#txtNodeVoiceAlarmTel").val();
                    }
                    else if (num == '1') {
                        OldNum = $("#txtNodeOneLevelVoiceTel").val();
                    }
                    else if (num == '2') {
                        OldNum = $("#txtNodeTwoLevelVoiceTel").val();
                    }
    
                    if (OldNum == "" || OldNum == undefined) {
                        $("#AddNumTable").append("<tr class=\"wg_wh_bd\" id=\"TableTr1\"><td class=\"xianc\"  align=\"right\"><div class=\"t1\">添加手机号:</div><div class=\"t3\"><input id=\"txtAddNum1\" type=\"text\" /></div><div class=\"t4\"><a onclick=\"deletedNumRows('1');return false;\" href=\"#\" class=\"bt_del fl\"></a></div></td></tr>");
    
                    }
                    else {
                        var TheNum = OldNum.split(',');
                        var i;
                        for (i = 1; i < TheNum.length + 1; i++) {
                            var labelID = "lbNum" + "" + i + "";
                            $("#AddNumTable").append("<tr class=\"wg_wh_bd\" id=\"TableTr" + i + "\"><td class=\"xianc\"  align=\"right\"><div class=\"t1\">添加手机号:</div><div class=\"t3\"><input id=\'txtAddNum" + i + "\' type=\"text\" value='" + TheNum[i - 1] + "' /></div><div class=\"t4\"><a onclick=\"deletedNumRows(" + i + ");return false;\" href=\"#\" class=\"bt_del fl\"></a></div></td></tr>");
                        }
                        $("#AddNumTable").append("<tr class=\"wg_wh_bd\" id=\"TableTr" + i + "\"><td class=\"xianc\"  align=\"right\"><div class=\"t1\">添加手机号:</div><div class=\"t3\"><input id=\'txtAddNum" + i + "\' type=\"text\" /></div><div class=\"t4\"><a onclick=\"deletedNumRows(" + i + ");return false;\" href=\"#\" class=\"bt_del fl\"></a></div></td></tr>");
                    }
    
                    var scrollY = document.documentElement.scrollTop || document.body.scrollTop;  // 获取鼠标滚动高度
                    $("#AddAlarmPhoneNumDiv").dialog({
                        top: scrollY + 100
                    });
                    $('#AddAlarmPhoneNumDiv').dialog('open');
                }
                function AddAlarmPhoneNumCancel() {
                    $('#AddAlarmPhoneNumDiv').dialog('close');
                }
                function IsPhoneNum(num) {
                    var reNum = /^0?1[3|4|5|7|8][0-9]\d{8}$/;
                    return (reNum.test(num));
                }
                function AddAlarmPhoneNumbtn() {
                    var tb = document.getElementById('AddNumTable');
                    var rowNum = tb.rows.length;
                    var TheNum = '';
                    var alarm = 0;
                    for (var i = 1; i < rowNum + 1; i++) {
                        var Num = $("#txtAddNum" + i + "").val();
                        if (Num != "" && (!IsPhoneNum(Num))) {
                            alarm = '1';
                        }
                        else if (Num != "" && (TheNum.indexOf(Num) > -1)) {
                            alarm = '1';
                        }
                        else {
                            if (Num != "")
                                TheNum = TheNum + Num + ',';
                        }
                    }
                    if (alarm == '1') {
                        alert("请检查手机号");
                    }
                    else {
                        TheNum = TheNum.substring(0, TheNum.length - 1);
                        if (TheAlarmNum == '0') {
                            $("#txtNodeVoiceAlarmTel").val(TheNum);
                        }
                        else if (TheAlarmNum == '1') {
                            $("#txtNodeOneLevelVoiceTel").val(TheNum);
                        }
                        else if (TheAlarmNum == '2') {
                            $("#txtNodeTwoLevelVoiceTel").val(TheNum);
                        }
                        $('#AddAlarmPhoneNumDiv').dialog('close');
                    }
                }
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
        </div>
        <div class="nbg_title2">
            <span>语音电话设置</span>
        </div>
        <div class="search_dtj v_middle">
            <div class="left">
                <div class="t1">
                    <div class="txt">
                        传感器名称:</div>
                    <div class="input">
                        <input type="text" class="bd" id="QueryNodeName" name="QueryNodeName" />
                    </div>
                </div>
                <div class="t1">
                    <div class="txt">
                        网关名称:</div>
                    <div class="input">
                        <input type="text" class="bd" id="QueryEquipName" name="QueryEquipName" />
                    </div>
                </div>
                <div class="t1">
                    <div class="txt">
                        语音报警电话:</div>
                    <div class="input">
                        <input type="text" class="bd" id="NodeVoiceAlarmTel" name="NodeVoiceAlarmTel" />
                    </div>
                </div>
                <div class="t1">
                    <div class="txt">
                        所属单位:</div>
                    <div class="input">
                        <input type="text" class="bd" id="CompanyName" name="CompanyName" />
                    </div>
                </div>
                
            </div>
            <div class="right">
                <div class="t1">
                    <div class="txt">
                        传感器编号:</div>
                    <div class="input">
                        <input type="text" class="bd" id="QueryNodeNO" name="QueryNodeNO" />
                    </div>
                </div>
                <div class="t1">
                    <div class="txt">
                        网关编号:</div>
                    <div class="input">
                        <input type="text" class="bd" id="QueryEquipNO" name="QueryEquipNO" />
                    </div>
                </div>
                <div class="t1">
                    <div class="txt">
                        是否已设置:</div>
                    <div class="input">
                        <select name="HasItSet" id="HasItSet" style="border: 1px solid #d7e0ea; width: 242px;
                            border-radius: 5px; height: 40px; line-height: 40px; padding-left: 15px;" runat="server">
                            <option value="">---请选择---</option> 
                            <option value="1">---是---</option> 
                            <option value="0">---否---</option> 
                        </select> 
                    </div>
                </div>
    
                <div class="t1 mt10">
                    <div class="txt">
                        &nbsp;</div>
                    <div class="input">
                        <asp:Button ID="btnQuery" runat="server" Text="查 询" CssClass="duo_s_btn" OnClientClick="Query(1);return false" />
                    </div>
                </div>
            </div>
        </div>
        
        <%-- 主界面--%>
        <div class="shop_content">
            <div class="zkcurve_list">
                <div>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:GridView ID="VoicePhoneGDV" runat="server" Width="100%" AllowSorting="True" AutoGenerateColumns="False"
                                AllowPaging="true" GridLines="None" PageSize="100">
                                <HeaderStyle Wrap="False" BorderColor="#D7E0EA" Height="40px" ForeColor="#36AEEA">
                                </HeaderStyle>
                                <Columns>
                                    <asp:TemplateField HeaderText="序号" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbID" runat="server" Text='<%# this.VoicePhoneGDV.PageIndex * this.VoicePhoneGDV.PageSize + this.VoicePhoneGDV.Rows.Count + 1%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="传感器编号" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbNodeNo" runat="server" Text='<%# Bind("Node_No")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="传感器名称" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbNodeName" runat="server" Text='<%# Bind("Node_Name")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="所属网关SN" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbEquipNo" runat="server" Text='<%# Bind("Equip_No")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="所属网关名称" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbEquipName" runat="server" Text='<%# Bind("Equip_Name")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="报警是否开启" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbNodeISAlarmForSMS" runat="server" Text='<%#Eval("Node_ISAlarmForSMS").ToString()=="1"?"是":
                                            (Eval("Node_ISAlarmForSMS").ToString()=="0"?"否":"不确定")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <%--Eval("Node_ISAlarmForSMS").ToString()=="1"?"是":
                                            (Eval("Node_ISAlarmForSMS").ToString()=="0"?"否":"不确定"--%>
                                    <%--Bind("Node_TwoLevelIsOpen")--%>
                                    <asp:TemplateField HeaderText="报警电话号码" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                        <%--Bind("Node_VoiceAlarmTel")--%>
                                            <asp:Label ID="label" runat="server" Text='<%#Eval("Node_VoiceAlarmTel").ToString().Length>14?
                                            Eval("Node_VoiceAlarmTel").ToString().Substring(0,14)+" ... ":Eval("Node_VoiceAlarmTel").ToString()%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="报警电话号码" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <HeaderStyle CssClass="ItemStyleNoDisplay" />
                                        <ItemStyle CssClass="ItemStyleNoDisplay" />
                                        <ItemTemplate>
                                        <%--Bind("Node_VoiceAlarmTel")--%>
                                            <asp:Label ID="lbNodeVoiceAlarmTel" runat="server" Text='<%#Bind("Node_VoiceAlarmTel")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="预警是否开启" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbNodeOneLevelIsOpen" runat="server" Text='<%#Eval("Node_OneLevelIsOpen").ToString()=="1"?"是":
                                            (Eval("Node_OneLevelIsOpen").ToString()=="0"?"否":"不确定")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="预警电话号码" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                        <%--Bind("Node_OneLevelVoiceTel")--%>
                                            <asp:Label ID="label3" runat="server" Text='<%#Eval("Node_OneLevelVoiceTel").ToString().Length>14?
                                            Eval("Node_OneLevelVoiceTel").ToString().Substring(0,14)+" ... ":Eval("Node_OneLevelVoiceTel").ToString()%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="预警电话号码" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <HeaderStyle CssClass="ItemStyleNoDisplay" />
                                        <ItemStyle CssClass="ItemStyleNoDisplay" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbNodeOneLevelVoiceTel" runat="server" Text='<%#Bind("Node_OneLevelVoiceTel")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="严重报警是否开启" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbNodeTwoLevelIsOpen" runat="server" Text='<%#Eval("Node_TwoLevelIsOpen").ToString()=="1"?"是":
                                            (Eval("Node_TwoLevelIsOpen").ToString()=="0"?"否":"不确定")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="严重报警电话号码" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                        <%--Bind("Node_TwoLevelVoiceTel")--%>
                                            <asp:Label ID="lab" runat="server" Text='<%#Eval("Node_TwoLevelVoiceTel").ToString().Length>14?
                                            Eval("Node_TwoLevelVoiceTel").ToString().Substring(0,14)+" ... ":Eval("Node_TwoLevelVoiceTel").ToString()%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="严重报警电话号码" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <HeaderStyle CssClass="ItemStyleNoDisplay" />
                                        <ItemStyle CssClass="ItemStyleNoDisplay" />
                                        <ItemTemplate>
                                            <asp:Label ID="lbNodeTwoLevelVoiceTel" runat="server" Text='<%#Bind("Node_TwoLevelVoiceTel")%>'></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="修改" InsertVisible="False" HeaderStyle-Wrap="false">
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="false" />
                                        <ItemTemplate>
                                            <asp:LinkButton ID="Revisebtn" runat="server" CssClass="bt_mod" OnClientClick='Alter(this);return false;'
                                                Font-Size="12px" ToolTip='<%# Bind("Node_No")%>' />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                            </asp:GridView>
                            <div id="EquipPageNation">
                            </div>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
                <div id="ShowInfo">
                    <div class="divShowRoleInfo" style="width: 200px; margin-left: 10px; display: none;">
                        <img src="../../Common/Image/loading.gif" /><span style="margin-left: 10px;">正在加载数据......</span>
                    </div>
                </div>
                <div id="NodePageNation" style="display:none">
                    <table width="100%" class='Grid_General'>
                        <tr>
                            <td align="center">
                                第
                                <asp:Label ID="lblPageIndex" runat="server" />
                                页/ 共
                                <asp:Label ID="lblPageCount" runat="server" />
                                页
                                <asp:LinkButton ID="btn_First" runat="server" CausesValidation="False" CommandArgument="First"
                                    CommandName="Page" Text="首页" OnClientClick="PageNation('First');return false;" />
                                <asp:LinkButton ID="btn_Prev" runat="server" CausesValidation="False" CommandArgument="Prev"
                                    CommandName="Page" Text="上一页" OnClientClick="PageNation('Last');return false;" />
                                <asp:LinkButton ID="btn_Next" runat="server" CausesValidation="False" CommandArgument="Next"
                                    CommandName="Page" Text="下一页" OnClientClick="PageNation('Next');return false;" />
                                <asp:LinkButton ID="btn_Last" runat="server" CausesValidation="False" CommandArgument="Last"
                                    CommandName="Page" Text="尾页" OnClientClick="PageNation('End');return false;" />
                                <asp:TextBox ID="txtNewPageIndex" runat="server" Width="20px" />
                                <asp:LinkButton ID="btn_Go" runat="server" CausesValidation="False" CommandArgument="-1"
                                    CommandName="Page" Text="GO" OnClientClick="PageNation('Search');return false;" />
                            </td>
                        </tr>
                    </table>
                </div>
            </div>
        </div>
    
        <%--弹出--%>
        <div id="MaintenanceDialog" class="easyui-dialog" style="width: 630px; height: auto; display:none"
            data-options="modal:true,closed:true,iconCls:'icon-save',border:'thin',title:'语音报警电话设置'">
            <div id="MaintenanceShow">
                <div class="popall" id="add_jd">
                    <div class="cont" style="width: 80%; min-width: 600px; margin: auto;">
                        <div class="bd">                        
                            <div class="wg_wh_bd">
                                <div class="xianmuvoice">
                                    <div class="t1">
                                        传感器编号:</div>
                                    <div class="t2">
                                        <asp:Label ID="lbNodeNO" runat="server" Text="Label"></asp:Label>
                                    </div>
                                </div>
                                <div class="xianmuvoice">
                                    <div class="t1">
                                        传感器名称:</div>
                                    <div class="t2">
                                        <asp:Label ID="lblNodeName" runat="server" Text="Label"></asp:Label>
                                    </div>
                                </div>
                                <div class="xianmuvoice">
                                    <div class="t1">
                                        所属网关SN:</div>
                                    <div class="t2">
                                        <asp:Label ID="lblEquipNo" runat="server" Text="Label"></asp:Label>
                                    </div>
                                </div>
                            </div>
                            <div class="wg_wh_bd">
                                <div class="xianmuvo">
                                    <div class="t1">
                                        报警是否开启:</div>
                                    <div class="t2">
                                        <asp:Label ID="lblNodeISAlarmForSMS" runat="server" Text="Label"></asp:Label>
                                        <%--<input id="txtNodeISAlarmForSMS" runat="server" type="text" />--%>
                                    </div>
                                </div>
                                <div class="xianmuvo">
                                    <div class="t1">
                                        报警电话号码:</div>
                                    <div class="t2">
                                        <input id="txtNodeVoiceAlarmTel" disabled runat="server" type="text" />
                                    </div>
                                    <div class="t4">
                                        <asp:ImageButton ID="txtNodeAlarmTel" ImageUrl="../../Common/Image/u186.png" Width="25px"
                                        OnClientClick="AddAlarmPhoneNum('0');return false;" runat="server" /></div>
                                </div>
                                
                            </div>
                            <div class="wg_wh_bd">
                                <div class="xianmuvo">
                                    <div class="t1">
                                        预警是否开启:</div>
                                    <div class="t2">
                                        <asp:Label ID="lblNodeOneLevelIsOpen" runat="server" Text="Label"></asp:Label>
                                        <%--<input id="txtNodeOneLevelIsOpen" runat="server" type="text" />--%>
                                    </div>
                                </div>
                                <div class="xianmuvo">
                                    <div class="t1">
                                        预警电话号码:</div>
                                    <div class="t2">
                                        <input id="txtNodeOneLevelVoiceTel" disabled runat="server" type="text" />
                                    </div>
                                    <div class="t4">
                                        <asp:ImageButton ID="txtNode_OneLevelSMSTel" ImageUrl="../../Common/Image/u186.png" Width="25px"
                                        OnClientClick="AddAlarmPhoneNum('1');return false;" runat="server" /></div>
                                </div>
                            </div>
                            <div class="wg_wh_bd">
                                <div class="xianmuvo">
                                    <div class="t1">
                                        严重报警是否开启:</div>
                                    <div class="t2">
                                        <asp:Label ID="lblNodeTwoLevelIsOpen" runat="server" Text="Label"></asp:Label>
                                        <%--<input id="txtNodeTwoLevelIsOpen" runat="server" type="text" />--%>
                                    </div>
                                </div>
                                <div class="xianmuvo">
                                    <div class="t1">
                                        严重报警电话号码:</div>
                                    <div class="t2">
                                        <input id="txtNodeTwoLevelVoiceTel" disabled runat="server" type="text" />
                                    </div>
                                    <div class="t4">
                                        <asp:ImageButton ID="txtNode_TwoLevelSMSTel" ImageUrl="../../Common/Image/u186.png" Width="25px"
                                        OnClientClick="AddAlarmPhoneNum('2');return false;" runat="server" /></div>
                                </div>
                            </div>
                            <div class="add_qybd">
                                <div class="btncc">
                                    <input type="button" value="取消" class="qx" onclick="$('#MaintenanceDialog').dialog('close');return false" />
                                    <input type="button" value="保存" class="bc" onclick="UpdateOrSaveTheMaintenance();return false;" />
                                    <a id="divNodeShowSaving" style="width: 20px; display: none;">
                                        <img src="../../Common/Image/loading.gif" /><span style="margin-left: 10px;"></span>
                                    </a><a id="divNodeShowSaveOK" style="width: 40px; display: none;">
                                        <asp:Label ID="theSaveStateMessage" runat="server" Text="Label"></asp:Label>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <%--添加报警电话--%>
        <div id="AddAlarmPhoneNumDiv" class="easyui-dialog" title="添加报警电话号码" style="text-align: center;
            width: 500px; height: auto; display: none" closed="true" data-options="modal:true,closed:true,iconCls:'icon-save',border:'thin'">
            <div class="shop_content">
                <table id="AddNumTable" style="width: 95%">
                    <tr>
                        <td>
                        </td>
                    </tr>
                </table>
                <div align="center">
                    <a onclick="AddNewRows();return false;" href="#">
                        <img src="../../Common/Image/u186.png" width="20px" /></a></div>
            </div>
            <div style="width: 99%;">
                <div class="add_qybd" style="margin-left: 50px">
                    <div class="btncc">
                        <input id="btnNumAdd" type="button" value="添加" class="qx" onclick="AddAlarmPhoneNumbtn();return false;" />
                        <input id="btnNumCancer" type="button" value="取消" class="bc" onclick="AddAlarmPhoneNumCancel();return false;" />
                    </div>
                </div>
            </div>
        </div>
        </form>
    </body>
    </html>
    

    CS后台

    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using BLL;
    using System.Data;
    using System.Text;
    using BasicItem;
    
    namespace THMS.page.SuperOption
    {
        public partial class VoicePhoneSettings : MyBasePage
        {
            BLL.VoicePhoneSettings.VoicePhoneSettingsBLL QueryNodeInfo = new BLL.VoicePhoneSettings.VoicePhoneSettingsBLL();
            public override void VerifyRenderingInServerForm(Control control)
            {
            }
    
            protected void Page_Load(object sender, EventArgs e)
            {
                if (Request["Action"] != null)
                {
                    string returnMsg = string.Empty;
                    StringBuilder returngvwMsg = new StringBuilder();
                    switch (Request["Action"])
                    {
                        case "Query":
                            returnMsg = Query(
                                Request["NodeNO"].ToString(), 
                                Request["NodeName"].ToString(), 
                                Request["EquipNO"].ToString(), 
                                Request["EquipName"].ToString(), 
                                Request["NodeVoiceAlarmTel"].ToString(),
                                Request["CompanyName"].ToString(),
                                Request["HasItSet"].ToString(), Int16.Parse(Request["PageSize"].ToString()), Int16.Parse(Request["PageIndex"].ToString()));
                            Response.Write(returnMsg);
                            break;
                        case "Update":
                            returnMsg = Update(
                                Request["NodeNo"].ToString(),
                                Request["NodeVoiceAlarmTel"].ToString(),
                                Request["NodeOneLevelVoiceTel"].ToString(),
                                Request["NodeTwoLevelVoiceTel"].ToString());
                            Response.Write(returnMsg);
                            break;
                        case "NodePageNation":
                            returnMsg = GridviewPagenation(Convert.ToInt32(Request["PageIndex"].ToString()), Convert.ToInt32(Request["PageSize"].ToString()));
                            Response.Write(returnMsg);
                            break;
    
                    }
                    Response.ContentType = "text/xml";
                    Response.Expires = 0;
                    Response.Flush();
                    Response.End();
                }
            }
    
            protected string Query(string NodeNO, string NodeName, string EquipNO, string EquipName, string NodeVoiceAlarmTel, string CompanyName, string HasItSet, int PageSize, int PageIndex)
            {
                DataTable NodeInfods = new DataTable();
                
                NodeInfods = QueryNodeInfo.QueryNodeInfo(NodeNO, NodeName, EquipNO, EquipName,NodeVoiceAlarmTel, CompanyName, HasItSet);
                CacheDataHelper.AddCacheData(Request.Cookies["ASP.NET_SessionId"].Value, System.IO.Path.GetFileName(Request.Path).ToString() + "NodeInfods", NodeInfods);
    
                if (NodeInfods == null || NodeInfods.Rows.Count < 1)
                    return "Empty";
                int PageNum = NodeInfods.Rows.Count;//所有行数
    
                DataTable ds = new DataTable();
                ds = NodeInfods.Clone();
                DataRow[] dr = NodeInfods.Select();
                int AllPageNum = PageNum / PageSize + (PageNum % PageSize > 0 ? 1 : 0);
                if (AllPageNum > 0)
                {
                    if (PageIndex != AllPageNum)
                    {
                        for (int i = (PageIndex - 1) * 10, j = 0; i < (PageIndex - 1) * 10 + PageSize; i++, j++)
                        {
                            ds.Rows.Add(NodeInfods.Rows[i].ItemArray);
                        }
                    }
                    else
                    {
                        for (int i = (PageIndex - 1) * 10, j = 0; i < PageNum; i++, j++)
                        {
                            ds.Rows.Add(NodeInfods.Rows[i].ItemArray);
                        }
                    }
                }
                this.VoicePhoneGDV.DataSource = null;
                this.VoicePhoneGDV.DataSource = ds;
                this.VoicePhoneGDV.DataBind();
                return PagingMethod.RenderGridView(VoicePhoneGDV) + "|" + AllPageNum.ToString();
            }
    
            protected string Update(string NodeNo,  string NodeVoiceAlarmTel,
                 string NodeOneLevelVoiceTel, 
                string NodeTwoLevelVoiceTel)
            {
    
                return QueryNodeInfo.UpdateEdit(NodeNo, NodeVoiceAlarmTel,
                    NodeOneLevelVoiceTel, NodeTwoLevelVoiceTel) ? "设置成功" : "设置失败";
            }
    
            protected string GridviewPagenation(int PageIndex, int PageSize)   //分页
            {
                DataTable dt = new DataTable();
                DataTable NodeInfods = CacheDataHelper.GetDataTable(Request.Cookies["ASP.NET_SessionId"].Value, System.IO.Path.GetFileName(Request.Path).ToString() + "NodeInfods");
    
                if (NodeInfods == null)
                    return "Empty";
                dt = NodeInfods.Clone();
                DataRow[] dr = NodeInfods.Select();
                int GridAllItem = NodeInfods.Rows.Count;//所有行数
    
                int AllPageNum = GridAllItem / PageSize + (GridAllItem % PageSize > 0 ? 1 : 0);
                if (AllPageNum > 0)
                {
                    if (PageIndex != AllPageNum)
                    {
                        for (int i = (PageIndex - 1) * PageSize, j = 0; i < (PageIndex - 1) * PageSize + PageSize; i++, j++)
                        {
                            dt.Rows.Add(NodeInfods.Rows[i].ItemArray);
                        }
                    }
                    else
                    {
                        for (int i = (PageIndex - 1) * PageSize, j = 0; i < GridAllItem; i++, j++)
                        {
                            dt.Rows.Add(NodeInfods.Rows[i].ItemArray);
                        }
                    }
                }
                this.VoicePhoneGDV.DataSource = null;
                this.VoicePhoneGDV.DataSource = dt;
                this.VoicePhoneGDV.DataBind();
                return PagingMethod.RenderGridView(VoicePhoneGDV);
            }
        }
    }
    

    BLL

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using DBUtility;
    using System.Data;
    using MenuUtility;
    using Entities;
    using DAL;
    using BasicItem;
    
    namespace BLL.VoicePhoneSettings
    {
        public class VoicePhoneSettingsBLL
        {
    
            public DataTable QueryNodeInfo(string NodeNO, string NodeName, string EquipNO, string EquipName, string NodeVoiceAlarmTel,string CompanyName,string HasItSet)
            {
                VoicePhoneSettingsDAL VoicePhoneDAL = new VoicePhoneSettingsDAL();
                User_Info user = LoginHandler.CurrentUser;
                if (user.Company_ID == 0)
                {
                    return VoicePhoneDAL.QueryNodeInfoOfSensorSettings(user.User_ID.ToString(), "0", NodeNO, NodeName, EquipNO, EquipName, NodeVoiceAlarmTel, CompanyName, HasItSet);
                }
                else
                {
                    return VoicePhoneDAL.QueryNodeInfoOfSensorSettings(user.User_ID.ToString(), Role_InfoDAL.GetAllEneterIdsByCompanyID(user.Company_ID.ToString()), NodeNO, NodeName, EquipNO, EquipName, NodeVoiceAlarmTel, CompanyName, HasItSet);
                }
            }
            //修改
            public bool UpdateEdit(string NodeNo, string NodeVoiceAlarmTel,
                 string NodeOneLevelVoiceTel, 
                string NodeTwoLevelVoiceTel)
            {
                VoicePhoneSettingsDAL VoicePhoneDAL = new VoicePhoneSettingsDAL();
                return VoicePhoneDAL.UpdateEdit(NodeNo,  NodeVoiceAlarmTel,
                    NodeOneLevelVoiceTel, NodeTwoLevelVoiceTel);
            }
        }
    }
    

    DAL

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using DBUtility;
    using System.Data;
    using System.Data.SqlClient;
    using BasicItem;
    
    namespace DAL
    {
        public class VoicePhoneSettingsDAL
        {
    
            public bool UpdateEdit(string NodeNo,  string NodeVoiceAlarmTel,
                 string NodeOneLevelVoiceTel, 
                string NodeTwoLevelVoiceTel)
            {
                string sql = "update Node_Info set Node_VoiceAlarmTel='" + NodeVoiceAlarmTel + "', Node_OneLevelVoiceTel='" + NodeOneLevelVoiceTel + "',Node_TwoLevelVoiceTel='" + NodeTwoLevelVoiceTel + "' where Node_No='" + NodeNo + "'";
                return DBCommon.ExecuteNonQuery(sql);
            }
    
            public DataTable QueryNodeInfoOfSensorSettings(string strUserId, string strNodeIDs, string NodeNO, string NodeName, string EquipNO, string EquipName,string NodeVoiceAlarmTel,string CompanyName,string HasItSet)
            {
    
                try
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(" select a.Node_No,a.Node_Name,b.Equip_No,b.Equip_Name,a.Node_ISAlarmForSMS,a.Node_VoiceAlarmTel,a.Node_OneLevelIsOpen,a.Node_OneLevelVoiceTel,a.Node_TwoLevelIsOpen,a.Node_TwoLevelVoiceTel");
                    sb.Append("  from Node_Info a left join Equip_Info b on a.Node_EquipID=b.Equip_ID left join Company_Info c on b.Equip_CompanyID=c.Company_ID ");
                    sb.Append(" where 1=1 ");
                    if (NodeName != "")
                        sb.Append(" and a.Node_Name like '%" + NodeName + "%'");
                    if (NodeNO != "")
                        sb.Append(" and a.Node_No like '%" + NodeNO + "%'");
                    if (EquipName != "")
                        sb.Append(" and b.Equip_Name like '%" + EquipName + "%'");
                    if (EquipNO != "")
                        sb.Append(" and b.Equip_No like '%" + EquipNO + "%'");
                    if (NodeVoiceAlarmTel != "")
                        sb.Append(" and a.Node_VoiceAlarmTel like '%" + NodeVoiceAlarmTel + "%'");
                    if (HasItSet != "")
                        sb.Append(" and a.Node_ISAlarmForSMS like '%" + HasItSet + "%'");
                    if (CompanyName != "")
                        sb.Append(" and c.Company_Name like '%" + CompanyName + "%'");
                    if (Role_InfoDAL.ExitSupper(strUserId))
                    {
                    }
                    else if (Role_InfoDAL.ExitBusiness(strUserId) || Role_InfoDAL.ExitMaintenance(strUserId))
                    {
                        //string strUserIDsandCompanyIDs = User_InfoDAL.GetUserIDAndCompanyIDForBOMByUserID(strUserId);
                        //if (strUserIDsandCompanyIDs != "")
                        //{
                        //    string[] UserIDandCompanyIDs = strUserIDsandCompanyIDs.Split('|');
                        //    sb.Append("  and  a.Company_ID in ('" + UserIDandCompanyIDs[1] + "') ");
                        //}
                        //else return null;
                    }
                    else
                    {
                        if (strNodeIDs == "0")
                        {
                            DataTable ds = new DataTable();
                            return ds;
                        }
                        else
                        {
                            sb.Append(" and b.Equip_CompanyID in ('" + strNodeIDs + "')");
                        }
                    }
                    sb.Append("  order by b.Equip_No desc");
                    return DBCommon.GetDataTable(sb.ToString());
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(ex.Message);
                }
            }
    
        }
    }
    
    

    相关文章

      网友评论

          本文标题:2018-12-27添加多个手机号码VoiceAlarmSett

          本文链接:https://www.haomeiwen.com/subject/kearlqtx.html