<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="smsTypeList.aspx.cs" Inherits="HySoft.BaseCallCenter.Web.smsmanage.smsTypeList" %>

<!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 runat="server">
    <title>短信类型列表</title>
    <link href="../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../scripts/ui/json2.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/core/base.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/Tab/css/tab.css" rel="stylesheet" type="text/css" />
    <link href="../scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
    <script src="../scripts/ui/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerLayout.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerTree.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerMenu.js" type="text/javascript"></script>
    <script src="../scripts/CustomersData.js" type="text/javascript"></script>
    <link href="../scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <link href="../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var gridlist;
        var singleClick;
        $(function () {
            //获取短信类型列表
            LoadList();
        });
        function LoadList() {
            gridlist = $("#divTypeList").ligerGrid({
                height: '99%',
                checkbox: true,
                columns: [
                { display: '类型编号', name: '_modelid', minWidth: 60, hide: "false" },
                { display: '短信类型', name: '_name', minWidth: 60 },
                { display: '信息模板', name: '_contents', minWidth: 60 },
                { display: '添加人员', name: '_addpeople', minWidth: 110 },
                { display: '添加时间', name: '_addtime', type: 'date', format: 'yyyy-MM-dd hh:mm:ss' },
                { display: '备注', name: '_remark', minWidth: 140 }
                ],
                url: '../smsmanage/ajax/smsTypeListAjax.ashx?action=getTypeList', pageSize: 10, rownumbers: true,

                onSelectRow: function (data, rowindex, rowobj) {
                    singleClick = data._modelid;
                },
                onDblClickRow: function (data, rowindex, rowobj) {
                    showsmstype();
                }
            });
            gridlist.changePage('first');
            $("#pageloading").hide();
        }


        function showsmstype() {
            if (singleClick == "" || singleClick == undefined) {
                alert("请选择查看短息类型！");
            } else {
                $.ligerDialog.open({ url: 'smsTypeEdit.aspx?action=Modify&id=' + singleClick, title: '查看短信类型详情', height: 300, width: 380, isResize: true
                });
            }

        }

        function Delete() {
            try {
                //获取选择的行
                var rows = gridlist.getSelectedRows();
                if (rows.length > 0) {
                    $.ligerDialog.confirm('确定要批量删除选择的记录吗？', function (yes) {
                        if (yes) {
                            try {
                                var arr = new Array();
                                var i = 0;
                                for (var i = 0; i < rows.length; i++) {
                                    arr[i] = rows[i]._modelid;
                                }
                                $.post("../smsmanage/ajax/smsTypeListAjax.ashx?action=delete&arrid=" + arr.toString(), function (data) {
                                    if (data == "success") {
                                        $.ligerDialog.success('删除成功');
                                        LoadList();
                                    }
                                    else {
                                        $.ligerDialog.error('删除失败');
                                    }
                                });
                            }
                            catch (e) {
                                alert(e.Message);
                            }
                        }
                        else {
                        }
                    });
                }
                else {
                    $.ligerDialog.error('没有选择要删除的参数');
                }
            }
            catch (e) {
                $.ligerDialog.error(e.Message);
            }
        }
        function Edit() {
            var rows = gridlist.getSelectedRows();
            if (rows.length <= 0) {
                $.ligerDialog.error("请选择修改行！");
            } else {
                $.ligerDialog.open({ url: 'smsTypeEdit.aspx?action=Modify&id=' + singleClick, title: '修改短信类型', height: 300, width: 380, isResize: true
                });
            }
        }
        function AddType() {
            $.ligerDialog.open({ url: 'smsTypeEdit.aspx?action=Add', title: '添加短信类型', height: 300, width: 380, isResize: true });
        }

        document.onkeydown = function (event) {
            var e = event || window.event || arguments.callee.caller.arguments[0];
            if (e && e.keyCode == 13) {
                LoadList();
            }
        };
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="tools_box">
        <div class="tools_bar">
            <a class="tools_btn" href="#" onclick="Delete();"><span><b class="delete">批量删除</b></span>
            </a><a class="tools_btn" href="#" onclick="Edit();"><span><b class="modify">修改</b></span>
            </a><a class="tools_btn" href="#" onclick="AddType();"><span><b class="add">添加</b></span>
            </a>
        </div>
    </div>
    <div id="layout1">
        <div title="短信类型列表">
            <div id="divTypeList">
            </div>
        </div>
    </div>
    </form>
</body>
</html>
