<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ExamImport.aspx.cs" Inherits="RM.Web.Training.Exam.ExamImport" %>

<!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><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamImport_Title")%></title>
     <link href="/Themes/Styles/Site.css" rel="stylesheet" type="text/css" />
    <script src="/Themes/Scripts/jquery-1.8.2.min.js" type="text/javascript"></script>
    <link href="../../Themes/Scripts/artDialog/skins/opera.css" rel="stylesheet" type="text/css" />
    <script src="../../Themes/Scripts/artDialog/artDialog.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/artDialog/iframeTools.js" type="text/javascript"></script>
    <script src="/Themes/Scripts/FunctionJS.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/jQuery.lightMenu-1.0.0.min.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/jquery.form.js" type="text/javascript"></script>
    <script src="../../Themes/Scripts/ajaxfileupload.js" type="text/javascript"></script>
</head>
<body>
    <form id="myForm" runat="server">
    <div style="padding:10px;" >
    <a style=" color:Red;" href="Themes/tiku.xls"><%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamImport_muban")%></a><br /><br />
    <asp:FileUpload ID="FileUpload1"  runat="server" Style="width: 200px;" /><br /><br />
    <input type="button" value="<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamImport_shangchuan")%>" onclick="savaAndToExamEvent2()" />
    </div>
    </form>


    <script type="text/javascript">
        function savaAndToExamEvent2() {

            var file = $("#FileUpload1").val();
            if (file.length <= 0) {
                showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("ExamImport_qxzsc")%>", 3000, 3);
                return;
            }

            $.ajaxFileUpload({
                url: "ExamImport.aspx",
                secureuri: false,
                fileElementId: 'FileUpload1',
                data: "",
                dataType: 'text',
                type: 'POST',
                success: function (result, status) {                    
                var date = result.split("|");
                if(date[0]=="0"){
                    showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CG")%>", 3000, 4);
                    if (window.parent==null) {
    window.location.href="/Training/Exam/ExamImport_List.aspx";
}else {
     window.parent.frames["main"].location.href="/Training/Exam/ExamImport_List.aspx";
       OpenClose();
}
                   
                  
                }else if(date[0]=="-1"){
                    showTipsMsg(data[1], 3000, 5);
                }
                    
//              window.location.href = "/Training/TrainingTest/ExaminationPaper_Manager.aspx";
                    /*
                    var date = eval(result);
                    if (date.examId || date.length > 0) {//试卷ID
                    if (pageType) {
                    var url = "/Training/QuesNaire/Questionnaire_Form.aspx?ExamKey=" + date.examId;
                    top.openDialog(url, "ExaminationPaper_Form", "问卷信息 - 添加 ", 750, 380, 50, 50); //录入试卷信息
                    } else {
                    var url = "/Training/TrainingTest/ExaminationPaper_Form.aspx?ExamKey=" + date.examId;
                    top.openDialog(url, "ExaminationPaper_Form", "试卷信息 - 添加 ", 750, 380, 50, 50); //录入试卷信息
                    }
                    return;
                    } else {
                    resultStr = "数据异常，请检查您的数据信息，或稍候刷新页面重新尝试";
                    showTipsMsg(resultStr, 3000, 5);
                    }*/
                },
                error: function (result, status, e) {
                    var date = result.responseText.split("|");
                    if(date[0]=="-1"){
                        resultStr=date[1].split("。")[0];
                    }else if(date[0]=="0"){
                        showTipsMsg("<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("CG")%>", 3000, 4);
//                        OpenClose();
                    }else{
                        resultStr = "<%=RM.Common.DotNetConfig.LanguageHelper.GetKey("Abnormal network connection")%>" + result;
                    }
                    showTipsMsg(resultStr, 3000, 5);
                }
            });
        }

    </script>
</body>
</html>
