<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/AppMaster.Master"
    Inherits="System.Web.Mvc.ViewPage<QMAPP.Web.Models.Sys.NoticeInfoModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    公告信息列表
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%=Html.QPSeach(80,true) %>
    <table id="condiTable">
        <tr>
            <th>
                <%=Html.QV(p=>p.NOTICETITLE) %>
            </th>
            <td>
                <%=Html.QC(p => p.NOTICETITLE)%>
            </td>
            <th>
                通知日期 
            </th>
            <td>
                <%=Html.QC(p => p.USETIMESTART)%>
            </td>
            <th>
                ~
            </th>
            <td>
                <%=Html.QC(p => p.USETIMEEND)%>
            </td>
        </tr>
    </table>
    <div style="left: 1px; position: relative;"></div>
    
    <%=Html.QPEnd()%>
    <%=Html.QPList() %>
    <%=Html.QDateGrid<QMAPP.Web.Models.Sys.NoticeInfoModel>(Model)%>
    <%=Html.QPEnd() %>
    <%=Html.Hidden("selectKey")%>
    <script language="javascript" type="text/javascript">
        function Search() {
            //判断通知日期的结束时间不能早于开始时间 
            var UsetimeStart=document.getElementById("USETIMESTART").value;
            var UsetimeEnd = document.getElementById("USETIMEEND").value;
            if (UsetimeStart != "" && UsetimeEnd != "") {
                if (UsetimeStart > UsetimeEnd) {
                    MSI("提示", "通知日期的结束时间不能早于开始时间");
                    return;
                }
            }
            List(1);
        }

        //增加公告
        function Insert() {
            openAppWindow1('添加通知', '/Notice/NoticeEdit', '700', '480');
        }

        //修改公告
        function Update() {
            var ids = getSelectKey();
            if (ids == "") {
                MSI("提示", "请选择修改记录。");
                return;
            }
            if (ids.indexOf(":") > 0) {
                MSI("提示", "每次只能修改一条记录。");
                return;
            }
            openAppWindow1('修改通知', 'NoticeEdit?noticeID=' + ids, '700', '480');
        }
        //删除公告
        function Delete() {
            var ids = getSelectKey();

            if (ids == "") {
                MSI("错误", "至少选择一条记录。");
            }
            else {
                document.getElementById("selectKey").value = ids;
                MSQ("提示", "确定要删除选中的记录吗?", function () {
                    submitByButton("NoticeDelete");
                })
            }
        } 

        //回复公告
        function ReplyNotice() {
            var ids = getSelectKey();
            if (ids == "") {
                MSI("提示", "请选择回复通知。");
                return;
            }
            if (ids.indexOf(":") > 0) {
                MSI("提示", "每次只能回复一条通知。");
                return;
            }

            //window.open("/Notice/NoticeBrowseList?NoticeID=" + ids);
            openAppWindow1('查看', 'ReplyNotice?noticeID=' + ids, '600', '480');
        }

        //查看公告
        function ClickNotice() {
            var ids = getSelectKey();
            if (ids == "") {
                MSI("提示", "请选择查看通知。");
                return;
            }
            if (ids.indexOf(":") > 0) {
                MSI("提示", "每次只能查看一条通知。");
                return;
            }
            openAppWindow1('查看', 'ViewNotice?noticeID=' + ids, '700', '480');
        }

        //查看公告
        function ClickGridCell(rowIndex, field, value) {
            $('#QDateGrid').datagrid('clearSelections');
            if (field == "NOTICETITLE") {
                rows = $('#QDateGrid').datagrid('getRows');
                var id = rows[rowIndex].NOTICEID;
                openAppWindow1('查看', 'ViewNoticeBrowse?noticeID=' + id, '700', '480');
            }
        }

        //导出
        function Export() {
            var ids = getSelectKey();
            submitByButton("ExportExcel?ids=" + ids);
        }
    </script>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ToolContent" runat="server">
    <table id="EditTable" cellpadding="0" cellspacing="0">
        <tr>
            <td>
                <%=Html.QTButtonSearch("Notice", "List", "Search()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButtonAdd("Notice", "Add", "Insert();", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButtonUpdate("Notice", "Edit", "Update()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButtonDelete("Notice", "Delete", "Delete()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButton("showDetail", "View", QMFrameWork.WebUI.IconCls.detail, "ClickNotice()", QMAPP.Common.Web.SystemLimit.isLimt)%>
                <%=Html.QTButton("export", "ExportExcel", QMFrameWork.WebUI.IconCls.redo, "Export()", QMAPP.Common.Web.SystemLimit.isLimt)%> 
            </td>
        </tr>
    </table>
</asp:Content>