<%@ Page Title="Setting Email" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="email.aspx.cs" Inherits="edicenter.email" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
      <br /><br /><br /><br />
 <div class="container-fluid">
        <div class="row row-offcanvas row-offcanvas-right">

        <div class="col-xs-12 col-sm-12">
    <div class="row">

         <div class="panel panel-primary">
      <div class="panel-heading">&nbsp&nbsp Setting Email - Vender&nbsp&nbsp&nbsp&nbsp&nbsp[<%= Session["ULogin"].ToString().Trim() %>]</div>
      <div class="panel-body">
           &nbsp&nbsp&nbsp;&nbsp;
           <asp:Label ID="lblVenderID" runat="server" Text="Vender:"></asp:Label>
           <asp:TextBox ID="txtVender" runat="server" ReadOnly = "false" Width="150px"></asp:TextBox>&nbsp&nbsp  
           <asp:Label ID="lblMailx" runat="server" Text="Mail:"></asp:Label>
           <asp:TextBox ID="txtMail" runat="server" ReadOnly = "false" Width="150px"></asp:TextBox>&nbsp&nbsp  
           <asp:Button ID="btnSearch" runat="server" Text="Search" width="100px" OnClick="btnSearch_Click" />&nbsp&nbsp&nbsp 
           <asp:Button ID="btnSearchAll" runat="server" Text="Search All" Width="120px" CssClass="btn-primary" Font-Bold="true" OnClick="btnSearchAll_Click" />
           <br /><br />
           &nbsp&nbsp
           <asp:Label ID="lblAdd" runat="server" Text="Add mail:"></asp:Label>
           <asp:TextBox ID="txtAddmail" runat="server" ReadOnly = "false" Width="150px"></asp:TextBox>&nbsp&nbsp  
           <asp:Button ID="btnAdd" runat="server" Text="Add" width="100px" OnClick="btnAdd_Click" />&nbsp&nbsp&nbsp
           <br /><br />
           <asp:Label ID="lblResultSearch" runat="server" Text="" Font-Bold="true"></asp:Label>&nbsp&nbsp&nbsp&nbsp  
           <asp:Button ID="btnExcel" runat="server" Text="Excel Export" width="130px" OnClick="btnExcel_Click" />&nbsp&nbsp 
           <br />               
&nbsp;<asp:Repeater id="myRepeater" runat="server">
	<HeaderTemplate>
<table class="table table-bordered">
<tr style="background-color:#fa7b16; color:black; font-weight:bold;height:35px;" align="Left">
                <td>No.</td>
                <td>Vender ID.</td>
                <td>Email</td>
                <td width="20%">Edit Email</td>
                <td width="10%">Update Email</td>
                <td width="10%">Delete Email</td>
                </tr>           	
   </HeaderTemplate>             
	<ItemTemplate>    
			 <tr style="background-color:#FFFFFF; color:black; height:35px;" align="left">
             <td><asp:Label id="Label2" runat="server" Text='<%# myRepeater.Items.Count + 1 %>'></asp:Label></td>             
             <td><asp:Label id="Label1" runat="server" Text='<%# Text_CheckColumn(1,Container.DataItem) %>'></asp:Label></td>
             <td><asp:Label id="Label8" runat="server" Text='<%# Text_CheckColumn(2,Container.DataItem) %>'></asp:Label></td>
             <td><input id="txtTime_<%# Text_CheckColumn(0,Container.DataItem) %>" type="text" value='<%# Value_TxtMail(Container.DataItem) %>' style="width:220px"/></td> 
             <td><input id="btnMo_<%# Text_CheckColumn(0,Container.DataItem) %>" type="button" value="Update" onclick="modify_click(<%# ID_indexes(Container.DataItem) %>)" class="btn-block" /></td>          
             <td><input id="btnCF_<%# Text_CheckColumn(0,Container.DataItem) %>" type="button" value="Delete" onclick="delete_click(<%# ID_indexes(Container.DataItem) %>)" class="btn-block" /></td>                                                                                                
	         </tr>
   </ItemTemplate>
    
        <AlternatingItemTemplate>          
			 <tr style="background-color:#20B2AA; color:black; height:35px;" align="left">
             <td><asp:Label id="Label2" runat="server" Text='<%# myRepeater.Items.Count + 1 %>'></asp:Label></td>    
             <td><asp:Label id="Label3" runat="server" Text='<%# Text_CheckColumn(1,Container.DataItem) %>'></asp:Label></td>        
             <td><asp:Label id="Label7" runat="server" Text='<%# Text_CheckColumn(2,Container.DataItem) %>'></asp:Label></td>    
             <td><input id="txtTime_<%# Text_CheckColumn(0,Container.DataItem) %>" type="text" value='<%# Value_TxtMail(Container.DataItem) %>' style="width:220px"/></td>
             <td><input id="btnMo_<%# Text_CheckColumn(0,Container.DataItem) %>" type="button" value="Update" onclick="modify_click(<%# ID_indexes(Container.DataItem) %>)" class="btn-block" style="color:black"/></td>                          
             <td><input id="btnCF_<%# Text_CheckColumn(0,Container.DataItem) %>" type="button" value="Delete" onclick="delete_click(<%# ID_indexes(Container.DataItem) %>)" class="btn-block" style="color:black"/></td>       
			 </tr>		           
	</AlternatingItemTemplate> 

	</asp:Repeater> </table>
               <br />
        
      </div>
    </div>
                
      </div>
            </div>

         </div>

       <script src="css/js/jquery.min.js"></script>
       <script src="css/js/bootstrap.min.js"></script>
       <script type="text/javascript">
           function modify_click(id)
           {
               var txtMail = document.getElementById("txtTime_"+id).value;
               if(txtMail=="")
               {
                   alert("โปรดใส่อีเมลล์แอดเดรสที่ช่อง Edit mail");
               }
               else
               {
                   var confirm_value = document.createElement("INPUT");
                   confirm_value.type = "hidden";
                   confirm_value.name = "confirm_value";
                   if (confirm("Press Button Yes to Update?")) 
                   {
                       confirm_value.value = "Yes";
                       //$.post("email_update.aspx",{id:id});
                       //window.location.reload();   
                       window.open("email_update.aspx?DC="+id+"?"+txtMail+"","_self");
                   } 
                   else 
                       confirm_value.value = "No";
                   //window.open("email_update.aspx?DC="+id+"")
               }
           }
           function delete_click(id)
           {
               var txtMail = document.getElementById("txtTime_"+id).value;
               if(txtMail=="")
               {
                   alert("โปรดใส่อีเมลล์แอดเดรสที่ช่อง Edit mail");
               }
               else
               {
                   var confirm_value = document.createElement("INPUT");
                   confirm_value.type = "hidden";
                   confirm_value.name = "confirm_value";
                   if (confirm("Press Button Yes to Delete?")) 
                   {
                       confirm_value.value = "Yes";
                       //$.post("email_update.aspx",{id:id});
                       //window.location.reload();   
                       window.open("email_delete.aspx?DC="+id+"?"+txtMail+"","_self");
                   } 
                   else 
                       confirm_value.value = "No";
                   //window.open("email_update.aspx?DC="+id+"")
               }
           }
       </script>
    </div>
</asp:Content>
