Exemplo n.º 1
0
    public int Execute()
    {
        string    strGUID       = Guid.NewGuid().ToString();
        int       realImportNum = 0;
        Excel     _excel        = new Excel();
        DataTable dt            = new DataTable();

        switch (TextType)
        {
        case "ASTM":
            s_ASTM ASTM = new s_ASTM();
            realImportNum = ASTM.Execute(IiSheet, strGUID);
            break;

        case "Digitimes":
            s_Digitimes Digi = new s_Digitimes();
            realImportNum = Digi.Execute(IiSheet, strGUID);
            break;

        case "EV":
            s_EV EV = new s_EV();
            realImportNum = EV.Execute(IiSheet, strGUID);
            break;

        case "Goldfire":
            s_IHS IHS = new s_IHS();
            realImportNum = IHS.Execute(IiSheet, strGUID);
            break;

        case "JCR":
            s_JCR JCR = new s_JCR();
            realImportNum = JCR.Execute(IiSheet, strGUID);
            break;

        case "nature":
            s_nature nature = new s_nature();
            realImportNum = nature.Execute(IiSheet, strGUID);
            break;

        case "Oxford":
            s_Oxford Oxford = new s_Oxford();
            realImportNum = Oxford.Execute(IiSheet, strGUID);
            break;

        case "Science":
            s_Science Science = new s_Science();
            realImportNum = Science.Execute(IiSheet, strGUID);
            break;

        //
        //phase II below
        //
        case "ACM":
            s_ACM ACM = new s_ACM();
            realImportNum = ACM.Execute(IiSheet, strGUID);
            break;

        case "ACS":
            s_ACS ACS = new s_ACS();
            realImportNum = ACS.Execute(IiSheet, strGUID);
            break;

        case "IEEE":
            s_IEEE IEEE = new s_IEEE();
            realImportNum = IEEE.Execute(IiSheet, strGUID);
            break;

        case "SDOL":
            s_SDOL SDOL = new s_SDOL();
            realImportNum = SDOL.Execute(IiSheet, strGUID);
            break;

        case "SPIE":
            s_SPIE SPIE = new s_SPIE();
            realImportNum = SPIE.Execute(IiSheet, strGUID);
            break;

        case "TI":
            s_TI TI = new s_TI();
            realImportNum = TI.Execute(IiSheet, strGUID);
            break;

        case "Wiley":
            s_Wiley Wiley = new s_Wiley();
            realImportNum = Wiley.Execute(IiSheet, strGUID);
            break;

        case "天下":
            s_TangShang TangShang = new s_TangShang();
            realImportNum = TangShang.Execute(IiSheet, strGUID);
            break;

        case "萬方":
            s_WangFang WangFang = new s_WangFang();
            realImportNum = WangFang.Execute(IiSheet, strGUID);
            break;

        case "通用":
            dt = _excel.ImportExecl(IiSheet);
            s_Utility Utility = new s_Utility();
            realImportNum = Utility.Execute(dt, strGUID, Year, Month);
            break;

        case "工程":
            dt = _excel.ImportExecl(IiSheet);
            s_Engineering Engineering = new s_Engineering();
            realImportNum = Engineering.Execute(dt, strGUID);
            break;

        case "聯合知識庫":
            dt = _excel.ImportExecl(IiSheet);
            s_Union Union = new s_Union();
            realImportNum = Union.Execute(dt, strGUID);
            break;

        case "SciFinder":
            dt = _excel.ImportExecl(IiSheet);
            s_SciFinder SciFinder = new s_SciFinder();
            realImportNum = SciFinder.Execute(dt, strGUID);
            break;
        }

        //每一次匯入都要做log,判斷等不等於零是因為沒資料就不要做log
        if (TextType.Trim() != "通用" && realImportNum != 0)
        {
            string   yearMonth = Year + Month + "01";
            DateTime dTime     = DateTime.ParseExact(yearMonth, "yyyyMMdd", CultureInfo.InvariantCulture);
            //通用的log自己在裡面做
            saveLog(realImportNum, strGUID, TextType, dTime);
        }

        //做完匯入之後再把工研人塞入
        UpdateEmpno(strGUID);

        //由於在通用的表單裡面,有些資料會有email,但是沒IP跟工號,
        //而也有可能是有工號沒IP沒EMAIL
        //所以要再等根據IP更新之後
        //2016/02/02 由於Goldfile有可能會用中文姓名+部門+單位來當WHERE條件,所以在這裡多一步去補上
        if ((TextType.Trim() == "通用" ||
             TextType.Trim() == "Goldfire" ||
             TextType.Trim() == "TI" ||
             TextType.Trim() == "聯合知識庫" ||
             TextType.Trim() == "SciFinder") && realImportNum != 0)
        {
            UpdateUtility(strGUID);
        }
        return(realImportNum);
    }