Example #1
0
    protected void btnGenerateCND_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        EBonusProcess m_process = EBonusProcess.GetObject(dbConn, CurID);

        if (m_process != null)
        {
            HROne.Import.ImportBonusProcess m_import = new HROne.Import.ImportBonusProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, CurID);

            DataSet dataSet = m_import.GenerateCND();

            string exportFileName = System.IO.Path.GetTempFileName();
            System.IO.File.Delete(exportFileName);
            exportFileName += ".xls";
            HROne.Export.ExcelExport export = new HROne.Export.ExcelExport(exportFileName);
            export.Update(dataSet);
            WebUtils.TransmitFile(Response, exportFileName, "CND_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true);
        }
        else
        {
            errors.addError("Failed to open batch");
        }
    }
    protected DataTable PrepareExportData(string pProcessName, int pPID, ArrayList pEmpList, PageErrors pErrors)
    {
        if (string.Compare(gProcessName, "BonusProcess", true) == 0) // ignore case compare
        {
            HROne.Import.ImportBonusProcess m_process = new HROne.Import.ImportBonusProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, pPID);
            if (gP1 == "S") // Standard Bonus
            {
                m_process.ClearUploadedStandardData(pErrors);
                m_process.GenerateStandardBonusData(pEmpList);
                pErrors.addError("Standard Bonus generation completed");
                return(null);
            }
            else if (gP1 == "D") // Discretionary Bonus
            {
                return(m_process.ExportDiscretionaryBonusTemplate(pEmpList, true));
            }
        }
        else if (string.Compare(gProcessName, "DoublePayAdjustment", true) == 0)
        {
            return(HROne.Import.ImportDoublePayAdjustmentProcess.ExportTemplate(dbConn, pEmpList, true));
        }
        else if (string.Compare(gProcessName, "HitRateProcess", true) == 0)
        {
            return(HROne.Import.ImportHitRateBasedPaymentProcess.ExportTemplate(dbConn, pEmpList, true));
        }

        return(null);
    }
Example #3
0
    protected void btnClearPart2Data_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        HROne.Import.ImportBonusProcess m_importProcess = new HROne.Import.ImportBonusProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, CurID);
        if (m_importProcess.ClearUploadedDiscretionaryData(errors))
        {
            errors.addError("Uploaded records cleared");
        }
        loadObject();
    }
Example #4
0
    protected void btnConfirmProcess_Click(object sender, EventArgs e)
    {
        PageErrors errors = PageErrors.getErrors(db, Page.Master);

        errors.clear();

        HROne.Import.ImportBonusProcess m_importProcess = new HROne.Import.ImportBonusProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, CurID);
        if (!m_importProcess.ConfirmBonusProcess(errors))
        {
            errors.addError("Confirm failed, please note that Bonus Process must be " + EBonusProcess.STATUS_NORMAL_DESC + " to be confirmed");
        }
        else
        {
            errors.addError("Bonus Process confirmed! It is locked and not allow for further operations");
        }


        loadObject();
    }
Example #5
0
    protected void btnExportPart1Template_Click(object sender, EventArgs e)
    {
        string exportFileName = System.IO.Path.GetTempFileName();

        System.IO.File.Delete(exportFileName);
        exportFileName += ".xls";
        HROne.Export.ExcelExport export = new HROne.Export.ExcelExport(exportFileName);
        DataSet dataSet = new DataSet();// export.GetDataSet();

        HROne.Import.ImportBonusProcess m_importProcess = new HROne.Import.ImportBonusProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID, CurID);
        DataTable m_table = m_importProcess.ExportStandardBonusTemplate(true);

        if (m_table != null)
        {
            dataSet.Tables.Add(m_table);
            export.Update(dataSet);
            WebUtils.TransmitFile(Response, exportFileName, m_table.TableName + "_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true);
        }
    }
    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);
        }
    }