protected void OK_Click(object sender, EventArgs e) { WebUtils.HROneDBConfigUIInterface ui; if (true) //MSSQL { ui = DBConfig_SQLServer1; } if (ui != null) { try { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); DatabaseConfig dbConfig = ui.GenerateDBType(); dbConfig.name = txtName.Text.Trim(); config.DatabaseConfigList.Add(dbConfig); config.Save(); //HROne.DataAccess.DatabaseConnection.SetDefaultDatabaseConnection(WebUtils.GetDatabaseConnection()); Session.Abandon(); HttpRuntime.UnloadAppDomain(); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Default.aspx"); } catch (Exception ex) { Message.Text = ex.Message; Message.ForeColor = System.Drawing.Color.Red; } } else { } }
public static DatabaseConnection GetDatabaseConnection(string DatabaseName) { HROneConfig configure = HROneConfig.GetCurrentHROneConfig(); DatabaseConnection DBType = configure.GetDatabaseConnection(DatabaseName); return(DBType); }
protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) { if (Request.Url.LocalPath.EndsWith(".aspx")) { DatabaseConnection dbConn; if (Request["Database"] != null) { dbConn = WebUtils.GetDatabaseConnection(Request["Database"]); WebUtils.Logout(Session); if (dbConn != null) { WebUtils.SetSessionDatabaseConnection(Session, dbConn); } } else { dbConn = HROne.Common.WebUtility.GetDatabaseConnection(Session); } if (dbConn != null) { //DatabaseConnection.SetDefaultDatabaseConnection(dbConn); if (!Request.Url.LocalPath.EndsWith("/DatabaseUpgrade.aspx", StringComparison.CurrentCultureIgnoreCase)) { HROne.ProductVersion.Database database = new HROne.ProductVersion.Database(dbConn); if (database.IsUpdateRequired() && Session["NeedDBUpgrade"] != null) { if (Session["NeedDBUpgrade"].Equals(true)) { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/DatabaseUpgrade.aspx"); } } } } if (!Request.Url.LocalPath.EndsWith("/DatabaseConfiguration.aspx", StringComparison.CurrentCultureIgnoreCase) && !Request.Url.LocalPath.EndsWith("/SelectDatabase.aspx", StringComparison.CurrentCultureIgnoreCase)) { if (Application["MasterDBConfig"] == null) { HROneConfig configure = HROneConfig.GetCurrentHROneConfig(); if (configure.DatabaseConfigList.Count < 1) { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/DatabaseConfiguration.aspx"); } //else // HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/SelectDatabase.aspx"); } //if (Request.Url.LocalPath.IndexOf("/Login.aspx") < 0) //{ // string LastPath = Request.Url.PathAndQuery; // if (Request.Url.LocalPath.IndexOf("/Default.aspx") > 0 || Request.Url.LocalPath.EndsWith("/")) // Response.Redirect("~/Login.aspx"); // else // HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Login.aspx?LastURL=" + LastPath); //} } HROne.Common.WebUtility.initLanguage(Session); } }
protected void Page_Load(object sender, EventArgs e) { //Logout previous session if (!IsPostBack) { if (Session["User"] != null) { WebUtils.Logout(Session); Request.Cookies.Remove(HROne.Common.WebUtility.getDefaultSessionCookieName()); Response.Redirect(Request.Url.PathAndQuery); } } if (Application["MasterDBConfig"] == null) { SaaSCustomerIDRow.Visible = false; DatabaseConnection dbConn = WebUtils.GetDatabaseConnection(); if (dbConn != null) { multiDBRow.Visible = false; string dbTitle = HROne.Lib.Entities.ESystemParameter.getParameter(dbConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_DB_TITLE); if (!string.IsNullOrEmpty(dbTitle)) { Page.Title += " (" + dbTitle + ")"; } } else { multiDBRow.Visible = true; if (!IsPostBack) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); for (int idx = 0; idx < config.DatabaseConfigList.Count; idx++) { DatabaseConfig dbConfig = config.DatabaseConfigList[idx]; cboDatabase.Items.Add(new ListItem(dbConfig.name, idx.ToString())); } } } } else { SaaSCustomerIDRow.Visible = true; multiDBRow.Visible = false; Page.Title = "iMGR"; } lblVersionNo.Text = ProductVersion.CURRENT_PROGRAM_VERSION; this.form1.Attributes.Add("AUTOCOMPLETE", "OFF"); Password.Attributes.Add("onfocus", "this.select();"); HROne.Common.WebUtility.AddBrowserCompatibilityMeta(Page); }
public static void SetSessionDatabaseConnection(HttpSessionState Session, DatabaseConnection dbConn) { Session["DatabaseConnection"] = dbConn; //DatabaseConnection.SetDefaultDatabaseConnection(dbConn); WebUtils.LoadProductKey(Session); WebUtils.SetSessionLanguage(Session, null); HROneConfig config = HROneConfig.GetCurrentHROneConfig(); Session["EncryptQueryString"] = config.EncryptedURLQueryString; //WebUtils.SetSessionLanguage(Session, null); }
protected void Session_End(Object sender, EventArgs e) { Application.Lock(); Application["ActiveUsers"] = (int)Application["ActiveUsers"] - 1; if ((int)Application["ActiveUsers"] == 0) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.ShutDownDomainAfterUsed) { HttpRuntime.UnloadAppDomain(); } } Application.UnLock(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.AllowMultiDB) { DBNameRow.Visible = true; } else { DBNameRow.Visible = false; } } HROne.Common.WebUtility.AddBrowserCompatibilityMeta(Page); }
public static void ReportExport(HttpResponse Response, HROne.Common.GenericReportProcess reportProcess, string reportTemplateFileName, string ExportFormat, string OutputFilenamePrefix, bool IsLocalize) { if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); HROne.Common.GenericReportProcess.UsePDFCreator = config.UsePDFCreator; if (config.UsePDFCreator) { HROne.Common.PDFCreaterPrinter.PDFCreaterPrinterName = config.PDFCreatorPrinterName; } string exportFileName = reportProcess.ReportExportToFile(reportTemplateFileName, ExportFormat, IsLocalize); string exportFileNameExtension = exportFileName.Substring(exportFileName.LastIndexOf(".")); WebUtils.TransmitFile(Response, exportFileName, OutputFilenamePrefix + "_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + exportFileNameExtension, true); } }
protected void Application_Start(Object sender, EventArgs e) { Application["ActiveUsers"] = 0; //HROne.DataAccess.DatabaseConnection dbConn = WebUtils.GetDatabaseConnection(); //perspectivemind.common.Debug.debug = true; HROne.Common.Folder.ClearApplicationTempFolder(); HROneConfig configure = HROneConfig.GetCurrentHROneConfig(); // Start 0000134, Ricky So, 2014-11-21 HROne.DataAccess.DBAESEncryptStringFieldAttribute.skipEncryptionToDB = configure.SkipEncryptionToDB; // End 0000134, Ricky So, 2014-11-21 HROne.DataAccess.DBAESEncryptStringFieldAttribute.RSAEncryptedKeyString = configure.databaseEncryptKey; if (configure.MasterDatabaseConfig != null) { Application["MasterDBConfig"] = configure.MasterDatabaseConfig; DatabaseConnection MasterDBConn = configure.MasterDatabaseConfig.CreateDatabaseConnectionObject(); AppUtils.DefaultDocumentUploadFolder = HROne.SaaS.Entities.ESystemParameter.getParameter(MasterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_DEFAULT_DOCUMENT_FOLDER); // force RSA mode on SaaS if (string.IsNullOrEmpty(configure.databaseEncryptKey)) { HROne.DataAccess.DBAESEncryptStringFieldAttribute.RSAEncryptedKeyString = "0123456789abcdef"; } } // run Import_Employee.sql ONLY when there is a DB patch //foreach (DatabaseConfig dbConfig in configure.DatabaseConfigList) //{ // if (dbConfig.TestConnection()) // { // HROne.ProductVersion.Database database = new HROne.ProductVersion.Database(dbConfig.CreateDatabaseConnectionObject()); // try // { // database.RunDataPatch("Import_Employee.sql"); // //WebUtils.ClearTempTable(dbConfig.CreateDatabaseConnectionObject(), string.Empty); // } // catch (Exception ex) // { // System.Diagnostics.Debug.WriteLine(ex.Message); // } // } //} }
protected void Application_Start(Object sender, EventArgs e) { Application["ActiveUsers"] = 0; HROneConfig configure = HROneConfig.GetCurrentHROneConfig(); // Start 0000134, Ricky So, 2014-11-21 HROne.DataAccess.DBAESEncryptStringFieldAttribute.skipEncryptionToDB = configure.SkipEncryptionToDB; // End 0000134, Ricky So, 2014-11-21 HROne.DataAccess.DBAESEncryptStringFieldAttribute.RSAEncryptedKeyString = configure.databaseEncryptKey; if (configure.MasterDatabaseConfig != null) { Application["MasterDBConfig"] = configure.MasterDatabaseConfig; DatabaseConnection MasterDBConn = configure.MasterDatabaseConfig.CreateDatabaseConnectionObject(); AppUtils.DefaultDocumentUploadFolder = HROne.SaaS.Entities.ESystemParameter.getParameter(MasterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_DEFAULT_DOCUMENT_FOLDER); // force RSA mode on SaaS if (string.IsNullOrEmpty(configure.databaseEncryptKey)) { HROne.DataAccess.DBAESEncryptStringFieldAttribute.RSAEncryptedKeyString = "0123456789abcdef"; } } }
protected void Session_End(Object sender, EventArgs e) { HROne.Common.Folder.GetOrCreateSessionTempFolder(Session.SessionID).Delete(true); DatabaseConnection dbConn = HROne.Common.WebUtility.GetDatabaseConnection(Session); if (dbConn != null) { WebUtils.ClearTempTable(dbConn, Session.SessionID); } Application.Lock(); Application["ActiveUsers"] = (int)Application["ActiveUsers"] - 1; if ((int)Application["ActiveUsers"] == 0) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.ShutDownDomainAfterUsed) { HttpRuntime.UnloadAppDomain(); } } Application.UnLock(); }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(EEmpPersonalInfo.db, Repeater, "ItemSelect"); if (list.Count > 0) { HROne.Reports.Payroll.PaymentSummaryListProcess reportProcess; if (Payroll_PeriodSelectionList1.SelectedPayrollStatus.Equals("T")) { reportProcess = new HROne.Reports.Payroll.PaymentSummaryListProcess(dbConn, ci, list, HROne.Reports.Payroll.PaymentSummaryListProcess.ReportType.TrialRun, Payroll_PeriodSelectionList1.GetTrialRunPayPeriodList(), null); } else { reportProcess = new HROne.Reports.Payroll.PaymentSummaryListProcess(dbConn, ci, list, HROne.Reports.Payroll.PaymentSummaryListProcess.ReportType.History, null, Payroll_PeriodSelectionList1.GetPayBatchList()); } if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenericExcelReportTaskFactory reportTask = new HROne.TaskService.GenericExcelReportTaskFactory(dbConn, user, lblReportHeader.Text, reportProcess, "PaymentList"); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { System.IO.FileInfo excelFile = reportProcess.GenerateExcelReport(); WebUtils.TransmitFile(Response, excelFile.FullName, "PaymentList_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } } // const string PAYMENTCODE_PREFIX = "[Payment] "; // string exportFileName = System.IO.Path.GetTempFileName(); // System.IO.File.Delete(exportFileName); // exportFileName += ".xls"; // //System.IO.File.Copy(Server.MapPath("~/template/HistoryList_Template.xls"), exportFileName, true); // HROne.Export.ExcelExport export = new HROne.Export.ExcelExport(exportFileName); // DataSet dataSet = new DataSet(); //export.GetDataSet(); // DataTable dataTable = new DataTable("Payroll$"); // dataSet.Tables.Add(dataTable); // dataTable.Columns.Add("Company", typeof(string)); // DBFilter hierarchyLevelFilter = new DBFilter(); // Hashtable hierarchyLevelHashTable = new Hashtable(); // hierarchyLevelFilter.add("HLevelSeqNo", true); // ArrayList hierarchyLevelList = EHierarchyLevel.db.select(dbConn, hierarchyLevelFilter); // foreach (EHierarchyLevel hlevel in hierarchyLevelList) // { // dataTable.Columns.Add(hlevel.HLevelDesc, typeof(string)); // hierarchyLevelHashTable.Add(hlevel.HLevelID, hlevel); // } // dataTable.Columns.Add("Payroll Group", typeof(string)); // dataTable.Columns.Add("Position", typeof(string)); // dataTable.Columns.Add("EmpNo", typeof(string)); // dataTable.Columns.Add("English Name", typeof(string)); // dataTable.Columns.Add("Chinese Name", typeof(string)); // dataTable.Columns.Add("HKID", typeof(string)); // dataTable.Columns.Add("From", typeof(DateTime)); // dataTable.Columns.Add("To", typeof(DateTime)); // int firstSummaryColumnPos = dataTable.Columns.Count; // dataTable.Columns.Add("Net Payment", typeof(double)); // dataTable.Columns.Add("Relevant Income", typeof(double)); // dataTable.Columns.Add("Non-Relevant Income", typeof(double)); // dataTable.Columns.Add("Wages Payable for Min Wages", typeof(double)); // dataTable.Columns.Add("Total Hours Worked", typeof(double)); // dataTable.Columns.Add("Min Wages Required", typeof(double)); // dataTable.Columns.Add("Employer Mandatory Contribution", typeof(double)); //// dataTable.Columns.Add("Employee Mandatory Contribution", typeof(double)); // dataTable.Columns.Add("Employer Voluntary Contribution", typeof(double)); //// dataTable.Columns.Add("Employee Voluntary Contribution", typeof(double)); // dataTable.Columns.Add("Employer P-Fund Contribution", typeof(double)); //// dataTable.Columns.Add("Employee P-Fund Contribution", typeof(double)); // dataTable.Columns.Add("Total Employer Contribution", typeof(double)); // dataTable.Columns.Add("Total Employee Contribution", typeof(double)); // dataTable.Columns.Add("Total Taxable Payment", typeof(double)); // dataTable.Columns.Add("Total Non-Taxable Payment", typeof(double)); // int firstDetailColumnPos = dataTable.Columns.Count; // foreach (EEmpPersonalInfo empInfo in list) // { // EEmpPersonalInfo.db.select(dbConn, empInfo); // DBFilter empPayrollFilterForPayrollPeriod = new DBFilter(); // empPayrollFilterForPayrollPeriod.add(new Match("ep.EmpID", empInfo.EmpID)); // empPayrollFilterForPayrollPeriod.add(Payroll_PeriodSelectionList1.GetEmpPayrollDBTerm()); // DBFilter payPeriodFilter = new DBFilter(); // payPeriodFilter.add(new IN("PayPeriodID", "SELECT PayPeriodID from " + EEmpPayroll.db.dbclass.tableName + " ep", empPayrollFilterForPayrollPeriod)); // ArrayList payPeriodList = EPayrollPeriod.db.select(dbConn, payPeriodFilter); // foreach (EPayrollPeriod payPeriod in payPeriodList) // { // if (EPayrollPeriod.db.select(dbConn, payPeriod)) // { // EPayrollGroup payrollGroup = new EPayrollGroup(); // payrollGroup.PayGroupID = payPeriod.PayGroupID; // EPayrollGroup.db.select(dbConn, payrollGroup); // DataRow row = dataTable.NewRow(); // row["EmpNo"] = empInfo.EmpNo; // row["English Name"] = empInfo.EmpEngFullName; // row["Chinese Name"] = empInfo.EmpChiFullName; // row["HKID"] = empInfo.EmpHKID; // row["From"] = payPeriod.PayPeriodFr; // row["To"] = payPeriod.PayPeriodTo; // row["Payroll Group"] = payrollGroup.PayGroupDesc; // DBFilter empPosFilter = new DBFilter(); // EEmpPositionInfo empPos = AppUtils.GetLastPositionInfo(dbConn, payPeriod.PayPeriodTo, empInfo.EmpID); // if (empPos != null) // { // ECompany company = new ECompany(); // company.CompanyID = empPos.CompanyID; // if (ECompany.db.select(dbConn, company)) // row["Company"] = company.CompanyCode; // DBFilter empHierarchyFilter = new DBFilter(); // empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID)); // ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter); // foreach (EEmpHierarchy empHierarchy in empHierarchyList) // { // EHierarchyLevel hierarchyLevel = (EHierarchyLevel)hierarchyLevelHashTable[empHierarchy.HLevelID]; // if (hierarchyLevel != null) // { // EHierarchyElement hierarchyElement = new EHierarchyElement(); // hierarchyElement.HElementID = empHierarchy.HElementID; // if (EHierarchyElement.db.select(dbConn, hierarchyElement)) // row[hierarchyLevel.HLevelDesc] = hierarchyElement.HElementDesc; // } // } // EPosition position = new EPosition(); // position.PositionID = empPos.PositionID; // if (EPosition.db.select(dbConn, position)) // row["Position"] = position.PositionDesc; // } // double netAmount = 0, releventIncome = 0, nonRelevantIncome = 0, taxableAmount = 0, nonTaxableAmount = 0; // double mcER = 0, mcEE = 0; // double vcER = 0, vcEE = 0; // double pFundER = 0, pFundEE = 0; // DBFilter empPayrollFilterForPaymentRecord = new DBFilter(empPayrollFilterForPayrollPeriod); // empPayrollFilterForPaymentRecord.add(new Match("PayPeriodID", payPeriod.PayPeriodID)); // DBFilter paymentRecordFilter = new DBFilter(); // paymentRecordFilter.add(new IN("EmpPayrollID", "Select EmpPayrollID from " + EEmpPayroll.db.dbclass.tableName + " ep ", empPayrollFilterForPaymentRecord)); // paymentRecordFilter.add(new Match("PayRecStatus", "A")); // ArrayList paymentRecords = EPaymentRecord.db.select(dbConn, paymentRecordFilter); // foreach (EPaymentRecord paymentRecord in paymentRecords) // { // EPaymentCode payCode = new EPaymentCode(); // payCode.PaymentCodeID = paymentRecord.PaymentCodeID; // EPaymentCode.db.select(dbConn, payCode); // // Always Use Payment Code Description for grouping payment code with same description // string fieldName = PAYMENTCODE_PREFIX + payCode.PaymentCodeDesc; // if (dataTable.Columns[fieldName] == null) // dataTable.Columns.Add(new DataColumn(fieldName, typeof(double))); // if (row[fieldName] == null || row[fieldName] == DBNull.Value) // row[fieldName] = 0; // row[fieldName] = (double)row[fieldName] + paymentRecord.PayRecActAmount; // netAmount += paymentRecord.PayRecActAmount; // if (payCode.PaymentCodeIsMPF) // releventIncome += paymentRecord.PayRecActAmount; // else // nonRelevantIncome += paymentRecord.PayRecActAmount; // DBFilter taxPaymentMapFilter = new DBFilter(); // taxPaymentMapFilter.add(new Match("PaymentCodeID", paymentRecord.PaymentCodeID)); // if (ETaxPaymentMap.db.count(dbConn, taxPaymentMapFilter) > 0) // taxableAmount += paymentRecord.PayRecActAmount; // else // nonTaxableAmount += paymentRecord.PayRecActAmount; // } // row["Net Payment"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(netAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // row["Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(releventIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // row["Non-Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(nonRelevantIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // row["Wages Payable for Min Wages"] = PayrollProcess.GetTotalWagesWithoutRestDayPayment(dbConn, empInfo.EmpID, payPeriod.PayPeriodFr, payPeriod.PayPeriodTo, null); // row["Total Hours Worked"] = PayrollProcess.GetTotalEmpPayrollWorkingHours(dbConn, empInfo.EmpID, payPeriod.PayPeriodID); // row["Min Wages Required"] = (double)row["Total Hours Worked"] * PayrollProcess.GetMinimumWages(dbConn, empInfo.EmpID, payPeriod.PayPeriodTo); // row["Total Taxable Payment"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(taxableAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // row["Total Non-Taxable Payment"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(nonTaxableAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // DBFilter mpfRecordFilter = new DBFilter(); // mpfRecordFilter.add(new IN("EmpPayrollID", "Select EmpPayrollID from " + EEmpPayroll.db.dbclass.tableName + " ep ", empPayrollFilterForPaymentRecord)); // ArrayList mpfRecords = EMPFRecord.db.select(dbConn, mpfRecordFilter); // foreach (EMPFRecord mpfRecord in mpfRecords) // { // vcER += mpfRecord.MPFRecActVCER; // mcER += +mpfRecord.MPFRecActMCER; // vcEE += mpfRecord.MPFRecActVCEE; // mcEE += mpfRecord.MPFRecActMCEE; // } // ArrayList orsoRecords = EORSORecord.db.select(dbConn, mpfRecordFilter); // foreach (EORSORecord orsoRecord in orsoRecords) // { // pFundER += orsoRecord.ORSORecActER; // pFundEE += orsoRecord.ORSORecActEE; // } // row["Employer Mandatory Contribution"] = mcER; // // row["Employee Mandatory Contribution"] = mcEE; // row["Employer Voluntary Contribution"] = vcER; // // row["Employee Voluntary Contribution"] = vcEE; // row["Employer P-Fund Contribution"] = pFundER; // // row["Employee P-Fund Contribution"] = pFundEE; // row["Total Employer Contribution"] = mcER + vcER + pFundER; // row["Total Employee Contribution"] = mcEE + vcEE + pFundEE; // dataTable.Rows.Add(row); // } // } // } // DBFilter paymentCodeFilter = new DBFilter(); // paymentCodeFilter.add("PaymentCodeDisplaySeqNo", false); // paymentCodeFilter.add("PaymentCode", false); // ArrayList paymentCodeList = EPaymentCode.db.select(dbConn, paymentCodeFilter); // foreach (EPaymentCode paymentCode in paymentCodeList) // { // if (dataTable.Columns.Contains(PAYMENTCODE_PREFIX + paymentCode.PaymentCodeDesc)) // { // DataColumn paymentColumn = dataTable.Columns[PAYMENTCODE_PREFIX + paymentCode.PaymentCodeDesc]; // paymentColumn.SetOrdinal(firstDetailColumnPos); // if (!dataTable.Columns.Contains(paymentCode.PaymentCodeDesc)) // paymentColumn.ColumnName = paymentCode.PaymentCodeDesc; // else // { // System.Diagnostics.Debug.Write("System reserved payment column is used"); // } // } // } // for (int i = 0; i < firstDetailColumnPos; i++) // dataTable.Columns[i].ColumnName = HROne.Common.WebUtility.GetLocalizedString(dataTable.Columns[i].ColumnName); // for (int i = firstSummaryColumnPos; i < firstDetailColumnPos; i++) // dataTable.Columns[firstSummaryColumnPos].SetOrdinal(dataTable.Columns.Count - 1); // export.Update(dataSet); // WebUtils.TransmitFile(Response, exportFileName, "PaymentList_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); // return; } else { errors.addError("Employee not selected"); } }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); string functionList = string.Empty; foreach (ListItem item in FunctionID.Items) { if (item.Selected) { if (item.Value.Equals(string.Empty)) { functionList = string.Empty; break; } else { if (string.IsNullOrEmpty(functionList)) { functionList = item.Value; } else { functionList += "," + item.Value; } } } } string userList = string.Empty; foreach (ListItem item in UserID.Items) { if (item.Selected) { if (item.Value.Equals(string.Empty)) { userList = null; break; } else { if (string.IsNullOrEmpty(userList)) { userList = item.Value; } else { userList += "," + item.Value; } } } } DateTime dtPeriodFr, dtPeriodTo; if (!DateTime.TryParse(CreateDateFrom.Value, out dtPeriodFr)) { dtPeriodFr = new DateTime(); } if (!DateTime.TryParse(CreateDateTo.Value, out dtPeriodTo)) { dtPeriodTo = new DateTime(); } HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.Lib.AuditTrailReportProcess process = new HROne.Lib.AuditTrailReportProcess(dbConn, null, functionList, userList, dtPeriodFr, dtPeriodTo, EmpNo.Text.Trim(), chkShowHeaderOnly.Checked, chkShowKeyIDOnly.Checked, chkDoNotConvertID.Checked, chkShowWithoutDataUpdate.Checked); HROne.TaskService.AuditTrailTaskFactory task = new HROne.TaskService.AuditTrailTaskFactory(dbConn, user, lblReportHeader.Text, process); AppUtils.reportTaskQueueService.AddTask(task); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/download"; //Fixed download problem on https Response.AddHeader("Content-Disposition", "attachment;filename=AuditTrail_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".txt"); Response.Expires = -1; HROne.Lib.AuditTrailReportProcess process = new HROne.Lib.AuditTrailReportProcess(dbConn, Response.Output, functionList, userList, dtPeriodFr, dtPeriodTo, EmpNo.Text.Trim(), chkShowHeaderOnly.Checked, chkShowKeyIDOnly.Checked, chkDoNotConvertID.Checked, chkShowWithoutDataUpdate.Checked); process.Updated += new EventHandler(OnProcessUpdated); process.GenerateToFile(); Response.End(); } }
protected void btnGenerateFile_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); int taxFormID; if (!int.TryParse(TaxFormID.SelectedValue, out taxFormID)) { errors.addError("Year Return is not selected"); } else if (taxFormID <= 0) { errors.addError("Year Return is not selected"); } string taxFileFormat = TaxFileFormat.SelectedValue; if (taxFileFormat == "") { errors.addError("File Format is not selected"); } //if (errors.isEmpty()) //{ // // skip converting content to big5. // // It should be done inside HROne.Taxation.TaxationGeneration.GenerateTaxationFileData function // System.Text.Encoding big5 = HROne.Taxation.TaxationGeneration.GetTaxationFileEncoding(); // //Encoding utf8 = System.Text.Encoding.GetEncoding("utf-8"); // string taxFileData = HROne.Taxation.TaxationGeneration.GenerateTaxationFileData(dbConn, taxFormID); // //byte[] taxFileByteArray = utf8.GetBytes(taxFileData); // //byte[] taxFileByteArrayBig5 = System.Text.Encoding.Convert(utf8, big5, taxFileByteArray); // byte[] taxFileByteArrayBig5 = big5.GetBytes(taxFileData); // char[] taxFileCharArrayBig5 = big5.GetChars(taxFileByteArrayBig5); // Response.Clear(); // Response.ContentEncoding = big5; // Response.AddHeader("Content-Type", "text/plain"); // Response.AddHeader("Content-Disposition", "attachment;filename=TaxationFile" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".txt"); // Response.AppendHeader("Content-Length", taxFileByteArrayBig5.Length.ToString()); // Response.Expires = -1; // Response.Write(taxFileCharArrayBig5, 0, taxFileCharArrayBig5.Length); // Response.End(); //} if (errors.isEmpty() && Response.IsClientConnected) { ESystemParameter.setParameter(dbConn, TAXATION_NAME_OF_SIGNATURE, txtNameOfSignature.Text); HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.TaxationDiskTaskFactory reportTask = new HROne.TaskService.TaxationDiskTaskFactory(dbConn, user, lblReportHeader.Text + " ( " + TaxFormID.SelectedItem.Text + " ) " + TaxFileFormat.SelectedItem.Text, taxFormID, txtNameOfSignature.Text, taxFileFormat); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { HROne.Taxation.TaxationDiskProcess process = new HROne.Taxation.TaxationDiskProcess(dbConn, taxFormID); if (taxFileFormat.Equals("TEXT", StringComparison.CurrentCultureIgnoreCase)) { string outputFileName = "TaxationFile_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".txt"; WebUtils.TransmitFile(Response, process.GenerateToFile(), outputFileName, true); } else if (taxFileFormat.Equals("XML", StringComparison.CurrentCultureIgnoreCase)) { // generate taxation file in XML format string outputFileName = "TaxationFile_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xml"; WebUtils.TransmitFile(Response, process.GenerateToXML(), outputFileName, true); } } } }
//public bool ValidateUser(string username, string encryptedPassword) //{ // string message = string.Empty; // DBFilter filter = new DBFilter(); // filter.add(new Match("LoginID", username)); // filter.add(new Match("UserAccountStatus", "<>", "D")); // ArrayList list = EUser.db.select(dbConn, filter); // if (list.Count == 0) // { // message = "Invalid User Name or Password"; // throw new Exception(message); // return; // } // EUser user = (EUser)list[0]; // if (user.UserPassword == null) // user.UserPassword = ""; // if (!(user.UserAccountStatus == "A")) // { // message = "Account is Inactive/Locked"; // throw new Exception(message); // return; // } // if (!user.UserPassword.Equals(encryptedPassword)) // { // message = "Invalid User Name or Password"; // user.FailCount++; // string maxFailCountParameterString = ESystemParameter.getParameter(ESystemParameter.PARAM_CODE_LOGIN_MAX_FAIL_COUNT); // if (!maxFailCountParameterString.Equals(string.Empty)) // { // int MaxFailCount = 0; // if (int.TryParse(maxFailCountParameterString, out MaxFailCount)) // if (MaxFailCount > 0) // if (user.FailCount >= MaxFailCount) // { // user.UserAccountStatus = "I"; // user.FailCount = 0; // } // else if (user.FailCount - MaxFailCount == 1) // { // message += "\r\n" + "The account will be locked if you fail to login 1 more time"; // } // } // EUser.db.update(dbConn, user); // throw new Exception(message); // return; // } // Session["User"] = user; // WebUtils.SetSessionLanguage(Session, user); // user.FailCount = 0; // EUser.db.update(dbConn, user); // //WebUtils.RefreshPermission(Session); // bool isForceChangePassword = false; // if (user.UserChangePasswordUnit == "D") // { // if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddDays(user.UserChangePasswordPeriod)) // isForceChangePassword = false; // else // isForceChangePassword = true; // } // else if (user.UserChangePasswordUnit == "M") // { // if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddMonths(user.UserChangePasswordPeriod)) // isForceChangePassword = false; // else // isForceChangePassword = true; // } // else if (user.UserChangePasswordUnit == "Y") // { // if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddYears(user.UserChangePasswordPeriod)) // isForceChangePassword = false; // else // isForceChangePassword = true; // } // else // isForceChangePassword = false; // if (user.UserChangePassword) // isForceChangePassword = true; // //EInbox.GenerateInboxMessage(user.UserID); // if (isForceChangePassword) // Session["ForceChangePassword"] = true; // if (Session["LastURL"] != null) // Response.Redirect(Session["LastURL"].ToString()); // else // HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Emp_List.aspx"); //} protected void Login_Click(object sender, EventArgs e) { HROne.Lib.Entities.EUser user = null; Session.Clear(); HROne.DataAccess.DatabaseConnection mainDBConn = null; HROne.SaaS.Entities.ECompanyDatabase companyDB = null; bool hasError = false; string message = string.Empty; // always check whether companyDB exists after click if (Application["MasterDBConfig"] != null) { DatabaseConfig masterDBConfig = (DatabaseConfig)Application["MasterDBConfig"]; HROne.DataAccess.DatabaseConnection masterDBConn = masterDBConfig.CreateDatabaseConnectionObject(); DBFilter companyDatabaseFilter = new DBFilter(); companyDatabaseFilter.add(new Match("CompanyDBClientCode", txtCustomerID.Text)); ArrayList companyDatabaseList = HROne.SaaS.Entities.ECompanyDatabase.db.select(masterDBConn, companyDatabaseFilter); if (companyDatabaseList.Count > 0) { companyDB = (HROne.SaaS.Entities.ECompanyDatabase)companyDatabaseList[0]; DatabaseConfig tempDBConfig = new DatabaseConfig(); tempDBConfig.ConnectionString = companyDB.getConnectionString(masterDBConn); tempDBConfig.DBType = WebUtils.DBTypeEmun.MSSQL; if (tempDBConfig.TestConnection()) { mainDBConn = tempDBConfig.CreateDatabaseConnectionObject(); HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_PRODUCTKEY, companyDB.CompanyDBProductKey); HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_PRODUCTFEATURECODE, companyDB.getProductFeatureCode(masterDBConn)); string[] smtpParameterList = new string[] { HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_SERVER_NAME, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_PORT, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_USERNAME, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_ENABLE_SSL, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS }; foreach (string smptParameter in smtpParameterList) { HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, smptParameter, HROne.SaaS.Entities.ESystemParameter.getParameter(masterDBConn, smptParameter)); } HROne.Lib.Entities.ESystemParameter.setParameterWithEncryption(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_PASSWORD , HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_SMTP_PASSWORD)); } else { if (HROne.DataAccess.DBAESEncryptStringFieldAttribute.InvalidRSAKey) { HttpRuntime.UnloadAppDomain(); } } } } else { mainDBConn = WebUtils.GetDatabaseConnection(); if (mainDBConn == null) { if (multiDBRow.Visible) { int idx; if (int.TryParse(cboDatabase.SelectedValue, out idx)) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); DatabaseConfig dbconfig = config.DatabaseConfigList[idx]; if (dbconfig.TestConnection()) { mainDBConn = dbconfig.CreateDatabaseConnectionObject(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMessage", "alert(\"Fail to connect database\");", true); return; } } } } } if (mainDBConn != null) { WebUtils.SetSessionDatabaseConnection(Session, mainDBConn); } HROne.ProductLicense productLicense = WebUtils.productLicense(Session); if (productLicense != null) { if (companyDB == null && productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.HROneSaaS) { productLicense.LoadProductKey(string.Empty); } } if (mainDBConn == null && companyDB != null) { hasError = true; message = "Fail to connect to database. Please contact to customer service."; } if (!hasError) { try { WebUtils.ValidateUser(mainDBConn, Username.Text, HROne.CommonLib.Hash.PasswordHash(Password.Text), true, true, out user); } catch (Exception ex) { hasError = true; message = ex.Message; } // Check the database status after login is verified if (companyDB != null && !hasError) { if (!companyDB.CompanyDBIsActive) { hasError = true; message = "Subscribed service has been expired; please contact customer service hotline for assistant."; } } if (!hasError) { // Create Login Audit for successfully login HROne.Lib.Entities.ELoginAudit.CreateLoginAudit(mainDBConn, user.UserID, Username.Text, Request, AppUtils.ServerDateTime(), false, string.Empty); Session["LoginID"] = user.LoginID; Session["PasswordEncrypted"] = user.UserPassword; if (companyDB != null) { Session["CompanyDBID"] = companyDB.CompanyDBID; } if (mainDBConn is HROne.DataAccess.DatabaseConnectionWithAudit) { ((HROne.DataAccess.DatabaseConnectionWithAudit)mainDBConn).UserID = user.UserID; } WebUtils.SetSessionLanguage(Session, user); //WebUtils.RefreshPermission(Session); bool isForceChangePassword = false; if (user.UserChangePasswordUnit == "D") { if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddDays(user.UserChangePasswordPeriod)) { isForceChangePassword = false; } else { isForceChangePassword = true; } } else if (user.UserChangePasswordUnit == "M") { if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddMonths(user.UserChangePasswordPeriod)) { isForceChangePassword = false; } else { isForceChangePassword = true; } } else if (user.UserChangePasswordUnit == "Y") { if (AppUtils.ServerDateTime() < user.UserChangePasswordDate.AddYears(user.UserChangePasswordPeriod)) { isForceChangePassword = false; } else { isForceChangePassword = true; } } else { isForceChangePassword = false; } if (user.UserChangePassword) { isForceChangePassword = true; } //EInbox.GenerateInboxMessage(user.UserID); if (isForceChangePassword) { Session["ForceChangePassword"] = true; } WebUtils.SetSessionLanguage(Session, WebUtils.GetCurUser(Session)); //RegenerateSessionId(); HROne.Lib.Entities.EInbox.DeleteAllDeletedUserID(mainDBConn); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Default.aspx?LastURL=" + DecryptedRequest["LastURL"]); } } // Remove all item for release session Session.Clear(); Request.Cookies.Remove(HROne.Common.WebUtility.getDefaultSessionCookieName()); //if (companyDB != null) //{ // Session.Remove("DatabaseConnection"); //} { // Create Login Audit for fail login if (user != null) { HROne.Lib.Entities.ELoginAudit.CreateLoginAudit(mainDBConn, user.UserID, Username.Text, Request, AppUtils.ServerDateTime(), true, message); } else { HROne.Lib.Entities.ELoginAudit.CreateLoginAudit(mainDBConn, 0, Username.Text, Request, AppUtils.ServerDateTime(), true, message); } message = message.Replace("\\", "\\\\").Replace("\r", "\\r").Replace("\n", "\\n").Replace("\"", "\\\""); message = message.Replace(HROne.Common.WebUtility.GetLocalizedString("validate.prompt"), ""); ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMessage", "alert(\"" + message + "\");", true); System.Threading.Thread.Sleep(1000); } }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ArrayList empList = new ArrayList(); foreach (RepeaterItem i in empRepeater.Items) { CheckBox cb = (CheckBox)i.FindControl("ItemSelect"); if (cb.Checked) { EEmpPersonalInfo o = (EEmpPersonalInfo)EEmpPersonalInfo.db.createObject(); WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb); empList.Add(o); } } string strEmpList = string.Empty; string strPayBatchList = string.Empty; string strPayPeriodRequest = string.Empty; DateTime dtPayPeriodFr = new DateTime(); DateTime dtPayPeriodTo = new DateTime(); if (empList.Count > 0) { foreach (EEmpPersonalInfo o in empList) { if (strEmpList == string.Empty) { strEmpList = ((EEmpPersonalInfo)o).EmpID.ToString(); } else { strEmpList += "_" + ((EEmpPersonalInfo)o).EmpID.ToString(); } } if (DateTime.TryParse(PayPeriodFr.Value, out dtPayPeriodFr) && DateTime.TryParse(PayPeriodTo.Value, out dtPayPeriodTo)) { strPayPeriodRequest = "&PayPeriodFr=" + dtPayPeriodFr.Ticks + "&PayPeriodTo=" + dtPayPeriodTo.Ticks; } else { errors.addError("Invalid Date Format"); } // errors.addError("Complete"); //Response.Write("<script>alert('Completed'); </script>"); } else { errors.addError("Employee or Payroll Batch not selected"); } if (errors.isEmpty()) { GenericMPFFile mpfFileProcess = getMPFFileObject(); if (mpfFileProcess == null) { errors.addError("Generate MPF File is not available for that MPF Scheme"); return; } if (mpfFileProcess is HSBCMPFGatewayFileEncrypted) { string keyFolderPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "BankKey"); string keyPath = string.Empty; string HSBCKeyFileName = "HSBC.pub"; string HangSengKeyFileName = "HASE.pub"; string password = "******"; int intMPFPlanID = 0; if (int.TryParse(MPFPlanID.SelectedValue, out intMPFPlanID)) { EMPFPlan mpfPlan = new EMPFPlan(); mpfPlan.MPFPlanID = intMPFPlanID; if (EMPFPlan.db.select(dbConn, mpfPlan)) { EMPFScheme mpfScheme = new EMPFScheme(); mpfScheme.MPFSchemeID = mpfPlan.MPFSchemeID; if (EMPFScheme.db.select(dbConn, mpfScheme)) { if (mpfScheme.MPFSchemeTrusteeCode.Equals("HSBC")) { keyPath = System.IO.Path.Combine(keyFolderPath, HSBCKeyFileName); if (Application["MasterDBConfig"] != null) { DatabaseConnection masterDBConn = ((DatabaseConfig)Application["MasterDBConfig"]).CreateDatabaseConnectionObject(); string HSBCKeyPath = HROne.SaaS.Entities.ESystemParameter.getParameter(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HSBC_PATH); string HSBCPassword = HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HSBC_PASSWORD); if (!string.IsNullOrEmpty(HSBCKeyPath) && !string.IsNullOrEmpty(HSBCPassword)) { keyPath = HSBCKeyPath; password = HSBCPassword; } } } else if (mpfScheme.MPFSchemeTrusteeCode.Equals("HangSeng")) { keyPath = System.IO.Path.Combine(keyFolderPath, HangSengKeyFileName); if (Application["MasterDBConfig"] != null) { DatabaseConnection masterDBConn = ((DatabaseConfig)Application["MasterDBConfig"]).CreateDatabaseConnectionObject(); string HASEKeyPath = HROne.SaaS.Entities.ESystemParameter.getParameter(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HASE_PATH); string HASEPassword = HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_BANKKEY_HASE_PASSWORD); if (!string.IsNullOrEmpty(HASEKeyPath) && !string.IsNullOrEmpty(HASEPassword)) { keyPath = HASEKeyPath; password = HASEPassword; } } } } } } HSBCMPFGatewayFileEncrypted mpfFileEncrypted = (HSBCMPFGatewayFileEncrypted)mpfFileProcess; mpfFileEncrypted.publicKeyFile = keyPath; mpfFileEncrypted.publicKeyPassword = password; } HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenerateMPFContributionFileTaskFactory reportTask = new HROne.TaskService.GenerateMPFContributionFileTaskFactory(dbConn, user, lblReportHeader.Text, mpfFileProcess, empList, int.Parse(MPFPlanID.SelectedValue), dtPayPeriodFr, dtPayPeriodTo, ci); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { try { mpfFileProcess.LoadMPFFileDetail(empList, int.Parse(MPFPlanID.SelectedValue), dtPayPeriodFr, dtPayPeriodTo); FileInfo mpfFileInfo = mpfFileProcess.GenerateMPFFile(); string mpfFilename = mpfFileProcess.ActualMPFFileName(); WebUtils.TransmitFile(Response, mpfFileInfo.FullName, mpfFilename, true); } catch (Exception ex) { errors.addError(ex.Message); } } } // emploadData(empInfo, EEmpPayroll.db, empRepeater); }
protected void Login_Click(object sender, EventArgs e) { EESSUser user = null; Session.Clear(); HROne.DataAccess.DatabaseConnection mainDBConn = null; HROne.SaaS.Entities.ECompanyDatabase companyDB = null; bool hasError = false; string message = string.Empty; // always check whether companyDB exists after click if (Application["MasterDBConfig"] != null) { DatabaseConfig masterDBConfig = (DatabaseConfig)Application["MasterDBConfig"]; HROne.DataAccess.DatabaseConnection masterDBConn = masterDBConfig.CreateDatabaseConnectionObject(); DBFilter companyDatabaseFilter = new DBFilter(); companyDatabaseFilter.add(new Match("CompanyDBClientCode", txtCustomerID.Text)); ArrayList companyDatabaseList = HROne.SaaS.Entities.ECompanyDatabase.db.select(masterDBConn, companyDatabaseFilter); if (companyDatabaseList.Count > 0) { companyDB = (HROne.SaaS.Entities.ECompanyDatabase)companyDatabaseList[0]; DatabaseConfig tempDBConfig = new DatabaseConfig(); tempDBConfig.ConnectionString = companyDB.getConnectionString(masterDBConn); tempDBConfig.DBType = WebUtils.DBTypeEmun.MSSQL; if (tempDBConfig.TestConnection()) { mainDBConn = tempDBConfig.CreateDatabaseConnectionObject(); HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_PRODUCTKEY, companyDB.CompanyDBProductKey); HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_PRODUCTFEATURECODE, companyDB.getProductFeatureCode(masterDBConn)); string[] smtpParameterList = new string[] { HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_SERVER_NAME, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_PORT, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_USERNAME, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_ENABLE_SSL, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_SMTP_OUTGOING_EMAIL_ADDRESS }; foreach (string smptParameter in smtpParameterList) { HROne.Lib.Entities.ESystemParameter.setParameter(mainDBConn, smptParameter, ESystemParameter.getParameter(masterDBConn, smptParameter)); } HROne.Lib.Entities.ESystemParameter.setParameterWithEncryption(mainDBConn, HROne.Lib.Entities.ESystemParameter.PARAM_CODE_SMTP_PASSWORD , HROne.SaaS.Entities.ESystemParameter.getParameterWithEncryption(masterDBConn, HROne.SaaS.Entities.ESystemParameter.PARAM_CODE_SMTP_PASSWORD)); } else { if (HROne.DataAccess.DBAESEncryptStringFieldAttribute.InvalidRSAKey) { HttpRuntime.UnloadAppDomain(); } } } } else { mainDBConn = WebUtils.GetDatabaseConnection(); if (mainDBConn == null) { if (multiDBRow.Visible) { int idx; if (int.TryParse(cboDatabase.SelectedValue, out idx)) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); DatabaseConfig dbconfig = config.DatabaseConfigList[idx]; if (dbconfig.TestConnection()) { mainDBConn = dbconfig.CreateDatabaseConnectionObject(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMessage", "alert(\"Fail to connect database\");", true); return; } } } } } if (mainDBConn != null) { WebUtils.SetSessionDatabaseConnection(Session, mainDBConn); } HROne.ProductLicense productLicense = WebUtils.productLicense(Session); if (productLicense != null) { if (companyDB == null && productLicense.ProductType == HROne.ProductLicense.ProductLicenseType.HROneSaaS) { productLicense.LoadProductKey(string.Empty); } } if (mainDBConn == null && companyDB != null) { hasError = true; message = "Fail to connect to database. Please contact to customer service."; } if (!hasError) { bool ChangePassword = false; try { WebUtils.ValidateUser(mainDBConn, Username.Text, HROne.CommonLib.Hash.PasswordHash(Password.Text), true, out ChangePassword, out user); } catch (Exception ex) { hasError = true; message = ex.Message; } // copy from GAP customization, checking Active Directory ID if (user != null) { DBFilter ADIDFilter = new DBFilter(); ADIDFilter.add(new Match("EmpExtraFieldName", "AD ID")); DBFilter ADIDValueFilter = new DBFilter(); ADIDValueFilter.add(new IN("EmpExtraFieldID", "Select EmpExtraFieldID from " + EEmpExtraField.db.dbclass.tableName, ADIDFilter)); ADIDValueFilter.add(new Match("EmpID", user.EmpID)); ArrayList ADIDList = EEmpExtraFieldValue.db.select(dbConn, ADIDValueFilter); if (ADIDList.Count > 0) { string remoteUser = Request.ServerVariables["REMOTE_USER"].Trim(); string ADID = ((EEmpExtraFieldValue)ADIDList[0]).EmpExtraFieldValue.Trim(); if (!remoteUser.Equals(ADID, StringComparison.CurrentCultureIgnoreCase) && !remoteUser.EndsWith("\\" + ADID, StringComparison.CurrentCultureIgnoreCase) && !remoteUser.EndsWith("/" + ADID, StringComparison.CurrentCultureIgnoreCase)) { hasError = true; message = "This PC is not logged with your network ID!"; } } } if (companyDB != null && !hasError) { if (!companyDB.CompanyDBIsActive) { hasError = true; message = "Subscribed service has been expired; please contact customer service hotline for assistant."; } if (!productLicense.IsESS) { hasError = true; message = "You are NOT subscribed the service."; } } if (!hasError) { HROne.Lib.Entities.EESSLoginAudit.CreateLoginAudit(mainDBConn, user.EmpID, Username.Text, Request, AppUtils.ServerDateTime(), false, string.Empty); // ADD the Session "User" Value is user Session["User"] = user; if (ChangePassword) { Session.Add("ForceChangePassword", true); } WebUtils.SetSessionLanguage(Session, user); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/Default.aspx?LastURL=" + DecryptedRequest["LastURL"]); } } // Remove all item for release session Session.Clear(); Request.Cookies.Remove(HROne.Common.WebUtility.getDefaultSessionCookieName()); //if (companyDB != null) //{ // Session.Remove("DatabaseConnection"); //} { if (user != null) { HROne.Lib.Entities.EESSLoginAudit.CreateLoginAudit(mainDBConn, user.EmpID, Username.Text, Request, AppUtils.ServerDateTime(), true, message); } else { HROne.Lib.Entities.EESSLoginAudit.CreateLoginAudit(mainDBConn, 0, Username.Text, Request, AppUtils.ServerDateTime(), true, message); } //message = message.Replace("\\", "\\\\").Replace("\r", "\\r").Replace("\n", "\\n").Replace("\"", "\\\""); //message = message.Replace(HROne.Common.WebUtility.GetLocalizedString("validate.prompt"), ""); //ScriptManager.RegisterStartupScript(this, this.GetType(), "errorMessage", "alert(\"" + message + "\");", true); Prompt.Text = message; System.Threading.Thread.Sleep(1000); } }
private void GenerateEmployeeExcel(ArrayList employeeList, ArrayList functionList) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); HROne.Import.EmployeeInformationExportProcess reportProcess = new HROne.Import.EmployeeInformationExportProcess(dbConn, ci, employeeList, functionList, IncludedEmployeeNameHierarchy.Checked, DisplayCodeOnly.Checked, ShowInternalID.Checked); if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenericExcelReportTaskFactory reportTask = new HROne.TaskService.GenericExcelReportTaskFactory(dbConn, user, lblReportHeader.Text, reportProcess, "EmployeeExport"); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { System.IO.FileInfo excelFile = reportProcess.GenerateExcelReport(); WebUtils.TransmitFile(Response, excelFile.FullName, "EmployeeExport_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } } //DataSet excelDataSet= new DataSet(); //foreach (string functionCode in functionList) //{ // if (functionCode.Equals("PER001")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpPersonalInfoProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER002")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpBankAccountProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER003")) // { // excelDataSet.Tables.Add(HROne.Import.ImportEmpSpouseProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpDependantProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // } // if (functionCode.Equals("PER004")) // { // excelDataSet.Tables.Add(HROne.Import.ImportEmpQualificationProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpSkillProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // } // if (functionCode.Equals("PER005")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpPlaceOfResidenceProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER006")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpContractTermsProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER007")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpPositionInfoProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER007_1")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpRecurringPaymentProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER008")) // { // excelDataSet.Tables.Add(HROne.Import.ImportEmpMPFPlanProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpAVCPlanProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpORSOPlanProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // } // if (functionCode.Equals("PER009")) // excelDataSet.Tables.Add(HROne.Import.ImportLeaveApplicationProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER011")) // { // excelDataSet.Tables.Add(HROne.Import.ImportEmpTerminationProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // excelDataSet.Tables.Add(HROne.Import.ImportEmpFinalPaymentProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // } // if (functionCode.Equals("PER012")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpCostCenterProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER013")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpPermitProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER015")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpEmergencyContactProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); // if (functionCode.Equals("PER016")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpWorkExpProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked, !DisplayCodeOnly.Checked)); // if (functionCode.Equals("PER017")) // excelDataSet.Tables.Add(HROne.Import.ImportEmpWorkInjuryRecordProcess.Export(dbConn, employeeList, IncludedEmployeeNameHierarchy.Checked)); //} //string exportFileName = System.IO.Path.GetTempFileName(); //System.IO.File.Delete(exportFileName); //exportFileName += ".xls"; //HROne.Export.ExcelExport excelExport = new HROne.Export.ExcelExport(exportFileName); //excelExport.Update(excelDataSet); //WebUtils.TransmitFile(Response, exportFileName, "EmployeeExport_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); //return; }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(EPayrollGroup.db, Page.Master); DateTime dtPeriodFrom = new DateTime(); DateTime dtPeriodTo = new DateTime(); int intHierarchyLevelID = 0; int m_companyID = int.Parse(CompanyID.SelectedValue); //if (!string.IsNullOrEmpty(PayPeriodFr.Value)) if (!DateTime.TryParse(PayPeriodFr.Value, out dtPeriodFrom)) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_FORMAT); return; } //if (!string.IsNullOrEmpty(PayPeriodTo.Value)) if (!DateTime.TryParse(PayPeriodTo.Value, out dtPeriodTo)) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_FORMAT); return; } if ((dtPeriodTo.Year * 12 + dtPeriodTo.Month) - (dtPeriodFrom.Year * 12 + dtPeriodFrom.Month) >= 36) { errors.addError("Payroll period exceed maximum (36 months)"); return; } if (!int.TryParse(HLevelID.SelectedValue, out intHierarchyLevelID)) { errors.addError("Invalid Hierarchy Level"); return; } // Start 0000185, KuangWei, 2015-05-05 ArrayList empList = WebUtils.SelectedRepeaterItemToBaseObjectList(db, Repeater, "ItemSelect"); if (empList.Count <= 0) { errors.addError("No Employees are selected"); return; } HROne.Reports.Payroll.PayrollAllocationReport_Detail_Process reportProcess = new HROne.Reports.Payroll.PayrollAllocationReport_Detail_Process(dbConn, ci, dtPeriodFrom, dtPeriodTo, intHierarchyLevelID, chkShowIndividuals.Checked, WebUtils.GetCurUser(Session), m_companyID, empList); // End 0000185, KuangWei, 2015-05-05 if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenericExcelReportTaskFactory reportTask = new HROne.TaskService.GenericExcelReportTaskFactory(dbConn, user, lblReportHeader.Text, reportProcess, "PFundContributionSummary"); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { System.IO.FileInfo excelFile = reportProcess.GenerateExcelReport(); WebUtils.TransmitFile(Response, excelFile.FullName, "PFundContributionSummary_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } } }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(EPayrollGroup.db, Page.Master); DateTime dtPeriodFrom = new DateTime(); DateTime dtPeriodTo = new DateTime(); int intHierarchyLevelID = 0; if (!string.IsNullOrEmpty(PayPeriodFr.Value)) { if (!DateTime.TryParse(PayPeriodFr.Value, out dtPeriodFrom)) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_FORMAT); return; } } if (!string.IsNullOrEmpty(PayPeriodTo.Value)) { if (!DateTime.TryParse(PayPeriodTo.Value, out dtPeriodTo)) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_FORMAT); return; } } if (!int.TryParse(HLevelID.SelectedValue, out intHierarchyLevelID)) { errors.addError("Invalid Hierarchy Level"); } // Start 0000185, KuangWei, 2015-05-05 ArrayList empList = WebUtils.SelectedRepeaterItemToBaseObjectList(db, Repeater, "ItemSelect"); if (empList.Count <= 0) { errors.addError("No Employees selected"); } if (errors.isEmpty()) { HROne.Reports.Payroll.PaymentAllocationListProcess reportProcess = new HROne.Reports.Payroll.PaymentAllocationListProcess(dbConn, ci, dtPeriodFrom, dtPeriodTo, intHierarchyLevelID, WebUtils.GetCurUser(Session), empList); // End 0000185, KuangWei, 2015-05-05 if (Response.IsClientConnected) { HROneConfig config = HROneConfig.GetCurrentHROneConfig(); if (config.GenerateReportAsInbox) { if (EInboxAttachment.GetTotalSize(dbConn, 0) < WebUtils.productLicense(Session).MaxInboxSizeMB * 1000 * 1000) { HROne.TaskService.GenericExcelReportTaskFactory reportTask = new HROne.TaskService.GenericExcelReportTaskFactory(dbConn, user, lblReportHeader.Text, reportProcess, "PaymentAllocationList"); AppUtils.reportTaskQueueService.AddTask(reportTask); errors.addError(HROne.Translation.PageMessage.REPORT_GENERATING_TO_INBOX); } else { errors.addError(HROne.Translation.PageMessage.INBOX_SIZE_EXCEEDED); } } else { System.IO.FileInfo excelFile = reportProcess.GenerateExcelReport(); WebUtils.TransmitFile(Response, excelFile.FullName, "PaymentAllocationList_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); } } } //{ // string hierarchyLevelName = string.Empty; // DataSet dataSet = new DataSet(); // DataTable empInfoTable = new DataTable("EmpInfo"); // DataTable payrollTable = new DataTable("Payment"); // dataSet.Tables.Add(empInfoTable); // dataSet.Tables.Add(payrollTable); // payrollTable.Columns.Add("EmpPayrollID", typeof(string)); // int firstDetailColumnPos = payrollTable.Columns.Count; // empInfoTable.Columns.Add("EmployeeID", typeof(string)); // empInfoTable.Columns.Add("EmpPayrollID", typeof(int)); // empInfoTable.Columns.Add("EnglishName", typeof(string)); // empInfoTable.Columns.Add("Alias", typeof(string)); // empInfoTable.Columns.Add("Company", typeof(string)); // DBFilter hierarchyLevelFilter = new DBFilter(); // Hashtable hierarchyLevelHashTable = new Hashtable(); // hierarchyLevelFilter.add("HLevelSeqNo", true); // ArrayList hierarchyLevelList = EHierarchyLevel.db.select(dbConn, hierarchyLevelFilter); // foreach (EHierarchyLevel hlevel in hierarchyLevelList) // { // if (hlevel.HLevelID.Equals(intHierarchyLevelID)) // hierarchyLevelName = hlevel.HLevelDesc; // empInfoTable.Columns.Add(hlevel.HLevelDesc, typeof(string)); // hierarchyLevelHashTable.Add(hlevel.HLevelID, hlevel); // } // empInfoTable.Columns.Add("Payroll Group", typeof(string)); // empInfoTable.Columns.Add("Date Join", typeof(DateTime)); // empInfoTable.Columns.Add("Date Left", typeof(DateTime)); // empInfoTable.Columns.Add("Net Payable", typeof(double)); // empInfoTable.Columns.Add("MCEE", typeof(double)); // empInfoTable.Columns.Add("MCER", typeof(double)); // empInfoTable.Columns.Add("VCEE", typeof(double)); // empInfoTable.Columns.Add("VCER", typeof(double)); // empInfoTable.Columns.Add("PFundEE", typeof(double)); // empInfoTable.Columns.Add("PFundER", typeof(double)); // DBFilter payPeriodFilter = new DBFilter(); // if (!dtPeriodFrom.Ticks.Equals(0)) // payPeriodFilter.add(new Match("PayPeriodTo", ">=", dtPeriodFrom)); // if (!dtPeriodTo.Ticks.Equals(0)) // payPeriodFilter.add(new Match("PayPeriodTo", "<=", dtPeriodTo)); // ArrayList payPeriodList = EPayrollPeriod.db.select(dbConn, payPeriodFilter); // if (payPeriodList.Count > 0) // { // // reset period // dtPeriodFrom = new DateTime(); // dtPeriodTo = new DateTime(); // } // foreach (EPayrollPeriod payPeriod in payPeriodList) // { // if (dtPeriodFrom > payPeriod.PayPeriodFr || dtPeriodFrom.Ticks.Equals(0)) // dtPeriodFrom = payPeriod.PayPeriodFr; // if (dtPeriodTo < payPeriod.PayPeriodTo || dtPeriodTo.Ticks.Equals(0)) // dtPeriodTo = payPeriod.PayPeriodTo; // DBFilter empPayrollFilter = new DBFilter(); // empPayrollFilter.add(new Match("PayPeriodID", payPeriod.PayPeriodID)); // ArrayList empPayrollList = EEmpPayroll.db.select(dbConn, empPayrollFilter); // foreach (EEmpPayroll empPayroll in empPayrollList) // { // EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); // empInfo.EmpID = empPayroll.EmpID; // EEmpPersonalInfo.db.select(dbConn, empInfo); // DataRow row = empInfoTable.NewRow(); // DataRow paymentRow = payrollTable.NewRow(); // row["EmployeeID"] = empInfo.EmpNo; // row["EmpPayrollID"] = empPayroll.EmpPayrollID; // paymentRow["EmpPayrollID"] = empPayroll.EmpPayrollID; // row["EnglishName"] = empInfo.EmpEngFullName; // row["Alias"] = empInfo.EmpAlias; // row["Date Join"] = empInfo.EmpDateOfJoin; // DBFilter empTerminationFilter = new DBFilter(); // empTerminationFilter.add(new Match("EmpID", empInfo.EmpID)); // ArrayList empTerminationList = EEmpTermination.db.select(dbConn, empTerminationFilter); // if (empTerminationList.Count > 0) // row["Date Left"] = ((EEmpTermination)empTerminationList[0]).EmpTermLastDate; // DBFilter empPosFilter = new DBFilter(); // EEmpPositionInfo empPos = AppUtils.GetLastPositionInfo(dbConn, payPeriod.PayPeriodTo, empInfo.EmpID); // if (empPos != null) // { // ECompany company = new ECompany(); // company.CompanyID = empPos.CompanyID; // if (ECompany.db.select(dbConn, company)) // row["Company"] = company.CompanyName; // EPayrollGroup payrollGroup = new EPayrollGroup(); // payrollGroup.PayGroupID = empPos.PayGroupID; // if (EPayrollGroup.db.select(dbConn, payrollGroup)) // row["Payroll Group"] = payrollGroup.PayGroupDesc; // DBFilter empHierarchyFilter = new DBFilter(); // empHierarchyFilter.add(new Match("EmpPosID", empPos.EmpPosID)); // ArrayList empHierarchyList = EEmpHierarchy.db.select(dbConn, empHierarchyFilter); // foreach (EEmpHierarchy empHierarchy in empHierarchyList) // { // EHierarchyLevel hierarchyLevel = (EHierarchyLevel)hierarchyLevelHashTable[empHierarchy.HLevelID]; // if (hierarchyLevel != null) // { // EHierarchyElement hierarchyElement = new EHierarchyElement(); // hierarchyElement.HElementID = empHierarchy.HElementID; // if (EHierarchyElement.db.select(dbConn, hierarchyElement)) // row[hierarchyLevel.HLevelDesc] = hierarchyElement.HElementDesc; // } // } // } // double netAmount = 0, releventIncome = 0, nonRelevantIncome = 0, MCEE = 0, MCER = 0, VCEE=0, VCER=0, PFUNDEE = 0, PFUNDER = 0; // DBFilter paymentRecordFilter = new DBFilter(); // paymentRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID)); // paymentRecordFilter.add(new Match("PayRecStatus", "A")); // ArrayList paymentRecords = EPaymentRecord.db.select(dbConn, paymentRecordFilter); // foreach (EPaymentRecord paymentRecord in paymentRecords) // { // EPaymentCode payCode = new EPaymentCode(); // payCode.PaymentCodeID = paymentRecord.PaymentCodeID; // EPaymentCode.db.select(dbConn, payCode); // string fieldName = payCode.PaymentCodeDesc; // if (payrollTable.Columns[fieldName] == null) // payrollTable.Columns.Add(new DataColumn(fieldName, typeof(double))); // if (paymentRow[fieldName] == null || paymentRow[fieldName] == DBNull.Value) // paymentRow[fieldName] = 0; // paymentRow[fieldName] = (double)paymentRow[fieldName] + paymentRecord.PayRecActAmount; // netAmount += paymentRecord.PayRecActAmount; // if (payCode.PaymentCodeIsMPF) // releventIncome += paymentRecord.PayRecActAmount; // else // nonRelevantIncome += paymentRecord.PayRecActAmount; // } // row["Net Payable"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(netAmount, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // //row["Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(releventIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // //row["Non-Relevant Income"] = HROne.CommonLib.GenericRoundingFunctions.RoundingTo(nonRelevantIncome, ExchangeCurrency.DefaultCurrencyDecimalPlaces(), ExchangeCurrency.DefaultCurrencyDecimalPlaces()); // DBFilter mpfRecordFilter = new DBFilter(); // mpfRecordFilter.add(new Match("EmpPayrollID", empPayroll.EmpPayrollID)); // ArrayList mpfRecords = EMPFRecord.db.select(dbConn, mpfRecordFilter); // foreach (EMPFRecord mpfRecord in mpfRecords) // { // VCER += mpfRecord.MPFRecActVCER; // MCER += mpfRecord.MPFRecActMCER; // VCEE += mpfRecord.MPFRecActVCEE; // MCEE += mpfRecord.MPFRecActMCEE; // } // row["MCEE"] = MCEE; // row["VCEE"] = VCEE; // row["MCER"] = MCER; // row["VCER"] = VCER; // ArrayList orsoRecords = EORSORecord.db.select(dbConn, mpfRecordFilter); // foreach (EORSORecord orsoRecord in orsoRecords) // { // PFUNDER += orsoRecord.ORSORecActER; // PFUNDEE += orsoRecord.ORSORecActEE; // } // row["PFundEE"] = PFUNDEE; // row["PFundER"] = PFUNDER; // empInfoTable.Rows.Add(row); // payrollTable.Rows.Add(paymentRow); // } // } // DBFilter paymentCodeFilter = new DBFilter(); // paymentCodeFilter.add("PaymentCodeDisplaySeqNo", false); // paymentCodeFilter.add("PaymentCode", false); // ArrayList paymentCodeList = EPaymentCode.db.select(dbConn, paymentCodeFilter); // foreach (EPaymentCode paymentCode in paymentCodeList) // { // if (payrollTable.Columns.Contains(paymentCode.PaymentCodeDesc)) // payrollTable.Columns[paymentCode.PaymentCodeDesc].SetOrdinal(firstDetailColumnPos); // } // GenerateReport(dataSet, dtPeriodFrom, dtPeriodTo, hierarchyLevelName); // return; //} }