コード例 #1
0
    Boolean ImportFile(string strFilePath1)
    {
        string         _yrmo       = Session["yrmo"].ToString();
        string         logFilePath = Server.MapPath("~/uploads/") + "YEB_Expat_" + _yrmo + ".xls";
        bool           importStat  = false;
        ImportYEBData  iObj        = new ImportYEBData();
        HRAExcelImport tObj        = new HRAExcelImport();
        DataTable      dtYEBEXPAT;
        DataSet        ds = new DataSet(); ds.Clear();

        ds         = tObj.getExcelData(strFilePath1, "YEBEXPATTable");
        dtYEBEXPAT = ds.Tables["YEBEXPATTable"];
        if (dtYEBEXPAT.Rows.Count > 0)
        {
            ImportYEBData.Rollback(source, _yrmo);
            ImportYEBData.PrintExpatProgressBar();
            //http://www.eggheadcafe.com/articles/20051223.asp

            _counter = iObj.insertYEBExpatData(dtYEBEXPAT);
            Thread.Sleep(2000);
            ImportYEBData.ClearProgressBar(_counter);
            //Now update the YEbDetailtable with the matches
            //found in the YEBExpat table
            ImportYEBData.updateYEBDetailData(_yrmo, "YEBEXPAT");
        }

        if (File.Exists(logFilePath))
        {
            File.Delete(logFilePath);
        }

        importStat = true;

        Session["taskId"] = Convert.ToInt32(Session["taskId"]) + 1;
        Audit.auditUserTaskI(Session.SessionID, Session["mid"].ToString(), Session["taskId"].ToString(), "YEB", "ImportSourceFile", "YEB_EXPAT", "YEBEXPAT Import", _yrmo, _counter);

        return(importStat);
    }