protected void Upload_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(EEmpPersonalInfo.db, Page.Master); errors.clear(); if (FileUploadControl.HasFile) { string strTmpFolder = HROne.Common.Folder.GetOrCreateSessionTempFolder(Session.SessionID).FullName; //Environment.GetFolderPath(Environment.SpecialFolder.InternetCache); string strTmpFile = System.IO.Path.Combine(strTmpFolder, AppUtils.ServerDateTime().ToString("~yyyyMMddHHmmss_") + FileUploadControl.FileName); FileUploadControl.SaveAs(strTmpFile); string ZipPassword = ""; DataTable rawDataTable = HROne.Import.ExcelImport.parse(strTmpFile, ZipPassword).Tables[0]; if (string.Compare(gProcessName, "BonusProcess", true) == 0) { HROne.Import.ImportBonusProcess m_importProcess = new HROne.Import.ImportBonusProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, gPID); m_importProcess.ImportEmpBonusProcess(gPID, rawDataTable, gP1, errors); } else if (string.Compare(gProcessName, "DoublePayAdjustment", true) == 0) { HROne.Import.ImportDoublePayAdjustmentProcess m_importProcess = new HROne.Import.ImportDoublePayAdjustmentProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID); m_importProcess.UploadToTempDatabase(rawDataTable, WebUtils.GetCurUser(Session).UserID); } System.IO.File.Delete(strTmpFile); if (errors.isEmpty()) { errors.addError("Import Completed"); } } else { errors.addError(HROne.Translation.PageErrorMessage.ERROR_INVALID_FILE); } }
public static void ClearTempTable(DatabaseConnection dbConn, string sessionID) { ImportDoublePayAdjustmentProcess import = new ImportDoublePayAdjustmentProcess(dbConn, sessionID, 0); import.ClearTempTable(); }