<%@ page language="C#" masterpagefile="AdminIndexMaster.master" autoeventwireup="true" inherits="Admin_UserSynchron, HoWaveIMSV5.0" title="用户数据同步" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server" ></asp:ScriptManager>
<script type="text/javascript">
function SelectDBType(ctlname)
{
 var obj1=document.getElementById(ctlname+"_0");
 var obj2=document.getElementById(ctlname+"_1");
 if(obj1.checked)
 {
   $("AccessDB").style.display="none";
   $("SqlDB").style.display="";
 }
 else if(obj2.checked)
 {
   $("AccessDB").style.display="";
   $("SqlDB").style.display="none";
 } 
}
</script>
<script type="text/javascript" src="Js/Function.js"></script>   
<table width="100%" border="0">
     <tr>
      <td valign="top" align="center" style=" width:100%; height: 54px;">
	       <table class="adminheading">
               <tr>
                  <th valign="middle" class="menus" style="height: 54px; width: 629px;" align="left">
                      用户数据同步</th>
                  <td valign="middle" style="height: 54px">
                  <table border="0"  cellpadding="3" cellspacing="0">
                     <tr>                        
                       <td>&nbsp;</td>
                       <td align="center">&nbsp;</td>
                       <td>&nbsp;</td>
                        <td><asp:Image  ID="help" runat="server" AlternateText="帮助"  ImageUrl="~/Images/Manage/help.png" /><BR>
                           帮助
                      </td>
                   </tr>                     
                </table>
              </td>
             </tr>
          </table> 
       </td>
     </tr>
  </table>

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"  SelectMethod="GetInterfaceNameID" TypeName="InterfaceBLL"/>
   
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
  <fieldset class="FieldSetStlye">
    <asp:Wizard ID="UserSynchroSet" runat="server" ActiveStepIndex="0" Width="100%" StepStyle-VerticalAlign="Top"  SideBarStyle-Width="15%" FinishCompleteButtonText="">
        <WizardSteps>
            <asp:WizardStep runat="server" Title="阅读转换说明" ID="step1">
               <table cellSpacing="1" cellPadding="3"  class="UserSynchronTable" width="100%">
                  <tr bgColor="#185195">
                     <td colSpan="2" height="2"></td></tr>
                     <tr bgColor="#e9effc">
                     <td width="80%"><div align="center">恒浪整合V5.0用户表转移程序</div></td>
                     <td width="20%"><div align="center"><a href="http://bbs.howave.net" target="_blank">官方论坛</a></div></td></tr>
                     <tr align="middle" bgColor="#ffffff">
                     <td colspan="2" align="left">
                     <ol start="1">
                     <li><strong>阅读转移说明</strong></li><li>选择源系统及目的系统 此转换程序为一对多的程序，在转换过程中一定要保证所有系统都有用户数据才能同步！ </li>
                     <li>设置源数据库地址和目的数据库地址</li><li>设置源数据库转移字段和目的数据库转移字段</li><li>执行转换</li><li>成功（错误）提示</li></ol>
                     </td>
                  </tr>
                  <tr align="center" bgColor="#ffffff">
                     <td colspan="2" align="left">
                       <li><strong>　　转移说明</strong></li><OL start="1">
                       <li>此程序主要实现了恒浪数据库用户表与其它系统用户表互相转移的功能</li><li>使用此程序之前必须确认，您所用的恒浪数据库用户表为官方原版,并看清楚转换操作说明</li><li>转换之前请备份好目的数据库，如果转换失败请查看出错提示进行下一步的工作</li><li>此程序并不保证转换100%成功，对于使用此程序后出现的问题，官方不承担一切责任</li></OL>
                     </td>
                  </tr>         
              </table>
              <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource2" AllowPaging="True">
                  <Columns>
                      <asp:BoundField DataField="TransferID" HeaderText="ID" />
                      <asp:TemplateField HeaderText="转换名称">
                         <ItemTemplate>
                            恒浪V5.0<asp:Label ID="TransferType" runat="server" Text='<%# ((Eval("TransferType").ToString())=="1")?"--->":"<---" %>' /><asp:Label ID="TransferName" runat="server" Text='<%#Eval("InterfaceName") %>' />
                         </ItemTemplate>
                      </asp:TemplateField>
                      <asp:TemplateField HeaderText="操作">
                         <ItemTemplate>
                            <asp:Button ID="Modify" runat="server" Text="修改转换设置"  CommandName='<%# Eval("TransferID")+"|Modify" %>' OnCommand="TransferAction"/>
                            <asp:Button ID="Button1" runat="server" Text="修改转换参数"  CommandName='<%# Eval("TransferID")+"|ModifyParam" %>' OnCommand="TransferAction"/>
                            <asp:Button ID="Delete" runat="server" Text="删除" CommandName='<%# Eval("TransferID")+"|Delete" %>' OnCommand="TransferAction" OnClientClick ="return confirm('将删除转换设置和转换字段，确定要删除?');"/>
                            <asp:Button ID="Transfer" runat="server" Text="转换" CommandName='<%# Eval("TransferID")+"|Transfer" %>' OnCommand="TransferAction"/>
                         </ItemTemplate>
                      </asp:TemplateField>
                  </Columns>
              </asp:GridView>
            </asp:WizardStep>
            <asp:WizardStep runat="server" Title="设置数据库" ID="step2">
                      <table cellSpacing="1" cellPadding="3"  class="UserSynchronTable" width="100%">
                         <tr bgColor="#185195">
                            <td height="2"></td>
                         </tr>
                         <tr bgColor="#e9effc">
                            <td align="center">数据库设置</td>
                         </tr>
                         <tr>
                            <td>
                               <table border="0" width="100%" bgcolor="white">
                                   <tr bgColor="#e9effc">
                                      <td  align="left" width="50%">选择转换形式</td>
                                      <td>
                                          <asp:RadioButtonList ID="TransferType" runat="server"  RepeatDirection="Horizontal">
                                             <asp:ListItem Text="从恒浪导入该系统" Value="1" Selected="True"/>
                                             <asp:ListItem Text="从该系统导入恒浪" Value="2" />
                                          </asp:RadioButtonList>
                                      </td>
                                   </tr>
                               </table>
                            </td>
                         </tr>                        
                         <tr>
                            <td>
                               <table border="0" width="100%" bgcolor="white">
                                   <tr bgColor="#e9effc">
                                      <td colspan="4" align="center">选择转换系统</td>
                                   </tr>
                                   <tr>
                                      <td align="left" width="20%">转换系统:</td>
                                      <td align="left" width="30%">
                                          <asp:DropDownList ID="InterfaceID" runat="server" DataSourceID="ObjectDataSource1" 
                                            DataTextField="InterfaceName" DataValueField="InterfaceID"  AppendDataBoundItems="True" />                                            
                                      </td>
                                      <td align="left" colspan="2"></td>
                                  </tr>
                               </table>
                            </td>
                         </tr>
                         <tr>                           
                            <td>
                               <table border="0" width="100%" bgcolor="white" >
                                   <tr bgColor="#e9effc">
                                     <td colspan="6" align="center">转换用户数据表设置</td>
                                   </tr> 
                                   <tr>
                                      <td width="50%" align="left">
                                         <table border="0" width="100%">
                                            <tr>
                                               <td width="40%" align="left">转换数据库表名</td>
                                               <td align="left"><asp:TextBox ID="TransferTableName" runat="server" Text="PE_User"/></td>
                                            </tr>
                                         </table>
                                      </td>
                                      <td align="left"><a href="#"  onmouseover="showHelp('help1');" onmouseout="hidenHelp('help1');" ><img src="../Images/smallIcon/tooltip.png" border="0" /></a></td>
                                   </tr>
                                   <tr>
                                       <td width="50%" align="left">
                                          <table border="0" width="100%">
                                             <tr>
                                                <td width="40%" align="left">表ID字段名</td>
                                                <td align="left"><asp:TextBox ID="Other_UserID" runat="server" Text="userid"/></td>
                                             </tr>
                                          </table>
                                       </td>
                                       <td align="left"><a href="#"  onmouseover="showHelp('help3');" onmouseout="hidenHelp('help3');" ><img src="../Images/smallIcon/tooltip.png" border="0" /></a> </td>
                                   </tr>
                                   <tr>
                                       <td width="50%" align="left">
                                          <table border="0" width="100%">
                                             <tr>
                                                <td width="40%" align="left">表用户UserName字段名</td>
                                                <td align="left"><asp:TextBox ID="Other_UserName" runat="server" Text="UserName"/></td>
                                             </tr>
                                          </table>
                                       </td>
                                       <td align="left"><a href="#"  onmouseover="showHelp('help2');" onmouseout="hidenHelp('help2');" ><img src="../Images/smallIcon/tooltip.png" border="0" /></a></td>
                                   </tr>                                        
                               </table>
                            </td>                           
                         </tr>
                         <tr>
                            <td >
                               <table border="0" width="100%" bgcolor="white" >
                                  <tr bgColor="#e9effc">
                                     <td colspan="2" align="center">数据库类型及路径设置</td>
                                   </tr> 
                                   <tr>
                                       <td width="50%" valign="top">
                                           <table border="0" width="100%" >
                                              <tr>
                                                 <td align="left" width="40%">转换系统的数据库类型</td>
                                                 <td align="left">
                                                     <asp:RadioButtonList ID="DBType" runat="server" RepeatDirection="Horizontal">
                                                         <asp:ListItem Text="MS SQL" Value="SQL"  />
                                                         <asp:ListItem Text="Access" Value="Access"  Selected="True"/>
                                                     </asp:RadioButtonList>
                                                 </td>
                                              </tr>
                                              <tr id="AccessDB">
                                                 <td align="left" width="40%">Access数据库相对路径</td>
                                                 <td align="left"><asp:TextBox ID="AccessPath" runat="server" Text="data/data.mdb" Width="90%"/><a href="#"  onmouseover="showHelp('help4');" onmouseout="hidenHelp('help4');" ><img src="../Images/smallIcon/tooltip.png" border="0" /></a></td>                                     
                                              </tr>
                                              <tr id="SqlDB" style="display:none;">
                                                 <td colspan="2" style="height: 159px">
                                                    <table border="0" width="100%">
                                                       <tr>
                                                          <td align="left" width="40%">数据库服务器</td>
                                                          <td align="left"><asp:TextBox ID="Sql_Source" runat="server" Text="localhost"/></td>
                                                       </tr>
                                                       <tr>
                                                          <td align="left">数据库名</td>
                                                          <td align="left"><asp:TextBox ID="Sql_Name" runat="server" Text="Howave"/></td>
                                                       </tr>
                                                       <tr>
                                                          <td align="left">登录帐号</td>
                                                          <td align="left"><asp:TextBox ID="Sql_user" runat="server" Text="sa"/></td>
                                                       </tr>
                                                       <tr>
                                                          <td align="left">登录密码</td>
                                                          <td align="left"><asp:TextBox ID="Sql_Pass" runat="server"  TextMode="Password"/></td>
                                                       </tr>
                                                    </table>
                                                     <asp:Label ID="ErrMessages" runat="server"/>
                                                </td>
                                             </tr>
                                           </table>
                                       </td>
                                       <td width="50%" valign="top">
                                           <asp:Label ID="Message1" runat="server"  CssClass="ErrMessageStyle"/>                      
                                       </td>                                      
                                   </tr>
                                </table>
                            </td>
                        </tr>     
                        <tr>
                           <td>
                              <table border="0" width="100%" bgcolor="white">
                                   <tr bgColor="#e9effc">
                                      <td align="left" width="50%">遇到相同用户名时处理方式</td>
                                      <td><asp:RadioButtonList ID="JumpUser" runat="server" 
                                            SelectedValue='<%# Bind("JumpUser") %>' RepeatDirection="Horizontal">
                                             <asp:ListItem Text="用户名加随机数字" Value="1" />
                                             <asp:ListItem Text="跳过" Value="2" Selected="True"/>
                                          </asp:RadioButtonList>
                                      </td>                                     
                                   </tr>                                                                    
                               </table>
                           </td>
                        </tr>
                        <tr>
                           <td>
                              <table border="0" width="100%" bgcolor="white">
                                   <tr bgColor="#e9effc">
                                      <td align="left" width="50%">当目标系统的ID字段不是自动递增请勾选</td>
                                      <td><asp:CheckBox ID="AutoID" runat="server" />(若转换系统为动易请勾选)</td>
                                   </tr>                                   
                               </table>
                           </td>
                        </tr>
                         <tr>
                           <td>
                              <table border="0" width="100%" bgcolor="white">
                                   <tr bgColor="#e9effc">
                                      <td align="left" width="50%">该系统采用MD5加密位数</td>
                                      <td><asp:DropDownList ID="Md5Size"  runat="server">
                                             <asp:ListItem Text="16位" Value="16"  Selected="True"/>
                                             <asp:ListItem Text="32位" Value="32" />
                                          </asp:DropDownList>
                                       </td>
                                   </tr>                                   
                               </table>
                           </td>
                        </tr>
                        <tr>
                           <td align="right"> 
                               
                           <asp:Button ID="SychroSetButton" runat="server" Text="下一步"  OnClick="SychroSetButton_Click"/></td>
                        </tr>                       
                    </table>
            </asp:WizardStep>
           
            <asp:WizardStep runat="server" Title="设置转换字段" ID="step3">
            
            <asp:HiddenField ID="TransferIDValue" runat="server"/>
                 <table cellSpacing="1" cellPadding="3"  class="UserSynchronTable" width="100%">
                         <tr bgColor="#185195">
                            <td height="2"></td>
                         </tr>
                         <tr bgColor="#e9effc">
                            <td align="center">转换字段设置</td>
                         </tr>
                         <tr>
                            <td>
                               <table border="0" width="100%" bgcolor="white">
                                   <tr bgColor="#e9effc">
                                      <td  align="center" style="width:25%">恒浪OMSV5.0数据表字段</td>
                                      <td  align="center" style="width:25%">转移数据表字段</td>
                                      <td  align="center" style="width:25%">该字段在此系统的默认值</td>
                                      <td  align="center" style="width:25%"></td>                                      
                                   </tr>
                                   <tr>
                                      <td  align="center" style="width:25%">
                                         <asp:DropDownList ID="HowaveDataTable" runat="server" AppendDataBoundItems="True">
                                           <asp:ListItem Text="其它" Value="DefaultValue|default" />
                                         </asp:DropDownList>
                                      </td>
                                      <td  align="center" style="width:25%"><asp:DropDownList ID="OtherTable" runat="server"/></td>
                                      <td  align="center" style="width:25%"><asp:TextBox ID="DefaulValue" runat="server" /></td>
                                      <td  align="center" style="width:25%"><asp:button ID="TransferSave" runat="server" Text="保存添加字段"  OnClick="TransferSaveButton_Click"/></td>   
                                   </tr>                                  
                               </table>
                            </td>
                         </tr>
                    </table>
                     <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" Width="100%"  DataKeyNames="TransferFieldID"   OnRowDeleting="GridView1_RowDeleting">
                               <Columns>
                                  <asp:BoundField DataField="HLFieldName" HeaderText="恒浪字段/字段类型" >
                                      <HeaderStyle Width="25%" />
                                  </asp:BoundField>
                                  <asp:BoundField DataField="FieldName" HeaderText="目标系统字段/字段类型">
                                      <HeaderStyle Width="25%" />
                                  </asp:BoundField>
                                  <asp:BoundField DataField="DefaultValue" HeaderText="默认值">
                                      <HeaderStyle Width="25%" />
                                  </asp:BoundField>                               
                                  <asp:TemplateField HeaderText="删除"> 
                                  <ItemTemplate> 
                                      <asp:Button id="btnDelete" runat="server" OnClientClick ="return confirm('您真的要删除?');" CommandName="Delete" Text="删除" CommandArgument='<% Bind("TransferFieldID") %>'></asp:Button> 
                                  </ItemTemplate> 
                                  <ItemStyle Width="25%" />
                                  </asp:TemplateField> 
                               </Columns>
                    </asp:GridView> 
                    <div style="width:98%; text-align:right;"> <asp:Button ID="Button1" runat="server" Text="下一步"  OnClick="SaveSynchronField"/></div>
                    <div style="text-align:left;">
                       <b>转换字段说明：</b><br />
                       <ul>
                          <li>UserID字段不需要设置保存，因为UserID字段一般是默认递增</li>
                          <li>当从恒浪V5.0同步到其它系统时，在恒浪没有对应该系统字段或者需要在转换中设置该系统某些字段对应值，则可以从恒浪设置中选择“其它”一项，并填入默认值</li>
                          <li>例如：从恒浪转BBS论坛，需要设置会员的默认等级Group为1,则只需设置恒浪字段为“其它”BBS字段为"Group"，默认值为1，点击保存即可</li>
                       </ul>                       
                    </div>
            </asp:WizardStep>
        </WizardSteps>
        <StepStyle VerticalAlign="Top" HorizontalAlign="Center" />
        <SideBarStyle HorizontalAlign="Center" VerticalAlign="Top" Width="15%" />
        <StepNavigationTemplate>            
        </StepNavigationTemplate>
    </asp:Wizard>
  </fieldset>         
  </ContentTemplate>
