<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Course.Admin.Course.KS_CourseFaceImport" Codebehind="KS.CosFaceImport.aspx.cs" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" Runat="Server">
    <KS:TopNav ID="TopNav1" Text="面授课程批量导入操作" runat="server" />
    <div class="content-area">  
    <style type="text/css"> 
		.graph{ 
		width:450px; 
		border:1px solid #9bdf70; 
		height:25px; 
		} 
		#bar{ 
		display:block; 
		background:#FFE7F4; 
		float:left; 
		height:100%; 
		text-align:center; 
		} 
		#barNum{ 
		position:absolute; 
		} 
		</style> 

<script type="text/javascript">

    function loadTable() {
        jQuery("#showtable").show();
        jQuery.get('KS.CosFaceImport.aspx', { rnd: Math.random(), action: 'loadTable', lst: jQuery('#<%=this.LabelDataSource.ClientID %>>option:selected').val(), cstr: jQuery('#<%=this.ConnStr.ClientID %>').val() }, function (s) {
            jQuery("#tablename").empty().append(s);
        });
    }
    function checkdatasource() {
        jQuery.get('KS.CosFaceImport.aspx', { action: 'CheckDataSource', lst: jQuery('#<%=this.LabelDataSource.ClientID %>>option:selected').val(), cstr: jQuery('#<%=this.ConnStr.ClientID %>').val() }, function (s) {
            if (s == 'true') {
                KesionJS.AlertByTime(1, '恭喜，数据源连接测试通过!', 2);
                loadTable();
            }
            else {
                KesionJS.AlertByTime(2, '连接出错，请检查连接字符串!', 2);
            }
            return false;
        });
    }

    function changeconnstr() {
        switch (parseInt(jQuery('#<%=this.LabelDataSource.ClientID %>>option:selected').val())) {
            case 1:
                $("#excelstr").hide();
                jQuery('#<%=this.ConnStr.ClientID %>').val('/DBPath/数据库.mdb');
             break;
            case 2:
                $("#excelstr").hide();
             jQuery('#<%=this.ConnStr.ClientID %>').val('User ID=sa; Password=989066; Initial Catalog=kesionicms; server=(local);');
             break;
            case 3:
                $("#excelstr").hide();
             jQuery('#<%=this.ConnStr.ClientID %>').val('DSN=数据源名;UID=用户名;PWD=密码');
                 break;
            case 4:
                $("#excelstr").hide();
                 jQuery('#<%=this.ConnStr.ClientID %>').val('Data Source=数据源名;User Id=用户名;Password=密码;Integrated Security=no;');
                 break;
            case 5:
                $("#excelstr").show();
                 jQuery('#<%=this.ConnStr.ClientID %>').val('/cface.xls');
                 break;
            case 6:
                $("#excelstr").hide();
                 jQuery('#<%=this.ConnStr.ClientID %>').val('Data Source=完整数据库路径+名称;Provider=Microsoft.JET.OLEDB.4.0;');
                 break;
         }
     }
    </script>
          <div class="tabs_header longTabs">
            <ul class="tabs">
                <li class="active"><a href="KS.CosFaceImport.aspx?costype=1"><span>导入课程</span></a></li>
                <li><a href="KS.CosFaceAddPeriod.aspx?costype=1"><span>导入章节时</span></a></li>
                <li><a href="KS.CosDataImport.aspx?costype=1"><span>导入资料</span></a></li>
            </ul>
        </div>
<asp:Panel ID="top" runat="server" Width="100%">
      <table width="100%"  border="0" cellpadding="1" cellspacing="1" class="CTable">  
          <tr><td class="lefttd" style="text-align:left;padding-left:4px;"><strong>第一步 请选择数据源</strong></td></tr>
          </table>
    <br />
      <table width="100%" border="0" cellpadding="1" cellspacing="1" class="CTable">  
           <tr style="display:none">
               <td class="lefttd" style="height: 30px; text-align: right">
                    <strong>数 据 源：</strong></td>
                <td class="righttd" style="height: 30px; text-align: left">
                        <asp:DropDownList ID="LabelDataSource" runat="server">
                         <asp:ListItem Value="1" >外部Access数据源</asp:ListItem>
                         <asp:ListItem Value="2">外部MS SQL数据源</asp:ListItem>
                         <asp:ListItem Value="3">外部ODBC数据源</asp:ListItem>
                         <asp:ListItem Value="4">外部Oracle数据源</asp:ListItem>
                         <asp:ListItem Value="5" Selected="true">外部Excel数据源</asp:ListItem>
                         <asp:ListItem Value="6">外部OLE数据源</asp:ListItem> 
                        </asp:DropDownList>
       
                </td>
            </tr>
      <tr>
                <td class="lefttd" style="height: 30px; text-align: right">
                    <strong>连接字符串：</strong></td>
                <td class="righttd" style="height: 30px; text-align: left">
                 <asp:TextBox ID="ConnStr" runat="server" Height="50px" TextMode="MultiLine" Width="450px" >/cface.xls</asp:TextBox>
                     <div id="excelstr" >
                         <input type="button" class="button" onclick="SelectFiles('<%=this.ConnStr.ClientID%>',0);" value="选择Excel文件" style="vertical-align: middle;" />
                            <div style="display: inline-block; width: 100px; height: 34px; vertical-align: middle;"><%=Kesion.APPCode.UploadAPI.EchoUpload("uploadexcelfile",this.ConnStr.ClientID)%></div>
                    <%--<input type="button" class="button" onclick="SelectFiles('<%=this.ConnStr.ClientID%>    ',0);" value="选择Excel文件" />
                      <%=Kesion.APPCode.UploadAPI.EchoUpload("uploadexcelfile",this.ConnStr.ClientID) %>--%>
                      <a href="../../admin/course/面授课程导入示例文档.xls" style="color: green">面授课程导入示例文档下载</a>
                    </div>
                    <br />
                    <asp:Button ID="TextButton" runat="server" Text="测试数据源" CssClass="button" CausesValidation="False" UseSubmitBehavior="False" />

                </td>
            </tr> 
          <tbody  style="display:none;" id="showtable">
        <tr>
        <td class="lefttd" style="height: 30px; text-align: right"><strong>请选择要导入数据表：</strong></td>
          <td class="righttd" style="height: 30px; text-align: left" > 
              <select name="tablename" id="tablename"></select>
         </td>
     </tr> 
          <tr>
                <td class="lefttd" style="height: 30px; text-align: right">
                            
                    </td>
           <td class="righttd" style="height: 30px; text-align: left">  
               <asp:Button ID="Button1" runat="server" CssClass="button" OnClick="Button1_Click" Text="下一步" />
            </td>
          </tr>
              </tbody> 
  </table>
  </asp:Panel>   
     


     <asp:Panel ID="list" runat="server" Width="100%">
          
           <asp:Label ID="Label1" runat="server" Text="Label"/>
         <br />
           <asp:Button ID="Button2" CssClass="button" runat="server" Text="确定导入" OnClick="Button2_Click"/>   


 </asp:Panel> 
   </div>
</asp:Content>

