<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true" CodeBehind="MessageConfig.aspx.cs" Inherits="Portal.Admin.MessageConfig" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
   

 <div class="result-wrap">

      <div class="result-title">
                <h1>留言类别</h1>
     </div>

  
  

 
  <table class="insert-tab" width="100%">
   <tr>
   <th width=150px>新建类别：
   </th>
    <td>
    <asp:TextBox ID="catname" runat="server" CssClass="form-control"  width="390"></asp:TextBox>
   
      </td>
    </tr>


       <tr>
       <th>类别顺序:：
         </th>
       <td>
      <asp:TextBox ID="txt_orderid" Text="0" CssClass="form-control"  width="390" runat="server"></asp:TextBox>
      
      </td>
    </tr>       
              
                                           
     
     
       <tr>
       <th >邮件通知：
         </th>
       <td>
     <asp:TextBox ID="txt_sendto" Text="" CssClass="form-control"  width="390" runat="server"></asp:TextBox>       <a href="#"><span id="span_help"><i class="icon-font">&#xe023;</i>说明</span></a>
      </td>
    </tr>       
                
              
       <tr>
       <th >留言是否需要审核：
         </th>
       <td>
   <asp:CheckBox runat="server" ID="cb_needaudit" /> 
            </a>
      </td>
    </tr>                            
          
                                     
          <tr>
  <td colspan="2">
  
  <div class="btnc">

  
     <asp:Button ID="Button1" runat="server" Text="添加" onclick="Button1_Click"   CssClass="btn btn-primary"/>

    <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="返回" CssClass="btn"/>
    

  
  </div>
  </td>
  </tr>
  </table>
                             
                                        
                              


 
 












  



  
   
        <asp:GridView ID="GridView1"
         AutoGenerateColumns="false" 
          DataKeyNames="id" runat="server" DataSourceID="ds_msg"  GridLines="None"  CssClass="table" >
        <Columns>

            <asp:BoundField DataField="ID"   HeaderText="ID" ItemStyle-Width="80px"/>
           <asp:BoundField DataField="catname"   HeaderText="类名名称" ItemStyle-Width="300px"/>
            <asp:BoundField DataField="sendto"   HeaderText="邮件通知"  />
            <asp:BoundField DataField="orderid"   HeaderText="顺序ID" ItemStyle-Width="80px"/>

            <asp:TemplateField>
                <HeaderStyle  Width="70px"/>
                <HeaderTemplate>是否审核</HeaderTemplate>
                <ItemTemplate>
                    <%# Eval("needaudit").ToString()=="1"?"<img src=images/onCorrect.gif >":"" %>

                </ItemTemplate>

                <EditItemTemplate>
                    <asp:RadioButtonList runat="server" ID="rbl_needaudit" RepeatDirection="Horizontal" RepeatLayout="Flow"
                         SelectedValue='<%#Bind("needaudit") %>'
                         RepeatColumns="2">
                        <asp:ListItem Text="是" Value="1"></asp:ListItem>
                         <asp:ListItem Text="否" Value="0"></asp:ListItem>
                    </asp:RadioButtonList>

                </EditItemTemplate>

            </asp:TemplateField>
       <asp:CommandField ItemStyle-Width="150px" HeaderText="操作" EditText="编辑" DeleteText="<span onclick=&quot;JavaScript:return confirm('确定删除吗？')&quot;>删除</span> "  UpdateText="更新"  CancelText="取消" ShowDeleteButton="True" ShowEditButton="True" />

        
        </Columns>
        
    

        </asp:GridView>
    
    
    <asp:SqlDataSource runat="server"
         ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
          ID="ds_msg" 
        DeleteCommand="DELETE FROM [portal_messagecat] WHERE [id] = @id" 
        InsertCommand="INSERT INTO [portal_messagecat] ([catname], [sendto], [orderid]) VALUES (@catname, @sendto, @orderid)" 
  
        SelectCommand="SELECT [id], needaudit,[catname], [sendto], [orderid] FROM [portal_messagecat] ORDER BY [orderid]" 
        UpdateCommand="UPDATE [portal_messagecat] SET needaudit=@needaudit, [catname] = @catname, [sendto] = @sendto, [orderid] = @orderid WHERE [id] = @id">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="catname" Type="String" />
            <asp:Parameter Name="sendto" Type="String" />
            <asp:Parameter Name="orderid" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="catname" Type="String" />
            <asp:Parameter Name="sendto" Type="String" />
            <asp:Parameter Name="orderid" Type="Int32" />
              <asp:Parameter Name="needaudit" Type="String" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>

   


 


      
 
      
</div>





<script>
    $('#span_help').on('click', function () {
        layer.tips('在启用邮件通知的情况下，可以在此处填写邮件地址，当用户有留言时，会通知收件人', this, { time: 5,
            style: ['background-color:#0FA6D8; color:#fff', '#0FA6D8'],
            maxWidth: 450
        });
    });
     
     
     </script>
</asp:Content>