</asp:UpdatePanel>
 <asp:UpdateProgress ID="UpdateProgress1" runat="server">
   <ProgressTemplate>
      <DIV class="wait"><IMG src="../Images/wait.gif" align=middle />请稍等... </DIV>
   </ProgressTemplate>
</asp:UpdateProgress>
    <div id="help2" style="position:absolute;z-index:1; border:solid 1px black; padding:10px; background:white; display:none;" onmouseover="this.style.display='';" onmouseout="this.style.display='none'">
      <ul>
         <li><b>动易2006：</b>PE_User</li><li><b>动网7.1：</b>UserName</li><li><b>OBLOG4.0：</b>username</li><li><b>创力：</b>UserName</li><li><b>BBSXP7：</b>UserName</li></ul>   
     </div>
    <div id="help1" style="position:absolute;z-index:1; border:solid 1px black; padding:10px; background:white; display:none;" onmouseover="this.style.display='';" onmouseout="this.style.display='none'">
      <ul>
         <li><b>动易2006：</b>PE_User</li><li><b>动网7.1：</b>DV_User</li><li><b>OBLOG4.0：</b>oblog_user</li><li><b>创力：</b>cl_User</li><li><b>BBSXP7：</b>BBSXP_Users</li></ul>   
   </div>
    <div id="help3" style="position:absolute;z-index:1; border:solid 1px black; padding:10px; background:white; display:none;" onmouseover="this.style.display='';" onmouseout="this.style.display='none'">
      <ul>
         <li><b>动易2006：</b>UserID</li><li><b>动网7.1：</b>UserID</li><li><b>OBLOG4.0：</b>userid</li><li><b>创力：</b>UserID</li><li><b>BBSXP7：</b>ID</li></ul>   
   </div>
   <div id="help4" style="position:absolute;z-index:1; border:solid 1px black; padding:10px; background:white; display:none;" onmouseover="this.style.display='';" onmouseout="this.style.display='none'">
      <ul>
         <li><b>相对当前目录路径：</b>如在上一级目录需要在前面添加"../"</li><li><b>例如：</b>网站路径为http://www.howave.com/cms/database/data.mdb,Accees路径为"../cms/database/data.mdb"</li></ul>   
   </div>
<asp:HiddenField ID="SQLPassword" runat="server" />   
<asp:HiddenField ID="ConnectionString" runat="server" />
    <asp:ObjectDataSource ID="ObjectDataSource2" runat="server" SelectMethod="GetTransferSet"
        TypeName="HowaveTransferSet"/>
     
</asp:Content>

