protected void btnResetPassword_Click(object sender, EventArgs e) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = CurID; empInfo.EmpPW = string.Empty; WebUtils.StartFunction(Session, FUNCTION_CODE); EEmpPersonalInfo.db.update(dbConn, empInfo); WebUtils.EndFunction(dbConn); PageErrors errors = PageErrors.getErrors(EEmpPositionInfo.db, this.Master); errors.addError("Reset Password Successfully"); }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); EAuthorizationWorkFlow obj = new EAuthorizationWorkFlow(); obj.AuthorizationWorkFlowID = CurID; if (db.select(dbConn, obj)) { DBFilter empPosFilter = new DBFilter(); OR orAuthorizationWorkFlow = new OR(); orAuthorizationWorkFlow.add(new Match("AuthorizationWorkFlowIDLeaveApp", obj.AuthorizationWorkFlowID)); orAuthorizationWorkFlow.add(new Match("AuthorizationWorkFlowIDEmpInfoModified", obj.AuthorizationWorkFlowID)); empPosFilter.add(orAuthorizationWorkFlow); empPosFilter.add("empid", true); ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter); if (empPosList.Count > 0) { errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Authorization Workflow"), obj.AuthorizationWorkFlowCode })); foreach (EEmpPositionInfo empPos in empPosList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empPos.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); } else { EEmpPositionInfo.db.delete(dbConn, empPos); } } errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT); return; } else { DBFilter authorizationWorkFlowDetailFilter = new DBFilter(); authorizationWorkFlowDetailFilter.add(new Match("AuthorizationWorkFlowID", CurID)); EAuthorizationWorkFlowDetail.db.delete(dbConn, authorizationWorkFlowDetailFilter); WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, obj); WebUtils.EndFunction(dbConn); } } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/ESS_AuthorizationWorkFlow_List.aspx"); }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); DateTime dtLeaveAppDateFr = new DateTime(); DateTime dtLeaveAppDateTo = new DateTime(); if (!DateTime.TryParse(LeaveAppDateFr.Value, out dtLeaveAppDateFr)) { if (!string.IsNullOrEmpty(LeaveAppDateFr.Value)) { return; } } if (!DateTime.TryParse(LeaveAppDateTo.Value, out dtLeaveAppDateTo)) { if (!string.IsNullOrEmpty(LeaveAppDateTo.Value)) { return; } } EEmpPersonalInfo p = new EEmpPersonalInfo(); ArrayList values = new ArrayList(); foreach (RepeaterItem item in Repeater.Items) { CheckBox cb = (CheckBox)item.FindControl("ItemSelect"); if (cb.Checked) { WebFormUtils.GetKeys(db, p, cb); values.Add(p.EmpID); } } if (values.Count <= 0) { errors.addError("Employee not selected"); } if (errors.isEmpty()) { HROne.Reports.Employee.LeaveApplicationProcess rpt = new HROne.Reports.Employee.LeaveApplicationProcess(dbConn, values, dtLeaveAppDateFr, dtLeaveAppDateTo); string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Employee_LeaveApplicationList.rpt")); WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "LeaveApplicationList", true); } //Session["Report_EmployeeList"] = values; //HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Report_EmployeeDetail_View.aspx"); }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); EHierarchyElement obj = new EHierarchyElement(); obj.HElementID = CurID; db.select(dbConn, obj); DBFilter hierarchyElementFilter = new DBFilter(); hierarchyElementFilter.add(new Match("HElementID", obj.HElementID)); IN inTerms = new IN("EmpPosID", "Select EmpPosID From " + EEmpHierarchy.db.dbclass.tableName, hierarchyElementFilter); DBFilter empPosFilter = new DBFilter(); empPosFilter.add(inTerms); empPosFilter.add("empid", true); ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter); if (empPosList.Count > 0) { errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Code"), obj.HElementCode })); foreach (EEmpPositionInfo empPos in empPosList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empPos.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); } else { EEmpPositionInfo.db.delete(dbConn, empPos); } } errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT); } else { WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, obj); WebUtils.EndFunction(dbConn); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "HierarchyElement_List.aspx"); } }
//private void SaveSequenceNo(int NewSequenceNo) //{ // EMPFPlan mpfPlan = new EMPFPlan(); // mpfPlan.MPFPlanID = MPFPlanID; // if (EMPFPlan.db.select(dbConn, mpfPlan)) // { // System.Xml.XmlDocument xmlDoc = HROne.CommonLib.Utility.GetXmlDocumentByDataString(mpfPlan.MPFPlanExtendData); // System.Xml.XmlNodeList nodeList = xmlDoc.GetElementsByTagName(MPF_PLAN_XML_SEQUENCE_NODE_NAME); // System.Xml.XmlNode sequenceNoNode; // if (nodeList.Count > 0) // sequenceNoNode = nodeList[0]; // else // { // sequenceNoNode = xmlDoc.CreateElement(MPF_PLAN_XML_SEQUENCE_NODE_NAME); // xmlDoc.DocumentElement.AppendChild(sequenceNoNode); // } // sequenceNoNode.InnerText = NewSequenceNo.ToString(); // nodeList = xmlDoc.GetElementsByTagName(MPF_PLAN_XML_LAST_GENERATE_DATE); // System.Xml.XmlNode lastDateNode; // if (nodeList.Count > 0) // lastDateNode = nodeList[0]; // else // { // lastDateNode = xmlDoc.CreateElement(MPF_PLAN_XML_LAST_GENERATE_DATE); // xmlDoc.DocumentElement.AppendChild(lastDateNode); // } // lastDateNode.InnerText = AppUtils.ServerDateTime().ToString("yyyyMMdd"); // mpfPlan.MPFPlanExtendData = xmlDoc.InnerXml; // EMPFPlan.db.update(dbConn, mpfPlan); // } //} private void GenerateMPFDataByPeriod(GenericMPFFileDetail mpfFileDetail, ArrayList periodList) { foreach (GenericMPFFileContributionDetail contributionDetail in mpfFileDetail.MPFContributionDetailList) { MPFPeriod currentMPFPeriod = null; foreach (MPFPeriod mpfPeriod in periodList) { if (mpfPeriod.PeriodFrom < contributionDetail.PeriodTo && mpfPeriod.PeriodTo > contributionDetail.PeriodFrom) { if (mpfPeriod.PeriodFrom > contributionDetail.PeriodFrom) { mpfPeriod.PeriodFrom = contributionDetail.PeriodFrom; } if (mpfPeriod.PeriodTo < contributionDetail.PeriodTo) { mpfPeriod.PeriodFrom = contributionDetail.PeriodFrom; } currentMPFPeriod = mpfPeriod; } } if (currentMPFPeriod == null) { currentMPFPeriod = CreateMPFPeriod(contributionDetail.PeriodFrom, contributionDetail.PeriodTo); periodList.Add(currentMPFPeriod); } EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = mpfFileDetail.EmpID; EEmpPersonalInfo.db.select(dbConn, empInfo); string[] mpfFileMCDetailStringList = new string[13]; mpfFileMCDetailStringList[0] = "D"; mpfFileMCDetailStringList[1] = string.Empty.PadLeft(10); mpfFileMCDetailStringList[2] = mpfFileDetail.HKIDPassport.PadRight(15).Substring(0, 15); mpfFileMCDetailStringList[3] = empInfo.EmpEngSurname.PadRight(20).Substring(0, 20); mpfFileMCDetailStringList[4] = empInfo.EmpEngOtherName.PadRight(20).Substring(0, 20); mpfFileMCDetailStringList[5] = contributionDetail.RelevantIncome.ToString("00000000000.00").Replace(".", ""); mpfFileMCDetailStringList[6] = contributionDetail.MCEE.ToString("00000000000.00").Replace(".", ""); mpfFileMCDetailStringList[7] = contributionDetail.MCER.ToString("00000000000.00").Replace(".", ""); mpfFileMCDetailStringList[8] = contributionDetail.VCEE.ToString("00000000000.00").Replace(".", ""); mpfFileMCDetailStringList[9] = contributionDetail.VCER.ToString("00000000000.00").Replace(".", ""); mpfFileMCDetailStringList[10] = ((double)0).ToString("00000000000.00").Replace(".", ""); // no surcharge support mpfFileMCDetailStringList[11] = " "; // Not In Use Since file specification 1.7a mpfFileMCDetailStringList[12] = string.Empty.PadLeft(8); // Not In Use Since file specification 1.7a currentMPFPeriod.TotalContributionAmount += contributionDetail.MCER + contributionDetail.MCEE; currentMPFPeriod.TotalContributionAmount += contributionDetail.VCER + contributionDetail.VCEE; currentMPFPeriod.DetailStringList.Add(string.Join(FIELD_DELIMITER, mpfFileMCDetailStringList)); } }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ELeavePlan c = new ELeavePlan(); c.LeavePlanID = CurID; if (ELeavePlan.db.select(dbConn, c)) { DBFilter empPosFilter = new DBFilter(); empPosFilter.add(new Match("LeavePlanID", c.LeavePlanID)); empPosFilter.add("empid", true); ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter); if (empPosList.Count > 0) { errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Leave Plan Code"), c.LeavePlanCode })); foreach (EEmpPositionInfo empPos in empPosList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empPos.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); } else { EEmpPositionInfo.db.delete(dbConn, empPos); } } errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT); return; } else { WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, c); DBFilter dbFilter = new DBFilter(); dbFilter.add(new Match("LeavePlanID", c.LeavePlanID)); ArrayList leaveEntitleDetailList = ELeavePlanEntitle.db.select(dbConn, dbFilter); foreach (ELeavePlanEntitle leaveEntitlement in leaveEntitleDetailList) { ELeavePlanEntitle.db.delete(dbConn, leaveEntitlement); } WebUtils.EndFunction(dbConn); } } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "LeavePlan_List.aspx"); }
protected void btnSaveDelegate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); string[] strDelegateEmpNoList = txtDelegateEmpNoList.Text.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); ESSAuthorizationProcess authorizationProcess = new ESSAuthorizationProcess(dbConn); List <EEmpPersonalInfo> delegateEmpInfoList = new List <EEmpPersonalInfo>(); foreach (string delegateEmpNo in strDelegateEmpNoList) { EEmpPersonalInfo delegateEmpInfo = authorizationProcess.GetEmpInfo(delegateEmpNo); if (delegateEmpInfo == null) { errors.addError("Invalid Employee No: " + delegateEmpNo); } else { delegateEmpInfoList.Add(delegateEmpInfo); EEmpTermination empTerm = EEmpTermination.GetObjectByEmpID(dbConn, delegateEmpInfo.EmpID); if (empTerm != null) { if (empTerm.EmpTermLastDate < AppUtils.ServerDateTime().Date) { errors.addError("Employee " + delegateEmpNo + " is Terminated"); } } } } if (!errors.isEmpty()) { return; } DBFilter authorizerDBFilter = new DBFilter(); authorizerDBFilter.add(new Match("EmpID", CurID)); EAuthorizerDelegate.db.delete(dbConn, authorizerDBFilter); foreach (EEmpPersonalInfo delegateEmpInfo in delegateEmpInfoList) { EAuthorizerDelegate authorDelegate = new EAuthorizerDelegate(); authorDelegate.EmpID = CurID; authorDelegate.AuthorizerDelegateEmpID = delegateEmpInfo.EmpID; EAuthorizerDelegate.db.insert(dbConn, authorDelegate); } errors.addError("Delegate employee is submitted"); }
public DataView loadData(ListInfo info, DBManager db, DataList repeater) { //filter.add(new Match("EmpPayrollID",EmpPayrollID.Value)); ImportCommissionAchievementProcess CAImport = new ImportCommissionAchievementProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID); DataTable table = CAImport.GetImportDataFromTempDatabase(info); if (info != null) { if (!string.IsNullOrEmpty(info.orderby)) { if (info.orderby.Equals("EmpEngFullName", StringComparison.CurrentCultureIgnoreCase)) { if (!table.Columns.Contains("EmpEngFullName")) { table.Columns.Add("EmpEngFullName", typeof(string)); foreach (System.Data.DataRow row in table.Rows) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = (int)row["EmpID"]; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { row["EmpEngFullName"] = empInfo.EmpEngFullName; } } } } } } table = WebUtils.DataTableSortingAndPaging(table, info); view = new DataView(table); if (repeater != null) { repeater.DataSource = view; repeater.DataBind(); } if (table.Rows.Count > 0) { ImportSection.Visible = true; } else { ImportSection.Visible = false; } return(view); }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); EWorkHourPattern o = new EWorkHourPattern(); o.WorkHourPatternID = CurID; db.select(dbConn, o); DBFilter empWorkHourPatternFilter = new DBFilter(); empWorkHourPatternFilter.add(new Match("WorkHourPatternID", o.WorkHourPatternID)); empWorkHourPatternFilter.add("empid", true); ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empWorkHourPatternFilter); if (empPosList.Count > 0) { int curEmpID = 0; errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Work Hour Pattern"), o.WorkHourPatternCode })); foreach (EEmpPositionInfo empPos in empPosList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empPos.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { if (curEmpID != empPos.EmpID) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); curEmpID = empPos.EmpID; } } // Start 0000148, Ricky So, 2014/12/21 // else // EEmpPositionInfo.db.delete(dbConn, empPos); // Start 0000148, Ricky So, 2014/12/21 } errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT); return; } else { WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, o); WebUtils.EndFunction(dbConn); } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "WorkHourPattern_List.aspx"); }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(db, Repeater, "ItemSelect"); foreach (EYEBPlan o in list) { if (db.select(dbConn, o)) { DBFilter empYEBPlanFilter = new DBFilter(); empYEBPlanFilter.add(new Match("YEBPlanID", o.YEBPlanID)); empYEBPlanFilter.add("empid", true); ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empYEBPlanFilter); if (empPosList.Count > 0) { int curEmpID = 0; errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("YEB Plan Code"), o.YEBPlanCode })); foreach (EEmpPositionInfo empPos in empPosList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empPos.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { if (curEmpID != empPos.EmpID) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); curEmpID = empPos.EmpID; } else { EEmpPositionInfo.db.delete(dbConn, empPos); } } } errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT); } else { WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, o); WebUtils.EndFunction(dbConn); } } } loadData(info, db, Repeater); }
protected bool loadObject() { obj = new EEmpPersonalInfo(); obj.EmpID = CurID; if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); return(true); }
protected bool loadObject() { obj = new ETaxEmp(); bool isNew = WebFormWorkers.loadKeys(ETaxEmp.db, obj, DecryptedRequest); if (!ETaxEmp.db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); ETaxEmp.db.populate(obj, values); binding.toControl(values); ucTaxation_Emp_Header.CurrentTaxEmpID = obj.TaxEmpID; ETaxForm taxForm = new ETaxForm(); taxForm.TaxFormID = obj.TaxFormID; if (ETaxForm.db.select(dbConn, taxForm)) { TaxFormType = taxForm.TaxFormType; } EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = obj.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { TaxEmpPlaceAddress.Text = empInfo.EmpResAddr; if (empInfo.EmpResAddrAreaCode.Equals("H")) { TaxEmpPlaceAddress.Text += ", " + "Hong Kong"; } else if (empInfo.EmpResAddrAreaCode.Equals("K")) { TaxEmpPlaceAddress.Text += ", " + "Kowloon"; } else if (empInfo.EmpResAddrAreaCode.Equals("N")) { TaxEmpPlaceAddress.Text += ", " + "New Territories"; } } TaxEmpPlaceNature.Text = "Flat"; TaxEmpPlacePeriodFr.Value = obj.TaxEmpStartDate.ToString("yyyy-MM-dd"); TaxEmpPlacePeriodTo.Value = obj.TaxEmpEndDate.ToString("yyyy-MM-dd"); return(true); }
protected void btnAdd_Click(object sender, EventArgs e) { WebUtils.StartFunction(Session, FUNCTION_CODE); foreach (RepeaterItem item in Repeater.Items) { CheckBox cb = (CheckBox)item.FindControl("ItemSelect"); CheckBox AuthorizerIsReadOnly = (CheckBox)item.FindControl("AuthorizerIsReadOnly"); CheckBox AuthorizerSkipEmailAlert = (CheckBox)item.FindControl("AuthorizerSkipEmailAlert"); if (cb.Checked) { EEmpPersonalInfo o = new EEmpPersonalInfo(); WebFormUtils.GetKeys(EEmpPersonalInfo.db, o, cb); DBFilter empAuthorizerFilter = new DBFilter(); empAuthorizerFilter.add(new Match("empid", o.EmpID)); empAuthorizerFilter.add(new Match("AuthorizationGroupID", CurID)); if (EAuthorizer.db.count(dbConn, empAuthorizerFilter) <= 0) { EAuthorizer authorizer = new EAuthorizer(); authorizer.EmpID = o.EmpID; authorizer.AuthorizationGroupID = CurID; authorizer.AuthorizerIsReadOnly = AuthorizerIsReadOnly.Checked; authorizer.AuthorizerSkipEmailAlert = AuthorizerSkipEmailAlert.Checked; EAuthorizer.db.insert(dbConn, authorizer); } } } WebUtils.EndFunction(dbConn); ArrayList list = WebUtils.SelectedRepeaterItemToBaseObjectList(EEmpPersonalInfo.db, Repeater, "ItemSelect"); foreach (EEmpPersonalInfo o in list) { DBFilter empAuthorizerFilter = new DBFilter(); empAuthorizerFilter.add(new Match("empid", o.EmpID)); empAuthorizerFilter.add(new Match("AuthorizationGroupID", CurID)); if (EAuthorizer.db.count(dbConn, empAuthorizerFilter) <= 0) { WebUtils.StartFunction(Session, FUNCTION_CODE, o.EmpID); EAuthorizer authorizer = new EAuthorizer(); authorizer.EmpID = o.EmpID; authorizer.AuthorizationGroupID = CurID; EAuthorizer.db.insert(dbConn, authorizer); WebUtils.EndFunction(dbConn); } } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "ESS_AuthorizationGroup_View.aspx?AuthorizationGroupID=" + CurID); }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ELeaveCode obj = new ELeaveCode(); obj.LeaveCodeID = CurID; db.select(dbConn, obj); DBFilter leaveApplicationFilter = new DBFilter(); leaveApplicationFilter.add(new Match("LeaveCodeID", obj.LeaveCodeID)); leaveApplicationFilter.add("empid", true); ArrayList leaveApplicationList = ELeaveApplication.db.select(dbConn, leaveApplicationFilter); if (leaveApplicationList.Count > 0) { int curEmpID = 0; errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Leave Code"), obj.LeaveCode })); foreach (ELeaveApplication leaveApplication in leaveApplicationList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = leaveApplication.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { if (curEmpID != leaveApplication.EmpID) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); curEmpID = leaveApplication.EmpID; } } else { ELeaveApplication.db.delete(dbConn, leaveApplication); } } errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT); return; } else { WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, obj); WebUtils.EndFunction(dbConn); } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "LeaveCode_List.aspx"); }
protected bool loadObject() { obj = new EEmpPersonalInfo(); obj.EmpID = CurID; // bool isNew = WebFormWorkers.loadKeys(db, obj, Request); if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); return(true); }
public override DataTable GetImportDataFromTempDatabase(ListInfo info) { DBFilter sessionFilter = new DBFilter(); sessionFilter.add(new Match("SessionID", m_SessionID)); sessionFilter.add("EmpID", true); //if (info != null && info.orderby != null && !info.orderby.Equals("")) // sessionFilter.add(info.orderby, info.order); ArrayList uploadRosterTableList = EUploadRosterTable.db.select(dbConn, sessionFilter); DataTable resultTable = new DataTable(); resultTable.Columns.Add("EmpNo", typeof(string)); resultTable.Columns.Add("EmpName", typeof(string)); for (int day = 1; day <= 31; day++) { resultTable.Columns.Add("Roster" + day.ToString("00"), typeof(string)); } int lastEmpID = 0; DataRow rosterTableRow = null; foreach (EUploadRosterTable uploadRosterTable in uploadRosterTableList) { if (!lastEmpID.Equals(uploadRosterTable.EmpID)) { lastEmpID = uploadRosterTable.EmpID; rosterTableRow = resultTable.NewRow(); resultTable.Rows.Add(rosterTableRow); EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = uploadRosterTable.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { rosterTableRow["EmpNo"] = empInfo.EmpNo; rosterTableRow["EmpName"] = empInfo.EmpEngFullName; } } ERosterCode rosterCode = new ERosterCode(); rosterCode.RosterCodeID = uploadRosterTable.RosterCodeID; if (ERosterCode.db.select(dbConn, rosterCode)) { rosterTableRow["Roster" + uploadRosterTable.RosterTableDate.ToString("dd")] = rosterCode.RosterCode; } } return(resultTable); }
public DataView loadData(ListInfo info, DBManager db, DataList repeater) { HROne.Import.ImportAttendancePreparationProcess m_import = new ImportAttendancePreparationProcess(dbConn, Session.SessionID, WebUtils.GetCurUser(Session).UserID); DataTable m_table = m_import.GetImportDataFromTempDatabase(info); if (info != null) { if (!string.IsNullOrEmpty(info.orderby)) { if (info.orderby.Equals("EmpEngFullName", StringComparison.CurrentCultureIgnoreCase)) { if (!m_table.Columns.Contains("EmpEngFullName")) { m_table.Columns.Add("EmpEngFullName", typeof(string)); foreach (System.Data.DataRow row in m_table.Rows) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = (int)row["EmpID"]; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { row["EmpEngFullName"] = empInfo.EmpEngFullName; } } } } } } m_table = WebUtils.DataTableSortingAndPaging(m_table, info); view = new DataView(m_table); if (repeater != null) { repeater.DataSource = view; repeater.DataBind(); } if (m_table.Rows.Count > 0) { ImportSection.Visible = true; } else { ImportSection.Visible = false; } return(view); }
//public DataView loadData2(ListInfo info, DBManager db, Repeater repeater) //{ // DBFilter filter = new DBFilter(); // filter.add(WebUtils.AddRankFilter(Session, "e.EmpID", true)); // int m_batchID = -1; // if (!int.TryParse(BatchID.SelectedValue, out m_batchID)) // { // m_batchID = -1; // } // DBFilter m_batchFilter = new DBFilter(); // m_batchFilter.add(new Match("HitRateProcessImportBatchID", m_batchID)); // filter.add(new IN("EmpID", "SELECT EmpID FROM HitRateProcess ", m_batchFilter)); // string select = "e.* "; // string from = "from [" + db.dbclass.tableName + "] e "; // DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime()); // empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID")); // filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter)); // DataTable table = filter.loadData(dbConn, null, select, from); // table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info); // view = new DataView(table); // ListFooter.Refresh(); // if (repeater != null) // { // repeater.DataSource = view; // repeater.DataBind(); // } // return view; //} public DataView loadData(ListInfo info, DBManager db, DataList repeater) { DBFilter filter = new DBFilter(); // sbinding.createFilter(); int m_batchID = -1; int.TryParse(BatchID.SelectedValue, out m_batchID); filter.add(new Match("c.HitRateProcessImportBatchID", m_batchID)); filter.add(new MatchField("c.EmpID", "e.EmpID")); DataTable table = filter.loadData(dbConn, null, "e.*, c.* ", " from " + EHitRateProcess.db.dbclass.tableName + " c, " + EEmpPersonalInfo.db.dbclass.tableName + " e "); if (info != null) { if (!string.IsNullOrEmpty(info.orderby)) { if (info.orderby.Equals("EmpEngFullName", StringComparison.CurrentCultureIgnoreCase)) { if (!table.Columns.Contains("EmpEngFullName")) { table.Columns.Add("EmpEngFullName", typeof(string)); foreach (System.Data.DataRow row in table.Rows) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = (int)row["EmpID"]; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { row["EmpEngFullName"] = empInfo.EmpEngFullName; } } } } } } table = WebUtils.DataTableSortingAndPaging(table, info); view = new DataView(table); if (repeater != null) { repeater.DataSource = view; repeater.DataBind(); } return(view); }
public void ImportToDatabase(int UploadEmpID) { DBFilter sessionFilter = new DBFilter(); sessionFilter.add(new Match("SessionID", m_SessionID)); if (UploadEmpID > 0) { sessionFilter.add(new Match("UploadEmpID", UploadEmpID)); } ArrayList uploadEmpTerminationList = tempDB.select(dbConn, sessionFilter); foreach (EUploadEmpTermination obj in uploadEmpTerminationList) { EEmpTermination empTermination = new EEmpTermination(); if (obj.ImportActionStatus != ImportDBObject.ImportActionEnum.INSERT) { empTermination.EmpTermID = obj.EmpTermID; uploadDB.select(dbConn, empTermination); } obj.ExportToObject(empTermination); if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.INSERT) { empTermination.EmpID = ParseTemp.GetEmpIDFromUploadEmpID(dbConn, obj.UploadEmpID); uploadDB.insert(dbConn, empTermination); // Upload Employee Status to Terminated EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empTermination.EmpID; empInfo.EmpStatus = "T"; EEmpPersonalInfo.db.update(dbConn, empInfo); } else if (obj.ImportActionStatus == ImportDBObject.ImportActionEnum.UPDATE) { uploadDB.update(dbConn, empTermination); // Upload Employee Status to Terminated EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empTermination.EmpID; empInfo.EmpStatus = "T"; EEmpPersonalInfo.db.update(dbConn, empInfo); } tempDB.delete(dbConn, obj); } }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ArrayList empJoinList = new ArrayList(); foreach (RepeaterItem item in Repeater.Items) { CheckBox cb = (CheckBox)item.FindControl("ItemSelect"); if (cb.Checked) { EEmpPersonalInfo empJoin = new EEmpPersonalInfo(); WebFormUtils.GetKeys(EEmpPersonalInfo.db, empJoin, cb); empJoinList.Add(empJoin); } } if (empJoinList.Count < 1) { errors.addError("Employee not selected"); } if (errors.isEmpty()) { ESystemParameter.setParameter(dbConn, SYSTEMPARAMETER_PREPAREDBY, txtPreparedBy.Text); ESystemParameter.setParameter(dbConn, SYSTEMPARAMETER_REVIEWEDBY, txtReviewedBy.Text); HROne.Reports.Payroll.NewJoinPaymentSummaryProcess rpt = null; if (Payroll_PeriodSelectionList1.SelectedPayrollStatus.Equals("C")) { ArrayList payBatchList = this.Payroll_PeriodSelectionList1.GetPayBatchList(); rpt = new HROne.Reports.Payroll.NewJoinPaymentSummaryProcess(dbConn, empJoinList, null, payBatchList, HROne.Reports.Payroll.NewJoinPaymentSummaryProcess.ReportType.History, txtPreparedBy.Text, txtReviewedBy.Text); } else if (Payroll_PeriodSelectionList1.SelectedPayrollStatus.Equals("T")) { ArrayList payPeriodList = this.Payroll_PeriodSelectionList1.GetTrialRunPayPeriodList(); rpt = new HROne.Reports.Payroll.NewJoinPaymentSummaryProcess(dbConn, empJoinList, payPeriodList, null, HROne.Reports.Payroll.NewJoinPaymentSummaryProcess.ReportType.TrialRun, txtPreparedBy.Text, txtReviewedBy.Text); } string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_NewJoinPaymentSummary.rpt")); WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "NewJoinPaymentSummary", true); } }
//private static double CalculateEEAmount(DatabaseConnection dbConn, EEmpPersonalInfo empInfo, int ORSOPlanID, double TotalVCRI, EPayrollPeriod payrollPeriod, DateTime ORSOJoinDate) //{ // double totalVC = 0; // EORSOPlan orsoPlan = new EORSOPlan(); // orsoPlan.ORSOPlanID = ORSOPlanID; // if (EORSOPlan.db.select(dbConn, orsoPlan)) // { // // Use Service Year to Compare // double YearOfService = HROne.Payroll.PayrollProcess.GetYearOfServer(dbConn, empInfo.EmpID, payrollPeriod.PayPeriodFr); // EORSOPlanDetail orsoPlanDetailFrom = orsoPlan.GetORSOPlanDetail(dbConn, YearOfService); // if (TotalVCRI <= 0) // return 0; // else // { // totalVC = TotalVCRI * orsoPlanDetailFrom.ORSOPlanDetailEE/ 100; // totalVC += orsoPlanDetailFrom.ORSOPlanDetailEEFix; // return totalVC < orsoPlan.ORSOPlanMaxEmployeeVC ? totalVC : orsoPlan.ORSOPlanMaxEmployeeVC; // } // } // else // return 0; //} // End 0000084, Ricky So, 2014-08-22 // Start 0000084, Ricky So, 2014-08-22 private static double CalculateERAmount(DatabaseConnection dbConn, EEmpPersonalInfo empInfo, int ORSOPlanID, double TotalVCRI, EPayrollPeriod payrollPeriod, EMPFRecord mpfRecord) { double totalVC = 0; EORSOPlan orsoPlan = new EORSOPlan(); orsoPlan.ORSOPlanID = ORSOPlanID; if (EORSOPlan.db.select(dbConn, orsoPlan)) { // Use Service Year to Compare double YearOfService = HROne.Payroll.PayrollProcess.GetYearOfServer(dbConn, empInfo.EmpID, payrollPeriod.PayPeriodFr); EORSOPlanDetail orsoPlanDetailFrom = orsoPlan.GetORSOPlanDetail(dbConn, YearOfService); if (orsoPlanDetailFrom == null || TotalVCRI <= 0) { return(0); } else { totalVC = TotalVCRI * orsoPlanDetailFrom.ORSOPlanDetailER / 100; // Cap before residual if (orsoPlan.ORSOPlanEmployerResidual) { // Start 0000084, Ricky So, 2014-08-22 totalVC = (totalVC > orsoPlan.ORSOPlanEmployerResidualCap) ? orsoPlan.ORSOPlanEmployerResidualCap : totalVC; // End 0000084, Ricky So, 2014-08-22 // Deduct MPF contribution (use residual) if (mpfRecord != null) { totalVC = (totalVC > mpfRecord.MPFRecActMCER) ? (totalVC - mpfRecord.MPFRecActMCER) : 0; } } totalVC += orsoPlanDetailFrom.ORSOPlanDetailERFix; return(totalVC < orsoPlan.ORSOPlanMaxEmployerVC ? totalVC : orsoPlan.ORSOPlanMaxEmployerVC); } } else { return(0); } }
protected void Delete_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ERosterTableGroup o = new ERosterTableGroup(); o.RosterTableGroupID = CurID; if (ERosterTableGroup.db.select(dbConn, o)) { DBFilter empPosFilter = new DBFilter(); empPosFilter.add(new Match("RosterTableGroupID", o.RosterTableGroupID)); empPosFilter.add("EmpID", true); ArrayList empPosList = EEmpPositionInfo.db.select(dbConn, empPosFilter); if (empPosList.Count > 0) { errors.addError(string.Format(HROne.Translation.PageErrorMessage.ERROR_CODE_USED_BY_EMPLOYEE, new string[] { HROne.Common.WebUtility.GetLocalizedString("Roster Table Group"), o.RosterTableGroupCode })); foreach (EEmpPositionInfo empPos in empPosList) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = empPos.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { errors.addError("- " + empInfo.EmpNo + ", " + empInfo.EmpEngFullName); } else { EEmpPositionInfo.db.delete(dbConn, empPos); } } errors.addError(HROne.Translation.PageErrorMessage.ERROR_ACTION_ABORT); return; } else { WebUtils.StartFunction(Session, FUNCTION_CODE); db.delete(dbConn, o); WebUtils.EndFunction(dbConn); } } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Attendance_RosterTableGroup_List.aspx"); }
protected bool loadObject() { obj = new EEmpPersonalInfo(); obj.EmpID = CurID; if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); //------------------------------------------------------ //Select EmpRequestID from the EmpRequest table. Check Employee has submit the employee information DBFilter filterStatus = new DBFilter(); DBManager Requestdb = EEmpRequest.db; filterStatus.add(new Match("EmpID", CurID)); filterStatus.add(new Match("EmpRequestType", EEmpRequest.TYPE_EEPROFILE)); filterStatus.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_REJECTED)); filterStatus.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_APPROVED)); filterStatus.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_CANCELLED)); if (Requestdb.count(dbConn, filterStatus) > 0) { ArrayList EmpRequestList = Requestdb.select(dbConn, filterStatus); EEmpRequest EmpRequest = (EEmpRequest)EmpRequestList[0]; uc3Emp_Request_Empinfo.CurrentRequestID = EmpRequest.EmpRequestRecordID; uc3Emp_Request_Empinfo.CurrentRequestStatus = HROne.Common.WebUtility.GetLocalizedString(EmpRequest.EmpRequestStatus); uc3Emp_Request_Empinfo.Visible = true; uc1Emp_info.Visible = false; } else { uc3Emp_Request_Empinfo.Visible = false; uc1Emp_info.Visible = true; } return(true); }
protected bool loadObject() { ETaxEmp obj = new ETaxEmp(); obj.TaxEmpID = CurID; if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); if (obj.EmpID != 0) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = obj.EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { Hashtable empValues = new Hashtable(); EEmpPersonalInfo.db.populate(empInfo, empValues); empBinding.toControl(empValues); } } if (obj.TaxFormID != 0) { ETaxForm taxForm = new ETaxForm(); taxForm.TaxFormID = obj.TaxFormID; if (ETaxForm.db.select(dbConn, taxForm)) { Hashtable taxFormValues = new Hashtable(); ETaxForm.db.populate(taxForm, taxFormValues); taxFormBinding.toControl(taxFormValues); } } return(true); }
private string GetTimeCardNo(int EmpID) { EEmpPersonalInfo empInfo = new EEmpPersonalInfo(); empInfo.EmpID = EmpID; if (EEmpPersonalInfo.db.select(dbConn, empInfo)) { if (!string.IsNullOrEmpty(empInfo.EmpTimeCardNo)) { return(empInfo.EmpTimeCardNo); } else { return(empInfo.EmpNo); } } else { return(string.Empty); } }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); EEmpPersonalInfo p = new EEmpPersonalInfo(); ArrayList values = new ArrayList(); foreach (RepeaterItem item in Repeater.Items) { CheckBox cb = (CheckBox)item.FindControl("ItemSelect"); if (cb.Checked) { WebFormUtils.GetKeys(db, p, cb); values.Add(p.EmpID); } } if (values.Count <= 0) { errors.addError("Employee not selected"); } if (errors.isEmpty()) { HROne.Reports.Employee.EmployeeListProcess rpt = new HROne.Reports.Employee.EmployeeListProcess(dbConn, values); string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Employee_List.rpt")); WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "EmployeeList", true); } //Session["Report_EmployeeList"] = values; //HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Report_EmployeeList_View.aspx"); //HROne.Reports.EmployeeList r = new HROne.Reports.EmployeeList(); //r.DataSourceConnections[0].SetConnection("localhost", "HROne20080810", "mac", "mac"); //Response.ContentType = "application/pdf"; //r.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "report.pdf"); }
protected bool loadObject() { obj = new EEmpPersonalInfo(); obj.EmpID = CurID; if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); if ((ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_ESS_FUNCTION_CHANGE_EE_INFO).Equals("N", StringComparison.CurrentCultureIgnoreCase) ? false : true)) { DBFilter RequestEmpFilter = new DBFilter(); RequestEmpFilter.add(new Match("EmpID", obj.EmpID)); RequestEmpFilter.add(new Match("EmpRequestType", EEmpRequest.TYPE_EEPROFILE)); RequestEmpFilter.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_APPROVED)); RequestEmpFilter.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_REJECTED)); RequestEmpFilter.add(new Match("EmpRequestStatus", "<>", EEmpRequest.STATUS_CANCELLED)); ArrayList EmpRequestList = EEmpRequest.db.select(dbConn, RequestEmpFilter); if (EmpRequestList.Count > 0) { Edit.Visible = false; } else { Edit.Visible = true; } } else { Edit.Visible = false; } return(true); }
protected bool loadObject() { obj = new EEmpPersonalInfo(); bool isNew = WebFormWorkers.loadKeys(EEmpPersonalInfo.db, obj, DecryptedRequest); DBFilter filter = new DBFilter(); filter.add(new Match("EmpID", obj.EmpID)); filter.add(WebUtils.AddRankFilter(Session, "EmpID", true)); ArrayList empInfoList = EEmpPersonalInfo.db.select(dbConn, filter); if (empInfoList.Count == 0) { return(false); } obj = (EEmpPersonalInfo)empInfoList[0]; //Hashtable values = new Hashtable(); //EEmpPersonalInfo.db.populate(obj, values); //binding.toControl(values); ucEmp_Header.CurrentEmpID = obj.EmpID; return(true); }
protected bool loadObject() { obj = new EEmpPersonalInfo(); obj.EmpID = CurID; // bool isNew = WebFormWorkers.loadKeys(db, obj, Request); if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); if (obj.EmpProbaLastDate >= AppUtils.ServerDateTime().Date) { EmpProbaLastDate.ForeColor = System.Drawing.Color.Red; EmpProbaLastDate.Font.Bold = true; } EEmpTermination empTerm = EEmpTermination.GetObjectByEmpID(dbConn, obj.EmpID); if (empTerm == null) { EmpTermLastDate.Text = string.Empty; } else { EmpTermLastDate.Text = empTerm.EmpTermLastDate.ToString("yyyy-MM-dd"); EmpTermLastDate.ForeColor = System.Drawing.Color.Red; EmpTermLastDate.Font.Bold = true; } return(true); }
protected bool loadObject() { obj = new EEmpPersonalInfo(); obj.EmpID = CurID; if (!db.select(dbConn, obj)) { return(false); } ESSAuthorizationProcess authorizationProcess = new ESSAuthorizationProcess(dbConn); int groupCount = authorizationProcess.GetAuthorizerAuthorizationGroupList(CurID).Count; if (groupCount > 0) { Emp_Authorize_List_Form1.Visible = true; } else { Emp_Authorize_List_Form1.Visible = false; } //------------------------------------------------------ return(true); }