<%@ Page Language="C#" MasterPageFile="Main.Master" AutoEventWireup="true" CodeFile="DataSources.aspx.cs" Inherits="eFrameWork.Manage.DataSources" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="nav">您当前位置：<a href="Default.aspx">首页</a> -> 数据源<a id="btn_add" style="float:right;margin-top:4px;<%=(act == "" ? "" : "display:none;" )%>" class="button" href="<%=edt.getAddURL()%>"><span><i class="add">添加</i></span></a></div>
<%
    if (act == "add" || act == "edit" || act == "copy")
{
%>
<script>
    function tryconn()
    {
        var type = $("#f2").val();
        if (type.length == 0) {
            layer.msg("请选择连接类型!");
            return;
        }
        var connstr = $("#f3").val();
        if (connstr.length == 0)
        {
            layer.msg("请输入连接字符串!");
            return;
        }
        var url = "?act=tryconn";
        //layer.msg("连接成功!");
        $.ajax({
            type: "POST", async: false,
            data: { type: type, value: connstr },
            url: url,
            dataType: "json",
            success: function (data) {
                layer.msg(data.message);
            }
        });

    };
</script>
<div style="margin:6px;">
    <asp:PlaceHolder ID="eFormControlGroup" runat="server">
	<form name="frmaddoredit" id="frmaddoredit" method="post" action="<%=edt.getSaveURL()%>">
	<input name="id" type="hidden" id="id" value="<%=edt.ID%>">
    <input name="act" type="hidden" id="act" value="save">  
	<input name="fromurl" type="hidden" id="fromurl" value="<%=edt.FromURL%>">  
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="eDataView">

      <tr>
        <td width="126" class="title"><ins>*</ins>名称：</td>
        <td class="content"><span class="eform">
		 <ev:eFormControl ID="f1" Field="MC" width="600" notnull="true" fieldname="名称" runat="server" />
		</span></td>
      </tr>
	 
        <tr>
          <td class="title"><ins>*</ins>连接类型：</td>
          <td class="content"><span class="eform">
		  <ev:eFormControl ID="f2" ControlType="select" Field="ProviderName" notnull="true" Options="[{text:System.Data.SqlClient,value:System.Data.SqlClient},{text:System.Data.OleDb,value:System.Data.OleDb},{text:MySql.Data.MySqlClient,value:MySql.Data.MySqlClient}]" runat="server" /> 
		  </span></td>
        </tr>
       
         <tr>
          <td class="title"><ins>*</ins>连接字符串：</td>
          <td class="content"><span class="eform">
		  <ev:eFormControl ID="f3" ControlType="text" width="600" notnull="true" Field="ConnectionString" DefaultValue="Data Source=;Initial Catalog=;User Id=;Password=;" runat="server" /></span>
              <a class="button" href="javascript:;" onclick="tryconn();"><span><i>测试</i></span></a>
          </td>
        </tr>    

  		<tr>
          <td class="title">说明：</td>
          <td class="content"><span class="eform">
		   <ev:eFormControl ID="f4" ControlType="textarea" Field="BZ" width="600" height="60" runat="server" />
		   </span></td>
        </tr>
        <tr>
       <td colspan="2" class="title"  style="text-align:left;padding-left:100px;padding-top:10px;padding-bottom:10px;">		
		<a class="button" href="javascript:;" onclick="if(frmaddoredit.onsubmit()!=false){frmaddoredit.submit();}" style="display:none;"><span><i class="save">保存</i></span></a>
		<a class="button" href="javascript:;" onclick="ajaxSubmit(frmaddoredit);"><span><i class="save">保存</i></span></a>
		<a class="button" href="javascript:;" style="margin-left:30px;" onclick="history.back();"><span><i class="back">返回</i></span></a>
		</td>
	   </tr>
	 
    </table>
	 </form>
</asp:PlaceHolder>
	 </div>
<%}%>
<div style="margin:6px;overflow-x:auto;overflow-y:hidden;">
<asp:Repeater id="Rep" runat="server">
<headertemplate>
<table id="eDataTable" class="eDataTable" border="0" cellpadding="0" cellspacing="1" width="100%">
<thead>
<tr bgcolor="#f2f2f2">
<td width="80">序号</td>
<td>名称</td>
<td>说明</td>
<td width="150">添加时间</td>
<td width="120">操作</td>
</tr>
</thead>
</headertemplate>
<itemtemplate>
<tr<%# ((Container.ItemIndex+1) % 2 == 0 ? " class=\"alternating\" eclass=\"alternating\"" : " eclass=\"\"") %>>
<td height="32"><%# (Container.ItemIndex + 1)%></td>
<td><%# Eval("MC")%></td>
<td><%# Eval("BZ").ToString()%></td>
<td><%# Eval("addTime","{0:yyyy-MM-dd HH:mm:ss}") %></td>
<td>
<a href="?act=edit&id=<%#  Eval("DataSourceID").ToString()%>">修改</a>
<a href="?act=del&id=<%#  Eval("DataSourceID").ToString()%>" onclick="javascript:return confirm('确认要删除吗？');">删除</a>
</td>
</tr>
</itemtemplate>
<footertemplate></table></footertemplate>
</asp:Repeater>
</div>
<div style="margin:6px;"><ev:ePageControl ID="ePageControl1" PageSize="20" PageNum="9" runat="server" /></div>
</asp:Content>
