<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="databaseopr.aspx.cs" Inherits="Us.Web.admin.basic.databaseopr" %>


<!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 id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8,chrome=1" /><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8,chrome=1" />
    <title>数据库操作</title>
    <asp:Literal ID="litregscript" runat="server" Text=""></asp:Literal>
    <link href="../style/default/style.css" rel="stylesheet" type="text/css" />

     <%=ImportScriptStr %>



    <script language="javascript" src="/admin/js/System.js" type="text/javascript"></script>

    <script language="javascript" src="/editor/xheditor.js" type="text/javascript"></script>

    <style type="text/css">
        #radBakup, #radRestore
        {
            width: 14px;
            height: 14px; !important;margin:0px;!important;padding:0px;!important;border:0pxnone#009999;}
        #chkSelectAnsy input
        { width: 14px;
            height: 14px; !important;margin:0px;!important;padding:0px;!important;border:0pxnone#009999;}
        
    </style>
     
    <script type="text/javascript">
        function dbopr2()
        {
            var ret = false;
            var pwd = $("#txtPassword2").val();
            if (pwd != "") {
                if (art.dialog.data("retdata") == 1) {
                    art.dialog.data("retdata", 0);
                    return true;
                }
                art.dialog.confirm('您确实要执行选择的操作吗？', function () {
                    art.dialog.data("retdata", 1);
                    document.getElementById("btnSubmit2").click();
                });
            }
            else {
                art.dialog.alert('请输入操作密码后才可以操作数据库！');
            }
            return ret;
        }

        function dbopr3() {
            var ret = false;
            var pwd = $("#txtPassword3").val();
            if (pwd != "") {
                if (art.dialog.data("retdata") == 1) {
                    art.dialog.data("retdata", 0);
                    return true;
                }
                art.dialog.confirm('您确实要执行选择的操作吗？', function () {
                    art.dialog.data("retdata", 1);
                    document.getElementById("btnSubmit3").click();
                });
            }
            else {
                art.dialog.alert('请输入操作密码后才可以操作数据库！');
            }
            return ret;
        }

        function dbopr4() {
            var ret = false;
            var pwd = $("#txtPassword4").val();
            if (pwd != "") {
                if (art.dialog.data("retdata") == 1) {
                    art.dialog.data("retdata", 0);
                    return true;
                }
                art.dialog.confirm('您确实要执行选择的操作吗？', function () {
                    art.dialog.data("retdata", 1);
                    document.getElementById("btnUnLoad").click();
                });
            }
            else {
                art.dialog.alert('请输入操作密码后才可以操作数据库！');
            }
            return ret;
        }

        function dbopr5() {
            var ret = false;
           

            if (art.dialog.data("retdata") == 1) {
                art.dialog.data("retdata", 0);
                return true;
            }
            art.dialog.confirm('您确实要执行同步CRM操作吗？', function () {
                art.dialog.data("retdata", 1);
                document.getElementById("btnSubmit5").click();
            });

            return ret;
        }

        function dbopr6() {
            var ret = false;
            var pwd = $("#txtPassword6").val();
            if (pwd != "") {
                if (art.dialog.data("retdata") == 1) {
                    art.dialog.data("retdata", 0);
                    return true;
                }
                art.dialog.confirm('您确实要执行选择的操作吗？', function () {
                    art.dialog.data("retdata", 1);
                    document.getElementById("btnSubmit6").click();
                });
            }
            else {
                art.dialog.alert('请输入操作密码后才可以操作数据库！');
            }
            return ret;
        }
    </script>
    
           
    <script language="javascript" type="text/javascript">
        function jscheckAll() {

            var val = $('input:radio[name="database"]:checked').val();
            var info = "";
            if (val == "radBakup") { info = "您确实要备份数据库吗？备份后当数据需要还原后，可以 通过还原功能选择备份的文件进行还原；"; }
            else { info = "您确实要还原数据库吗？还原后，系统目前的数据将被还原文件全部覆盖！"; }

            if (art.dialog.data("retdata") == 1) {
                return true;
            }
            art.dialog.confirm(info, function () {
                art.dialog.data("retdata", 1);
                document.getElementById("btnSubmit").click();
            });

            return false;
        }


      
        
    </script>
</head>
<body onload="win_onLoad();">
    <form id="form1" runat="server">
    
    <div id="tbMain">
        <div class="divTbg">
            <div class="divTbgL">
            </div>
            <div class="divTbgInfo">
                <div class="divTbgTitle">
                    数据库操作</div>
            </div>
        </div>
        <div class="divTbgF">
        </div>
        <div class="divTNavBG" id="topURL">
            <ul id="topURLul">
                <li class="divURLed" id="div1">
                    <div>
                        <img src="../style/default/images/mini_icons_046.gif" width="10" height="10" />
                        数据库操作</div>
                </li>
            </ul>
        </div>
        <div id="mypanel">
            <div class="divInfoContext">
                <div class="divInfo">
                    <div class="divInfoblack">
                        <div class="divInfoTopList">
                            <div class="listLeft">
                                <div class="navtitle">
                                    第1个功能：备份/还原数据库</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="divInfo">
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablist" id="mainlist"
                        onmouseover="changeto()" onmouseout="changeback()">
                        <tr class="tablisttr">
                            <td class="tablisttitle" width="100px">
                                数据库类型
                            </td>
                            <td class="tabmanagertr">
                                <asp:RadioButton ID="radBakup" runat="server" AutoPostBack="True" Checked="True"
                                    GroupName="database" 
                                    Text="备份数据库" oncheckedchanged="radBakup_CheckedChanged" />
                                <asp:RadioButton ID="radRestore" runat="server" AutoPostBack="True" GroupName="database"
                                    Text="还原数据库" oncheckedchanged="radRestore_CheckedChanged" />
                            </td>
                        </tr>
                        <tbody runat="server" id="TBodyBakup" visible="true">
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    备份说明
                                </td>
                                <td class="tabmanagertr">
                                    系统把备份文件自动备份到指定的目录，还原的时候选择备份文件即可；备份文件名格式为：yyyyMMddhhmmss_备份文件名.bak；
                                </td>
                            </tr>
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    备份文件名
                                </td>
                                <td class="tabmanagertr">
                                     <asp:TextBox ID="txtBakName" runat="server" Width="200px" CssClass="1" ToolTip="备份文件名">手动备份</asp:TextBox> 
                                </td>
                            </tr>
                        </tbody>
                        <tbody runat="server" id="TBodyRestore" visible="false">
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    还原说明
                                </td>
                                <td class="tabmanagertr">
                                    请选择以前备份的数据库备份文件才可以还原；
                                </td>
                            </tr>
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    还原地址<span class="fStar">*</span>
                                </td>
                                <td class="tabmanagertr">
                                    <asp:TextBox ID="txtRestorePath" runat="server" Width="400px" ToolTip="还原地址"></asp:TextBox><a href="#" onclick="SkyOpenBak('txtRestorePath');">[选择]</a> 
                                </td>
                            </tr>
                        </tbody>
                         <tbody runat="server" >
                            
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    操作密码<span class="fStar">*</span>
                                </td>
                                <td class="tabmanagertr">
                                     <asp:TextBox ID="txtPassword1" runat="server" Width="200px" CssClass="1" ToolTip="操作密码"></asp:TextBox> 为了系统安全，必须输入正确的操作密码！
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="divSave">
                        <asp:Button ID="btnSubmit" runat="server" Text="执行(S)" CssClass="SkyButtonFocus"
                            OnClick="btnSubmit_Click" />
                    </div>
                </div>
            </div>
            
            
            
            <div class="divInfoContext">
                <div class="divInfo">
                    <div class="divInfoblack">
                        <div class="divInfoTopList">
                            <div class="listLeft">
                                <div class="navtitle">
                                    第2个功能：初始化数据库</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="divInfo">
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablist" id="Table1"
                        onmouseover="changeto()" onmouseout="changeback()">
                        <tr class="tablisttr">
                             <td class="tablisttitle" width="100px">
                                初始化内容
                            </td>
                             <td class="tabmanagertr">
                                <asp:CheckBoxList ID="chkSelectAnsy" runat="server" RepeatColumns="5" 
                                            RepeatDirection="Horizontal" Width="100%">
                                            <asp:ListItem Value="DELETE FROM TB_OprLog ">删除操作日志</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_LoginLog ">删除登录日志</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_Bbs ">删除留言信息</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_News ">删除新闻信息</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_NewsFlux ">删除新闻浏览记录</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_UserPlan ">删除计划信息</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_Score_InLib ">删除入库成绩记录</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_Score_Bak ">删除入库成绩详细</asp:ListItem>

                                            <asp:ListItem Value="DELETE FROM TB_Department ">删除部门信息</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_UserPost ">删除岗位信息</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_InnovateType Where ParentID=0 ">删除指标大类</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_InnovateType Where ParentID!=0 ">删除指标小类</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_EvaluationDetail ">删除指标库</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_InnovatePack ">删除指标套包</asp:ListItem>




                                            <asp:ListItem Value="DELETE FROM TB_UserInfo ">删除用户信息</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM SkySalaryImgLog ">删除工资导入记录</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM SkySalaryTeacher ">删除工资信息</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_EvaluationValue_Dep;DELETE FROM TB_EvaluationValueDetail_Dep ">删除部门评价</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_EvaluationValue_USelf;DELETE FROM TB_EvaluationValueDetail_USelf ">删除自我评价</asp:ListItem>
                                            <asp:ListItem Value="DELETE FROM TB_EvaluationValue_User;DELETE FROM TB_EvaluationValueDetail_User ">删除人员互评</asp:ListItem>
                                            
                                            
                                             <asp:ListItem Value="DELETE FROM TB_EvaluationPostDetail ">删除岗位分值权重</asp:ListItem>
                                             <asp:ListItem Value="DELETE FROM TB_Task ">删除工作任务记录</asp:ListItem>
                                             <asp:ListItem Value="DELETE FROM TB_TaskFeedback ">删除工作任务反馈</asp:ListItem>
                                             <asp:ListItem Value="DELETE FROM TB_TaskReceive ">删除工作任务接收</asp:ListItem>
                                             <asp:ListItem Value="DELETE FROM TB_TaskScore ">删除工作任务评分</asp:ListItem>


                                             <asp:ListItem Value="DELETE FROM TB_Leave ">删除考勤记录</asp:ListItem>
                                             <asp:ListItem Value="DELETE FROM TB_LeaveFlow ">删除考勤审核流程</asp:ListItem>
                                            

                                      </asp:CheckBoxList>
                                      (初次使用可以初始化删除全部数据，以后使用不可以初始化，否则系统就清空数据了)     
                            </td>
                        </tr>
           
                         <tbody  >
                            
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    操作密码<span class="fStar">*</span>
                                </td>
                                <td class="tabmanagertr">
                                     <asp:TextBox ID="txtPassword2" runat="server" Width="200px"  ToolTip="操作密码"></asp:TextBox> 为了系统安全，必须输入正确的操作密码！
                                </td>
                            </tr>
                            <tr class="tablisttr">
                            
                            <td class="tablisttitle">
                                    操作状态
                                </td>
                                <td class="tabmanagertr">
                                    <div style="color:Red">
                                            <asp:Literal ID="LiteralInfo" runat="server"></asp:Literal></div>   
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="divSave">
                        <asp:Button ID="btnSubmit2" runat="server" Text="执行(S)" 
                            CssClass="SkyButtonFocus" onclick="btnSubmit2_Click" />
                    </div>
                </div>
            </div>
            
            
            <div class="divInfoContext">
                <div class="divInfo">
                    <div class="divInfoblack">
                        <div class="divInfoTopList">
                            <div class="listLeft">
                                <div class="navtitle">
                                    第3个功能：执行SQL命令</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="divInfo">
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablist" id="Table2"
                        onmouseover="changeto()" onmouseout="changeback()">
                        <tr class="tablisttr">
                            <td class="tablisttitle" width="100px">
                                SQL命令
                            </td>
                            <td class="tabmanagertr">
                                <asp:TextBox ID="txtSQL" runat="server" Width="100%"  ToolTip="SQL命令" TextMode="MultiLine" Height="50px"></asp:TextBox>
                            </td>
                        </tr>
           
                         <tbody  >
                            
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    操作密码<span class="fStar">*</span>
                                </td>
                                <td class="tabmanagertr">
                                     <asp:TextBox ID="txtPassword3" runat="server" Width="200px"  ToolTip="操作密码"></asp:TextBox> 为了系统安全，必须输入正确的操作密码！
                                </td>
                            </tr>
                            <td class="tablisttitle">
                                    操作状态
                                </td>
                                <td class="tabmanagertr">
                                    <div style="color:Red">
                                            <asp:Literal ID="LiteralInfo3" runat="server"></asp:Literal></div>   
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="divSave">
                        <asp:Button ID="btnSubmit3" runat="server" Text="执行(S)" 
                            CssClass="SkyButtonFocus" onclick="btnSubmit3_Click" />
                    </div>
                </div>
            </div>
            
            <div class="divInfoContext">
                <div class="divInfo">
                    <div class="divInfoblack">
                        <div class="divInfoTopList">
                            <div class="listLeft">
                                <div class="navtitle">
                                    第4个功能：卸载DLL文件</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="divInfo">
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablist" id="Table3"
                        onmouseover="changeto()" onmouseout="changeback()">
                                   
                         <tbody  >
                            
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    操作密码<span class="fStar">*</span>
                                </td>
                                <td class="tabmanagertr">
                                     <asp:TextBox ID="txtPassword4" runat="server" Width="200px"  ToolTip="操作密码"></asp:TextBox> 为了系统安全，必须输入正确的操作密码！
                                </td>
                            </tr>
                             <tr class="tablisttr">
                            <td class="tablisttitle">
                                    操作状态
                                </td>
                                <td class="tabmanagertr">
                                    <div style="color:Red">
                                            <asp:Literal ID="LiteralInfo4" runat="server"></asp:Literal></div>   
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="divSave">
                        <asp:Button ID="btnUnLoad" runat="server" Text="执行(S)" 
                            CssClass="SkyButtonFocus" onclick="btnUnLoad_Click" />
                    </div>
                </div>
            </div>
            

            <div class="divInfoContext" >
                <div class="divInfo">
                    <div class="divInfoblack">
                        <div class="divInfoTopList">
                            <div class="listLeft">
                                <div class="navtitle">
                                    第5个功能：同步部门和人员到CRM系统</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="divInfo">
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablist" id="Table4"
                        onmouseover="changeto()" onmouseout="changeback()">
                                   
                         <tbody  >
                            
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    操作说明</td>
                                <td class="tabmanagertr">
                                     执行本操作后，系统内部的部门和人员信息将同步到CRM系统，用户可以直接到CMR系统进行操作。</td>
                            </tr>
                             <tr class="tablisttr">
                            <td class="tablisttitle">
                                    操作状态
                                </td>
                                <td class="tabmanagertr">
                                    <div style="color:Red">
                                            <asp:Literal ID="LiteralInfo5" runat="server"></asp:Literal></div>   
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="divSave">
                        <asp:Button ID="btnSubmit5" runat="server" Text="执行(S)" 
                            CssClass="SkyButtonFocus" onclick="btnSubmit5_Click" />
                    </div>
                </div>
            </div>

            <div class="divInfoContext">
                <div class="divInfo">
                    <div class="divInfoblack">
                        <div class="divInfoTopList">
                            <div class="listLeft">
                                <div class="navtitle">
                                    第6个功能：系统升级数据库</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="divInfo">
                    <table width="100%" border="0" cellpadding="0" cellspacing="1" class="tablist" 
                        >
                        <tr class="tablisttr">
                             <td class="tablisttitle" width="100px">
                                升级内容
                            </td>
                             <td class="tabmanagertr">
                                <asp:CheckBoxList ID="chkSelectUpdate" runat="server" RepeatColumns="1" 
                                            RepeatDirection="Horizontal" Width="100%">
<asp:ListItem Value="ALTER TABLE TB_OprLog  Add  UserName varchar(50);ALTER TABLE TB_Department  Add  UserID varchar(50);">2016-01-08 版本号：6.3.1.0108 ALTER TABLE TB_OprLog  Add  UserName varchar(50);ALTER TABLE TB_Department  Add  UserID varchar(50);</asp:ListItem>
<asp:ListItem Value="update TB_Department set UserID='';UPDATE TB_OprLog SET UserName=(SELECT Top 1 UserName from Tb_UserInfo U Where U.UserID=TB_OprLog.CreateBy);">2016-01-08 版本号：6.3.1.0108update TB_Department set UserID='';UPDATE TB_OprLog SET UserName=(SELECT Top 1 UserName from Tb_UserInfo U Where U.UserID=TB_OprLog.CreateBy);</asp:ListItem>


<asp:ListItem Value="ALTER TABLE TB_UserInfo  Add  LoginID varchar(50);">2015-06-02 版本号：6.0.2.0602 ALTER TABLE TB_UserInfo  Add  LoginID varchar(50);</asp:ListItem>
<asp:ListItem Value="update TB_UserInfo set LoginID = UserID;">2015-06-02 版本号：6.0.2.0602 update TB_UserInfo set LoginID = UserID;</asp:ListItem>

                                      
                                            

                                      </asp:CheckBoxList>
                                      (升级数据库请不要轻易使用，防止错误；alert和update需要分开执行，先做alert)     
                            </td>
                        </tr>
           
                         <tbody  >
                            
                            <tr class="tablisttr">
                                <td class="tablisttitle">
                                    操作密码<span class="fStar">*</span>
                                </td>
                                <td class="tabmanagertr">
                                     <asp:TextBox ID="txtPassword6" runat="server" Width="200px"  ToolTip="操作密码"></asp:TextBox> 为了系统安全，必须输入正确的操作密码！
                                </td>
                            </tr>
                            <tr class="tablisttr">
                            
                            <td class="tablisttitle">
                                    操作状态
                                </td>
                                <td class="tabmanagertr">
                                    <div style="color:Red">
                                            <asp:Literal ID="LiteralInfo6" runat="server"></asp:Literal></div>   
                                </td>
                            </tr>
                        </tbody>
                    </table>
                    <div class="divSave">
                        <asp:Button ID="btnSubmit6" runat="server" Text="执行(S)" 
                            CssClass="SkyButtonFocus" onclick="btnSubmit6_Click" />
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
</body>
</html>
