<%@ page language="C#" autoeventwireup="true" inherits="admin_label_datasource, DianCMS" enableviewstatemac="false" enableEventValidation="false" viewStateEncryptionMode="Never" %>
<%@ Import Namespace="D.BLL" %>
<%@ Import Namespace="D.Common" %>
<!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 id="CssName" rel="stylesheet" type="text/css" runat="server" />
    <script src="../../js/Common.js" type="text/javascript"></script>
    <script src="../../js/<%=B_Lang.getLang() %>/Alert.js" language="javascript"></script>
    <script type="text/javascript" src="../../js/<%=B_Lang.getLang() %>/datasource.js"></script>
    <script src="../../js/lhgdialog/lhgcore.lhgdialog.min.js?self=true&skin=<%=Function.GetCssNameColor()%>" type="text/javascript"></script>
</head>
<body oncontextmenu="window.event.returnValue=false">
    <form id="form1" runat="server">
    <table class="dh" cellpadding="0" cellspacing="0" border="0" align="center">
        <tr>
            <td>
                <asp:Image ID="P_Go" runat="server" ImageAlign="AbsMiddle" />
                您现在的位置：<a href="../info.aspx">后台管理</a> >> <a href="datasourcelist.aspx">数据源列表</a>
                >> 设置数据源
            </td>
        </tr>
    </table>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <table class="border" cellspacing="1" cellpadding="0" width="99%" border="0" align="center">
                <tr>
                    <td class="bqleft">
                        数据源名称：
                    </td>
                    <td class="bqright">
                        <asp:TextBox ID="txtName" runat="server" MaxLength="20" CssClass="in1" Columns="30"></asp:TextBox>
                        <asp:DropDownList ID="Class" runat="server">
                            <asp:ListItem Value="0">选择分类</asp:ListItem>
                        </asp:DropDownList>
                        <font color="#ff0066">*</font>
                    </td>
                </tr>
                <tr>
                    <td class="bqleft">
                        数据源类型：
                    </td>
                    <td class="bqright">
                        <asp:DropDownList ID="DropType" runat="server" AutoPostBack="True" 
                            onselectedindexchanged="DropType_SelectedIndexChanged">
                            <asp:ListItem Value="0">本地数据库</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="bqleft">
                        输出数量：
                    </td>
                    <td class="bqright"><asp:TextBox ID="txtTopNum" runat="server" CssClass="in1" Rows="30" Text="0" Columns="10"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="bqleft">
                        选择数据：
                    </td>
                    <td class="bqright">
                        <table cellpadding="2" cellspacing="0">
                            <tr>
                                <td align="right">主表：
                                </td>
                                <td>
                                    <asp:DropDownList ID="DropHostTable" runat="server" AutoPostBack="True" 
                                        onselectedindexchanged="DropHostTable_SelectedIndexChanged">
                                        <asp:ListItem Value="0">请选择一张表</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                                <td align="right">从表：
                                </td>
                                <td>
                                    <asp:DropDownList ID="DropGuestTable" runat="server" AutoPostBack="True" 
                                        onselectedindexchanged="DropGuestTable_SelectedIndexChanged">
                                        <asp:ListItem Value="0">请选择一张表</asp:ListItem>
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td align="right">输出字段：
                                </td>
                                <td>
                                    <asp:ListBox ID="ListHostTable" runat="server" Rows="15" Width="225" SelectionMode="Multiple">
                                        <asp:ListItem Value="*">所有数据</asp:ListItem>
                                    </asp:ListBox>
                                </td>
                                <td align="right">输出字段：
                                </td>
                                <td>
                                    <asp:ListBox ID="ListGuestTable" runat="server" Rows="15" Width="225" SelectionMode="Multiple">
                                        <asp:ListItem Value="*">所有数据</asp:ListItem>
                                    </asp:ListBox>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr runat="server" id="InnerJoin" style="display:none">
                    <td class="bqleft">
                        约束字段：
                    </td>
                    <td class="bqright"><asp:DropDownList ID="Join" runat="server">
                        <asp:ListItem Value="INNER JOIN">InnerJoin</asp:ListItem>
                        <asp:ListItem Value="LEFT JOIN">LeftJoin</asp:ListItem>
                        <asp:ListItem Value="OUTER JOIN">OuterJoin</asp:ListItem>
                        <asp:ListItem Value="RIGHT JOIN">RightJoin</asp:ListItem>
                    </asp:DropDownList>
                    <asp:DropDownList ID="DropHostFieldList" runat="server">
                        <asp:ListItem Value="选择主表字段">选择主表字段</asp:ListItem>
                    </asp:DropDownList>=<asp:DropDownList ID="DropGuestFieldList" runat="server">
                        <asp:ListItem Value="选择从表字段">选择从表字段</asp:ListItem>
                    </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <td class="bqleft">
                        <input id="ButWhere" type="button" value=" 生成查询条件 " class="btn" runat="server"/>
                    </td>
                    <td class="bqright">
                        <asp:TextBox ID="txtWhere" runat="server" Rows="4" TextMode="MultiLine" Width="99%" Style="word-break: break-all; word-wrap: break-word;"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="bqleft">
                         <input id="ButOrder" type="button" value=" 生成排序规则 " class="btn" runat="server"/>
                    </td>
                    <td class="bqright"><asp:TextBox ID="txtOrder" runat="server" Rows="4" TextMode="MultiLine" Width="99%" style="word-break: break-all; word-wrap: break-word;"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="bqleft">
                        <input id="ButSql" type="button" value=" 生成Sql语句 " class="btn" onclick="CreateSql()" /><p>
                                    <input id="ButExistsSql" type="button" value=" 检测Sql语句 " class="btn" onclick="ExistsSql()" />
                    </td>
                    <td class="bqright">
                        <asp:DataList ID="DataList1" runat="server" RepeatColumns="6" RepeatDirection="Horizontal"
                                Width="100%">
                                <ItemStyle Width="13%" />
                                <ItemTemplate>
									<div onclick="CreateRange('txtSql','{D_@_<%# Eval("Name") %>}')" class="fieldstyle" title="点击选择该字段到搜索样式">
                                        {D_@_<%# Eval("Name")%>}
                                    </div>
                                </ItemTemplate>
                            </asp:DataList>
                        <asp:TextBox ID="txtSql" runat="server" Rows="8" TextMode="MultiLine" Width="99%" Style="word-break: break-all; word-wrap: break-word;"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td class="bqleft">
                    </td>
                    <td class="bqright" height="50">
                        <asp:Button ID="Button1" runat="server" Text=" 确认 " CssClass="btn radius30 pad_0_30" 
                            onclick="Button1_Click" />
                    </td>
                </tr>
            </table>
        </ContentTemplate>
    </asp:UpdatePanel>
    </form>
</body>
</html>
