protected void Delete_Click(object sender, EventArgs e) { ArrayList list = new ArrayList(); foreach (DataListItem item in Repeater.Items) { CheckBox c = (CheckBox)item.FindControl("DeleteItem"); HtmlInputHidden h = (HtmlInputHidden)item.FindControl("TaxEmpPlaceID"); if (c.Checked) { ETaxEmpPlaceOfResidence obj = new ETaxEmpPlaceOfResidence(); obj.TaxEmpPlaceID = Int32.Parse(h.Value); list.Add(obj); } } ETaxEmp taxEmp = new ETaxEmp(); taxEmp.TaxEmpID = int.Parse(TaxEmpID.Value); if (ETaxEmp.db.select(dbConn, taxEmp)) { WebUtils.StartFunction(Session, FUNCTION_CODE, taxEmp.EmpID); foreach (ETaxEmpPlaceOfResidence obj in list) { if (db.select(dbConn, obj)) { db.delete(dbConn, obj); } } WebUtils.EndFunction(dbConn); } view = loadData(info, db, Repeater); }
private void ValidateData(ETaxEmpPlaceOfResidence obj, PageErrors errors) { DBFilter overlapCheckingFilter = new DBFilter(); overlapCheckingFilter.add(new Match("TaxEmpID", obj.TaxEmpID)); if (obj.TaxEmpPlaceID > 0) { overlapCheckingFilter.add(new Match("TaxEmpPlaceID", "<>", obj.TaxEmpPlaceID)); } overlapCheckingFilter.add(new Match("TaxEmpPlacePeriodTo", ">=", obj.TaxEmpPlacePeriodFr)); overlapCheckingFilter.add(new Match("TaxEmpPlacePeriodFr", "<=", obj.TaxEmpPlacePeriodTo)); if (ETaxEmpPlaceOfResidence.db.count(dbConn, overlapCheckingFilter) > 0) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE); } else { if (obj.TaxEmpPlacePeriodFr > obj.TaxEmpPlacePeriodTo) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE); return; } ETaxEmp taxEmp = new ETaxEmp(); taxEmp.TaxEmpID = obj.TaxEmpID; if (ETaxEmp.db.select(dbConn, taxEmp)) { if (taxEmp.TaxEmpStartDate > obj.TaxEmpPlacePeriodFr || taxEmp.TaxEmpEndDate < obj.TaxEmpPlacePeriodTo) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE); } } } }
protected void Add_Click(object sender, EventArgs e) { Repeater.EditItemIndex = -1; ETaxEmpPayment c = new ETaxEmpPayment(); Hashtable values = new Hashtable(); newBinding.toValues(values); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, c); ValidateData(c, errors); if (!errors.isEmpty()) { return; } ETaxPayment taxPay = new ETaxPayment(); taxPay.TaxPayID = c.TaxPayID; ETaxPayment.db.select(dbConn, taxPay); if (taxPay.TaxPayIsShowNature.Equals("Y")) { c.TaxEmpPayNature = taxPay.TaxPayNature; } ETaxEmp taxEmp = new ETaxEmp(); taxEmp.TaxEmpID = c.TaxEmpID; if (ETaxEmp.db.select(dbConn, taxEmp)) { WebUtils.StartFunction(Session, FUNCTION_CODE, taxEmp.EmpID); db.insert(dbConn, c); WebUtils.EndFunction(dbConn); } TaxPayID.SelectedIndex = 0; TaxEmpPayAmount.Text = string.Empty; newBinding.init(Request, Session); loadObject(); view = loadData(info, db, Repeater); }
protected void Add_Click(object sender, EventArgs e) { Repeater.EditItemIndex = -1; ETaxEmpPlaceOfResidence c = new ETaxEmpPlaceOfResidence(); Hashtable values = new Hashtable(); newBinding.toValues(values); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, c); ValidateData(c, errors); if (!errors.isEmpty()) { return; } ETaxEmp taxEmp = new ETaxEmp(); taxEmp.TaxEmpID = c.TaxEmpID; if (ETaxEmp.db.select(dbConn, taxEmp)) { WebUtils.StartFunction(Session, FUNCTION_CODE, taxEmp.EmpID); db.insert(dbConn, c); WebUtils.EndFunction(dbConn); } TaxEmpPlaceAddress.Text = string.Empty; TaxEmpPlaceEERent.Text = string.Empty; TaxEmpPlaceEERentRefunded.Text = string.Empty; TaxEmpPlaceERRent.Text = string.Empty; TaxEmpPlaceERRentByEE.Text = string.Empty; TaxEmpPlaceNature.Text = string.Empty; TaxEmpPlacePeriodFr.TextBox.Text = string.Empty; TaxEmpPlacePeriodTo.TextBox.Text = string.Empty; loadObject(); view = loadData(info, db, Repeater); }
protected void btnPrint_Click(object sender, EventArgs e) { HROne.DataAccess.PageErrors errors = HROne.DataAccess.PageErrors.getErrors(null, Page.Master); errors.clear(); ArrayList list = new ArrayList(); foreach (RepeaterItem i in Repeater.Items) { CheckBox cb = (CheckBox)i.FindControl("ItemSelect"); if (cb.Checked) { ETaxEmp o = (ETaxEmp)ETaxEmp.db.createObject(); WebFormUtils.GetKeys(db, o, cb); list.Add(o); } } DateTime processDateTime = AppUtils.ServerDateTime(); if (list.Count > 0) { ESystemParameter.setParameter(dbConn, TAXATION_NAME_OF_SIGNATURE, txtNameOfSignature.Text); HROne.Reports.Taxation.TaxationFormProcess.ReportLanguage lang = HROne.Reports.Taxation.TaxationFormProcess.ReportLanguage.English; if (ReportLanguage.SelectedValue.Equals("big5")) { lang = HROne.Reports.Taxation.TaxationFormProcess.ReportLanguage.TraditionalChinese; } HROne.Reports.Taxation.TaxationFormProcess rpt = new HROne.Reports.Taxation.TaxationFormProcess(dbConn, list, CurrentTaxFormID, CurTaxFormType, txtNameOfSignature.Text, lang); string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Taxation_IR56" + CurTaxFormType + ".rpt")); WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text + " ( " + TaxFormID.SelectedItem.Text + " IR56" + CurTaxFormType + " )", Response, rpt, reportFileName, string.Empty, "IR56" + CurTaxFormType, false); //string strTaxEmpIDList = string.Empty; //foreach (ETaxEmp o in list) //{ // if (strTaxEmpIDList == string.Empty) // strTaxEmpIDList = ((ETaxEmp)o).TaxEmpID.ToString(); // else // strTaxEmpIDList += "_" + ((ETaxEmp)o).TaxEmpID.ToString(); //} //Server.Transfer("Report_Taxation_Report_View.aspx?" // + "TaxFormID=" + CurrentTaxFormID // + "&TaxFormType=" + CurTaxFormType // + "&TaxEmpID=" + strTaxEmpIDList); } }
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 Back_Click(object sender, EventArgs e) { ETaxEmp c = new ETaxEmp(); c.TaxEmpID = CurID; if (db.select(dbConn, c)) { ETaxForm taxForm = new ETaxForm(); taxForm.TaxFormID = c.TaxFormID; if (ETaxForm.db.select(dbConn, taxForm)) { HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Taxation_Adjustment_List.aspx?TaxCompID=" + taxForm.TaxCompID + "&TaxFormType=" + taxForm.TaxFormType + "&TaxFormID=" + taxForm.TaxFormID); } } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Taxation_Adjustment_List.aspx"); }
protected void Delete_Click(object sender, EventArgs e) { int taxFormID = -1; ETaxEmp c = new ETaxEmp(); c.TaxEmpID = CurID; if (db.select(dbConn, c)) { taxFormID = c.TaxFormID; } WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID); db.delete(dbConn, c); { DBFilter taxEmpPaymentFilter = new DBFilter(); taxEmpPaymentFilter.add(new Match("TaxEmpID", CurID)); ArrayList taxEmpPaymentList = ETaxEmpPayment.db.select(dbConn, taxEmpPaymentFilter); foreach (ETaxEmpPayment taxEmpPayment in taxEmpPaymentList) { ETaxEmpPayment.db.delete(dbConn, taxEmpPayment); } } { DBFilter taxEmpPoRFilter = new DBFilter(); taxEmpPoRFilter.add(new Match("TaxEmpID", CurID)); ArrayList taxEmpPoRList = ETaxEmpPlaceOfResidence.db.select(dbConn, taxEmpPoRFilter); foreach (ETaxEmpPlaceOfResidence taxEmpPoR in taxEmpPoRList) { ETaxEmpPlaceOfResidence.db.delete(dbConn, taxEmpPoR); } } WebUtils.EndFunction(dbConn); ETaxForm taxForm = new ETaxForm(); taxForm.TaxFormID = taxFormID; if (ETaxForm.db.select(dbConn, taxForm)) { if (taxForm.TaxFormType.Equals("B", StringComparison.CurrentCultureIgnoreCase)) { TaxationGeneration.RearrangeSheetNo(dbConn, taxFormID); } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Taxation_Adjustment_List.aspx?TaxCompID=" + taxForm.TaxCompID + "&TaxFormType=" + taxForm.TaxFormType + "&TaxFormID=" + taxForm.TaxFormID); } HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Taxation_Adjustment_List.aspx"); }
private void ValidateData(ETaxEmpPayment obj, PageErrors errors) { if (obj.TaxEmpPayPeriodFr > obj.TaxEmpPayPeriodTo) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE); return; } ETaxEmp taxEmp = new ETaxEmp(); taxEmp.TaxEmpID = obj.TaxEmpID; if (ETaxEmp.db.select(dbConn, taxEmp)) { if (taxEmp.TaxEmpStartDate > obj.TaxEmpPayPeriodFr || taxEmp.TaxEmpEndDate < obj.TaxEmpPayPeriodTo) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE); } } }
protected void Repeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView row = (DataRowView)e.Item.DataItem; CheckBox cb = (CheckBox)e.Item.FindControl("ItemSelect"); WebFormUtils.LoadKeys(db, row, cb); ETaxEmp obj = new ETaxEmp(); db.toObject(((DataRowView)e.Item.DataItem).Row, obj); if (obj.TaxEmpIsReleasePrintoutToESS) { cb.Checked = true; } else { cb.Checked = false; } }
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); }
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.Value = taxForm.TaxFormType; } if (taxForm.TaxFormType.Equals("E")) { TaxFormBFGPanel1.Visible = false; TaxFormBFGPanel2.Visible = false; TaxEmpPayPeriodFr.Value = obj.TaxEmpStartDate.ToString("yyyy-MM-dd"); TaxEmpPayPeriodTo.Value = obj.TaxEmpStartDate.ToString("yyyy-MM-dd"); } else { TaxFormBFGPanel1.Visible = true; TaxFormBFGPanel2.Visible = true; TaxEmpPayPeriodFr.Value = obj.TaxEmpStartDate.ToString("yyyy-MM-dd"); TaxEmpPayPeriodTo.Value = obj.TaxEmpEndDate.ToString("yyyy-MM-dd"); } return(true); }
protected void btnPostToESS_Click(object sender, EventArgs e) { HROne.DataAccess.PageErrors errors = HROne.DataAccess.PageErrors.getErrors(null, Page.Master); errors.clear(); foreach (RepeaterItem i in Repeater.Items) { CheckBox cb = (CheckBox)i.FindControl("ItemSelect"); ETaxEmp o = (ETaxEmp)ETaxEmp.db.createObject(); WebFormUtils.GetKeys(db, o, cb); if (cb.Checked) { o.TaxEmpIsReleasePrintoutToESS = true; } else { o.TaxEmpIsReleasePrintoutToESS = false; } ETaxEmp.db.update(dbConn, o); } errors.addError("Taxation Report is released to ESS."); }
public static string GetValueFromID(DatabaseConnection dbConn, string fieldName, string fieldValue) { try { string tmpfieldName = fieldName; if (tmpfieldName.Equals("PreviousEmpID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("NewEmpID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "EmpID"; } if (tmpfieldName.EndsWith("PaymentCodeID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.EndsWith("PayCodeID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PaymentCodeID"; } if (tmpfieldName.Equals("DefaultMPFPlanID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "MPFPlanID"; } if (tmpfieldName.Equals("AttendanceFormulaPayFormID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("ReferencePayFormID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PayFormID"; } if (tmpfieldName.StartsWith("LeaveCode", StringComparison.CurrentCultureIgnoreCase) && tmpfieldName.EndsWith("Formula", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PayFormID"; } if (tmpfieldName.StartsWith("PayGroup", StringComparison.CurrentCultureIgnoreCase) && tmpfieldName.EndsWith("Formula", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PayFormID"; } if (tmpfieldName.Equals("CurrentPayPeriodID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "PayPeriodID"; } if (tmpfieldName.Equals("EmpPosDefaultRosterCodeID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "RosterCodeID"; } if (tmpfieldName.Equals("RosterClientMappingSiteCodeToHLevelID", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "HLevelID"; } if (tmpfieldName.Equals("EmpFirstAuthorizationGp", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("EmpSecondAuthorizationGp", StringComparison.CurrentCultureIgnoreCase)) { tmpfieldName = "AuthorizationGroupID"; } if (tmpfieldName.StartsWith("A", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("ALProrataRoundingRuleID", StringComparison.CurrentCultureIgnoreCase)) { EALProrataRoundingRule obj = new EALProrataRoundingRule(); obj.ALProrataRoundingRuleID = int.Parse(fieldValue); if (EALProrataRoundingRule.db.select(dbConn, obj)) { return(obj.ALProrataRoundingRuleCode + " - " + obj.ALProrataRoundingRuleDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("AttendancePlanID", StringComparison.CurrentCultureIgnoreCase)) { EAttendancePlan obj = new EAttendancePlan(); obj.AttendancePlanID = int.Parse(fieldValue); if (EAttendancePlan.db.select(dbConn, obj)) { return(obj.AttendancePlanCode + " - " + obj.AttendancePlanDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("AuthorizationGroupID", StringComparison.CurrentCultureIgnoreCase)) { EAuthorizationGroup obj = new EAuthorizationGroup(); obj.AuthorizationGroupID = int.Parse(fieldValue); if (EAuthorizationGroup.db.select(dbConn, obj)) { return(obj.AuthorizationCode + " - " + obj.AuthorizationDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("AVCPlanID", StringComparison.CurrentCultureIgnoreCase)) { EAVCPlan obj = new EAVCPlan(); obj.AVCPlanID = int.Parse(fieldValue); if (EAVCPlan.db.select(dbConn, obj)) { return(obj.AVCPlanCode + " - " + obj.AVCPlanDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("C", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("CessationReasonID", StringComparison.CurrentCultureIgnoreCase)) { ECessationReason obj = new ECessationReason(); obj.CessationReasonID = int.Parse(fieldValue); if (ECessationReason.db.select(dbConn, obj)) { return(obj.CessationReasonCode + " - " + obj.CessationReasonDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("CompanyID", StringComparison.CurrentCultureIgnoreCase)) { ECompany obj = new ECompany(); obj.CompanyID = int.Parse(fieldValue); if (ECompany.db.select(dbConn, obj)) { return(obj.CompanyCode + " - " + obj.CompanyName); } else { return(string.Empty); } } if (tmpfieldName.Equals("CostAllocationDetailID", StringComparison.CurrentCultureIgnoreCase)) { ECostAllocationDetail obj = new ECostAllocationDetail(); obj.CostAllocationDetailID = int.Parse(fieldValue); if (ECostAllocationDetail.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "PayCodeID", obj.PaymentCodeID.ToString()) + ", " + GetValueFromID(dbConn, "CostCenterID", obj.CostCenterID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("CostAllocationID", StringComparison.CurrentCultureIgnoreCase)) { ECostAllocation obj = new ECostAllocation(); obj.CostAllocationID = int.Parse(fieldValue); if (ECostAllocation.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "EmpPayrollID", obj.EmpPayrollID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("CostCenterID", StringComparison.CurrentCultureIgnoreCase)) { ECostCenter obj = new ECostCenter(); obj.CostCenterID = int.Parse(fieldValue); if (ECostCenter.db.select(dbConn, obj)) { return(obj.CostCenterCode + " - " + obj.CostCenterDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("D", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("DocumentTypeID", StringComparison.CurrentCultureIgnoreCase)) { EDocumentType obj = new EDocumentType(); obj.DocumentTypeID = int.Parse(fieldValue); if (EDocumentType.db.select(dbConn, obj)) { return(obj.DocumentTypeCode + " - " + obj.DocumentTypeDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("E", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("EmpAccID", StringComparison.CurrentCultureIgnoreCase)) { EEmpBankAccount obj = new EEmpBankAccount(); obj.EmpBankAccountID = int.Parse(fieldValue); if (EEmpBankAccount.db.select(dbConn, obj)) { return(obj.EmpBankCode + "-" + obj.EmpBranchCode + "-" + obj.EmpAccountNo); } //return obj.EmpBankCode + "-" + obj.EmpBranchCode + "-" + string.Empty.PadRight(obj.EmpAccountNo.Length, 'X'); else { return(string.Empty); } } if (tmpfieldName.Equals("EmpCostCenterID", StringComparison.CurrentCultureIgnoreCase)) { EEmpCostCenter obj = new EEmpCostCenter(); obj.EmpCostCenterID = int.Parse(fieldValue); if (EEmpCostCenter.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "EmpID", obj.EmpID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmpExtraFieldID", StringComparison.CurrentCultureIgnoreCase)) { EEmpExtraField obj = new EEmpExtraField(); obj.EmpExtraFieldID = int.Parse(fieldValue); if (EEmpExtraField.db.select(dbConn, obj)) { return(obj.EmpExtraFieldName); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmpID", StringComparison.CurrentCultureIgnoreCase)) { EEmpPersonalInfo obj = new EEmpPersonalInfo(); obj.EmpID = int.Parse(fieldValue); if (EEmpPersonalInfo.db.select(dbConn, obj)) { return(obj.EmpNo + " - " + obj.EmpEngFullName); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmpPayrollID", StringComparison.CurrentCultureIgnoreCase)) { EEmpPayroll obj = new EEmpPayroll(); obj.EmpPayrollID = int.Parse(fieldValue); if (EEmpPayroll.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "EmpID", obj.EmpID.ToString()) + " : " + GetValueFromID(dbConn, "PayPeriodID", obj.PayPeriodID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmpPosID", StringComparison.CurrentCultureIgnoreCase)) { EEmpPositionInfo obj = new EEmpPositionInfo(); obj.EmpPosID = int.Parse(fieldValue); if (EEmpPositionInfo.db.select(dbConn, obj)) { return(obj.EmpPosEffFr.ToString("yyyy-MM-dd") + " - " + (obj.EmpPosEffTo.Ticks.Equals(0) ? "Present" : obj.EmpPosEffTo.ToString("yyyy-MM-dd"))); } else { return(string.Empty); } } if (tmpfieldName.Equals("EmploymentTypeID", StringComparison.CurrentCultureIgnoreCase)) { EEmploymentType obj = new EEmploymentType(); obj.EmploymentTypeID = int.Parse(fieldValue); if (EEmploymentType.db.select(dbConn, obj)) { return(obj.EmploymentTypeCode + " - " + obj.EmploymentTypeDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("F", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("FunctionID", StringComparison.CurrentCultureIgnoreCase)) { ESystemFunction obj = new ESystemFunction(); obj.FunctionID = int.Parse(fieldValue); if (ESystemFunction.db.select(dbConn, obj)) { return(obj.FunctionCode + " - " + obj.Description); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("H", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("HElementID", StringComparison.CurrentCultureIgnoreCase)) { EHierarchyElement obj = new EHierarchyElement(); obj.HElementID = int.Parse(fieldValue); if (EHierarchyElement.db.select(dbConn, obj)) { return(obj.HElementCode + " - " + obj.HElementDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("HLevelID", StringComparison.CurrentCultureIgnoreCase)) { EHierarchyLevel obj = new EHierarchyLevel(); obj.HLevelID = int.Parse(fieldValue); if (EHierarchyLevel.db.select(dbConn, obj)) { return(obj.HLevelCode + " - " + obj.HLevelDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("L", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("LeaveTypeID", StringComparison.CurrentCultureIgnoreCase)) { ELeaveType obj = new ELeaveType(); obj.LeaveTypeID = int.Parse(fieldValue); if (ELeaveType.db.select(dbConn, obj)) { return(obj.LeaveType + " - " + obj.LeaveTypeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("LeaveCodeID", StringComparison.CurrentCultureIgnoreCase)) { ELeaveCode obj = new ELeaveCode(); obj.LeaveCodeID = int.Parse(fieldValue); if (ELeaveCode.db.select(dbConn, obj)) { return(obj.LeaveCode + " - " + obj.LeaveCodeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("LeavePlanID", StringComparison.CurrentCultureIgnoreCase)) { ELeavePlan obj = new ELeavePlan(); obj.LeavePlanID = int.Parse(fieldValue); if (ELeavePlan.db.select(dbConn, obj)) { return(obj.LeavePlanCode + " - " + obj.LeavePlanDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("M", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("MPFPlanID", StringComparison.CurrentCultureIgnoreCase)) { EMPFPlan obj = new EMPFPlan(); obj.MPFPlanID = int.Parse(fieldValue); if (EMPFPlan.db.select(dbConn, obj)) { return(obj.MPFPlanCode + " - " + obj.MPFPlanDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("MPFSchemeID", StringComparison.CurrentCultureIgnoreCase)) { EMPFScheme obj = new EMPFScheme(); obj.MPFSchemeID = int.Parse(fieldValue); if (EMPFScheme.db.select(dbConn, obj)) { return(obj.MPFSchemeCode + " - " + obj.MPFSchemeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("MPFSchemeCessationReasonID", StringComparison.CurrentCultureIgnoreCase)) { EMPFSchemeCessationReason obj = new EMPFSchemeCessationReason(); obj.MPFSchemeCessationReasonID = int.Parse(fieldValue); if (EMPFSchemeCessationReason.db.select(dbConn, obj)) { return(obj.MPFSchemeCessationReasonCode + " - " + obj.MPFSchemeCessationReasonDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("O", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("ORSOPlanID", StringComparison.CurrentCultureIgnoreCase)) { EORSOPlan obj = new EORSOPlan(); obj.ORSOPlanID = int.Parse(fieldValue); if (EORSOPlan.db.select(dbConn, obj)) { return(obj.ORSOPlanCode + " - " + obj.ORSOPlanDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("P", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("PayGroupID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("PayrollGroupID", StringComparison.CurrentCultureIgnoreCase)) { EPayrollGroup obj = new EPayrollGroup(); obj.PayGroupID = int.Parse(fieldValue); if (EPayrollGroup.db.select(dbConn, obj)) { return(obj.PayGroupCode + " - " + obj.PayGroupDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PayFormID", StringComparison.CurrentCultureIgnoreCase)) { EPayrollProrataFormula obj = new EPayrollProrataFormula(); obj.PayFormID = int.Parse(fieldValue); if (EPayrollProrataFormula.db.select(dbConn, obj)) { return(obj.PayFormCode + " - " + obj.PayFormDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PaymentCodeID", StringComparison.CurrentCultureIgnoreCase) || tmpfieldName.Equals("PayCodeID", StringComparison.CurrentCultureIgnoreCase)) { EPaymentCode obj = new EPaymentCode(); obj.PaymentCodeID = int.Parse(fieldValue); if (EPaymentCode.db.select(dbConn, obj)) { return(obj.PaymentCode + " - " + obj.PaymentCodeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PaymentTypeID", StringComparison.CurrentCultureIgnoreCase)) { EPaymentType obj = new EPaymentType(); obj.PaymentTypeID = int.Parse(fieldValue); if (EPaymentType.db.select(dbConn, obj)) { return(obj.PaymentTypeCode + " - " + obj.PaymentTypeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PayPeriodID", StringComparison.CurrentCultureIgnoreCase)) { EPayrollPeriod obj = new EPayrollPeriod(); obj.PayPeriodID = int.Parse(fieldValue); if (EPayrollPeriod.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "PayrollGroupID", obj.PayGroupID.ToString()) + ": " + obj.PayPeriodFr.ToString("yyyy-MM-dd") + " to " + obj.PayPeriodTo.ToString("yyyy-MM-dd")); } else { return(string.Empty); } } if (tmpfieldName.Equals("PermitTypeID", StringComparison.CurrentCultureIgnoreCase)) { EPermitType obj = new EPermitType(); obj.PermitTypeID = int.Parse(fieldValue); if (EPermitType.db.select(dbConn, obj)) { return(obj.PermitTypeCode + " - " + obj.PermitTypeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("PositionID", StringComparison.CurrentCultureIgnoreCase)) { EPosition obj = new EPosition(); obj.PositionID = int.Parse(fieldValue); if (EPosition.db.select(dbConn, obj)) { return(obj.PositionCode + " - " + obj.PositionDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("Q", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("QualificationID", StringComparison.CurrentCultureIgnoreCase)) { EQualification obj = new EQualification(); obj.QualificationID = int.Parse(fieldValue); if (EQualification.db.select(dbConn, obj)) { return(obj.QualificationCode + " - " + obj.QualificationDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("R", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("RankID", StringComparison.CurrentCultureIgnoreCase)) { ERank obj = new ERank(); obj.RankID = int.Parse(fieldValue); if (ERank.db.select(dbConn, obj)) { return(obj.RankCode + " - " + obj.RankDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("ReminderTypeID", StringComparison.CurrentCultureIgnoreCase)) { EReminderType obj = new EReminderType(); obj.ReminderTypeID = int.Parse(fieldValue); if (EReminderType.db.select(dbConn, obj)) { return(obj.ReminderTypeCode + " - " + obj.ReminderTypeDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("RosterClientID", StringComparison.CurrentCultureIgnoreCase)) { ERosterClient obj = new ERosterClient(); obj.RosterClientID = int.Parse(fieldValue); if (ERosterClient.db.select(dbConn, obj)) { return(obj.RosterClientCode + " - " + obj.RosterClientName); } else { return(string.Empty); } } if (tmpfieldName.Equals("RosterClientSiteID", StringComparison.CurrentCultureIgnoreCase)) { ERosterClientSite obj = new ERosterClientSite(); obj.RosterClientSiteID = int.Parse(fieldValue); if (ERosterClientSite.db.select(dbConn, obj)) { return(obj.RosterClientSiteCode); } else { return(string.Empty); } } if (tmpfieldName.Equals("RosterCodeID", StringComparison.CurrentCultureIgnoreCase)) { ERosterCode obj = new ERosterCode(); obj.RosterCodeID = int.Parse(fieldValue); if (ERosterCode.db.select(dbConn, obj)) { return(obj.RosterCode + " - " + obj.RosterCodeDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("S", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("SkillID", StringComparison.CurrentCultureIgnoreCase)) { ESkill obj = new ESkill(); obj.SkillID = int.Parse(fieldValue); if (ESkill.db.select(dbConn, obj)) { return(obj.SkillCode + " - " + obj.SkillDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("SkillLevelID", StringComparison.CurrentCultureIgnoreCase)) { ESkillLevel obj = new ESkillLevel(); obj.SkillLevelID = int.Parse(fieldValue); if (ESkillLevel.db.select(dbConn, obj)) { return(obj.SkillLevelCode + " - " + obj.SkillLevelDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("StaffTypeID", StringComparison.CurrentCultureIgnoreCase)) { EStaffType obj = new EStaffType(); obj.StaffTypeID = int.Parse(fieldValue); if (EStaffType.db.select(dbConn, obj)) { return(obj.StaffTypeCode + " - " + obj.StaffTypeDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("T", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("TaxCompID", StringComparison.CurrentCultureIgnoreCase)) { ETaxCompany obj = new ETaxCompany(); obj.TaxCompID = int.Parse(fieldValue); if (ETaxCompany.db.select(dbConn, obj)) { return(obj.TaxCompEmployerName); } else { return(string.Empty); } } if (tmpfieldName.Equals("TaxEmpID", StringComparison.CurrentCultureIgnoreCase)) { ETaxEmp obj = new ETaxEmp(); obj.TaxEmpID = int.Parse(fieldValue); if (ETaxEmp.db.select(dbConn, obj)) { return(obj.TaxEmpSurname + ", " + obj.TaxEmpOtherName + ", " + GetValueFromID(dbConn, "TaxFormID", obj.TaxFormID.ToString())); } else { return(string.Empty); } } if (tmpfieldName.Equals("TaxFormID", StringComparison.CurrentCultureIgnoreCase)) { ETaxForm obj = new ETaxForm(); obj.TaxFormID = int.Parse(fieldValue); if (ETaxForm.db.select(dbConn, obj)) { return("Tax Year :" + obj.TaxFormYear + ", Form: IR56" + obj.TaxFormType); } else { return(string.Empty); } } if (tmpfieldName.Equals("TaxPayID", StringComparison.CurrentCultureIgnoreCase)) { ETaxPayment obj = new ETaxPayment(); obj.TaxPayID = int.Parse(fieldValue); if (ETaxPayment.db.select(dbConn, obj)) { return(obj.TaxPayCode + " - " + obj.TaxPayDesc); } else { return(string.Empty); } } if (tmpfieldName.Equals("TrainingCourseID", StringComparison.CurrentCultureIgnoreCase)) { ETrainingCourse obj = new ETrainingCourse(); obj.TrainingCourseID = int.Parse(fieldValue); if (ETrainingCourse.db.select(dbConn, obj)) { return(obj.TrainingCourseCode + " - " + obj.TrainingCourseName); } else { return(string.Empty); } } if (tmpfieldName.Equals("TrainingSeminarID", StringComparison.CurrentCultureIgnoreCase)) { ETrainingSeminar obj = new ETrainingSeminar(); obj.TrainingSeminarID = int.Parse(fieldValue); if (ETrainingSeminar.db.select(dbConn, obj)) { return(GetValueFromID(dbConn, "TrainingCourseID", obj.TrainingCourseID.ToString()) + ": " + obj.TrainingSeminarDateFrom.ToString("yyyy-MM-dd") + " to " + obj.TrainingSeminarDateTo.ToString("yyyy-MM-dd")); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("U", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("UserID", StringComparison.CurrentCultureIgnoreCase)) { EUser obj = new EUser(); obj.UserID = int.Parse(fieldValue); if (EUser.db.select(dbConn, obj)) { return(obj.LoginID + " - " + obj.UserName); } else { return(string.Empty); } } if (tmpfieldName.Equals("UserGroupID", StringComparison.CurrentCultureIgnoreCase)) { EUserGroup obj = new EUserGroup(); obj.UserGroupID = int.Parse(fieldValue); if (EUserGroup.db.select(dbConn, obj)) { return(obj.UserGroupName + " - " + obj.UserGroupDesc); } else { return(string.Empty); } } } else if (tmpfieldName.StartsWith("Y", StringComparison.CurrentCultureIgnoreCase)) { if (tmpfieldName.Equals("YebPlanID", StringComparison.CurrentCultureIgnoreCase)) { EYEBPlan obj = new EYEBPlan(); obj.YEBPlanID = int.Parse(fieldValue); if (EYEBPlan.db.select(dbConn, obj)) { return(obj.YEBPlanCode + " - " + obj.YEBPlanDesc); } else { return(string.Empty); } } } if (tmpfieldName.EndsWith("ID") && !tmpfieldName.EndsWith("HKID") && !tmpfieldName.EndsWith("LoginID") && !tmpfieldName.EndsWith("CurrencyID") && !tmpfieldName.EndsWith("LeaveAppID") && !tmpfieldName.EndsWith("EmpPaymentID") && !tmpfieldName.EndsWith("PayBatchID") && !tmpfieldName.EndsWith("PayRecID") && !tmpfieldName.EndsWith("RosterTableID") && !tmpfieldName.EndsWith("SynID") && !tmpfieldName.EndsWith("CNDImportBatchID")) { if (ESystemParameter.getParameter(dbConn, "DebugMode").Equals("Y")) { throw new Exception("ID field not define:" + fieldName); } } return(string.Empty); } catch (Exception ex) { if (ESystemParameter.getParameter(dbConn, "DebugMode").Equals("Y")) { throw ex; } else { return(string.Empty); } } }
protected void Save_Click(object sender, EventArgs e) { ETaxEmp c = new ETaxEmp(); Hashtable values = new Hashtable(); binding.toValues(values); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, c); if (string.IsNullOrEmpty(c.TaxEmpHKID.Replace("()", "").Trim()) && (string.IsNullOrEmpty(c.TaxEmpPassportNo.Trim()) || string.IsNullOrEmpty(c.TaxEmpIssuedCountry.Trim()))) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_HKID_PASSPORT_REQUIRED); } if (!errors.isEmpty()) { return; } int taxFormYear = 0; ETaxForm taxForm = new ETaxForm(); taxForm.TaxFormID = c.TaxFormID; if (ETaxForm.db.select(dbConn, taxForm)) { taxFormYear = taxForm.TaxFormYear; } DateTime dtStartDate = new DateTime(taxFormYear - 1, 4, 1); DateTime dtEndDate = new DateTime(taxFormYear, 3, 31); if (dtStartDate > c.TaxEmpStartDate || dtEndDate < c.TaxEmpStartDate) { errors.addError("TaxEmpStartDate", HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE); } if (dtStartDate > c.TaxEmpEndDate || dtEndDate < c.TaxEmpEndDate) { errors.addError("TaxEmpEndDate", HROne.Translation.PageErrorMessage.ERROR_INCORRECT_DATE_RANGE); } if (c.TaxEmpStartDate > c.TaxEmpEndDate) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_DATE_END_TOO_EARLY); } if (!errors.isEmpty()) { if (CurID > 0) { // loadObject(); } return; } WebUtils.StartFunction(Session, FUNCTION_CODE, c.EmpID); if (CurID < 0) { // Utils.MarkCreate(Session, c); db.insert(dbConn, c); CurID = c.TaxEmpID; // url = Utils.BuildURL(-1, CurID); } else { // Utils.Mark(Session, c); db.update(dbConn, c); } WebUtils.EndFunction(dbConn); HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Taxation_Adjustment_View.aspx?TaxEmpID=" + c.TaxEmpID); }
protected bool loadObject() { ETaxEmp obj = new ETaxEmp(); bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest); if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); ucTaxation_Form_Header.CurrentTaxFormID = obj.TaxFormID; SpousePanel.Visible = (obj.TaxEmpMartialStatus.Equals("2")); ETaxForm taxForm = new ETaxForm(); taxForm.TaxFormID = obj.TaxFormID; if (ETaxForm.db.select(dbConn, taxForm)) { TaxFormType.Value = taxForm.TaxFormType; if (taxForm.TaxFormType.Equals("B")) { TaxFormBFGPanel1.Visible = true; TaxFormBFGPanel2.Visible = true; TaxFormBFGPanel3.Visible = true; TaxFormBPanel.Visible = true; TaxFormEPanel1.Visible = false; TaxFormEPanel2.Visible = false; TaxFormFPanel1.Visible = false; TaxFormFPanel2.Visible = false; TaxFormFPanel2.Visible = false; TaxFormGPanel1.Visible = false; TaxFormGPanel2.Visible = false; TaxFormGPanel3.Visible = false; TaxFormGPanel4.Visible = false; TaxFormFGPanel.Visible = false; TaxFormEGPanel1.Visible = false; // Start 0000020, KuangWei, 2014-08-22 TaxFormMPanel1.Visible = false; lblBCapacity.Visible = true; lblMCapacity.Visible = false; TaxFormBPanel1.Visible = true; // End 0000020, KuangWei, 2014-08-22 } if (taxForm.TaxFormType.Equals("F")) { TaxFormBFGPanel1.Visible = true; TaxFormBFGPanel2.Visible = true; TaxFormBFGPanel3.Visible = true; TaxFormBPanel.Visible = false; TaxFormEPanel1.Visible = false; TaxFormEPanel2.Visible = false; TaxFormFPanel1.Visible = true; TaxFormFPanel2.Visible = true; TaxFormFPanel3.Visible = true; TaxFormGPanel1.Visible = false; TaxFormGPanel2.Visible = false; TaxFormGPanel3.Visible = false; TaxFormGPanel4.Visible = false; TaxFormFGPanel.Visible = true; TaxFormEGPanel1.Visible = false; // Start 0000020, KuangWei, 2014-08-22 TaxFormMPanel1.Visible = false; lblBCapacity.Visible = true; lblMCapacity.Visible = false; TaxFormBPanel1.Visible = true; // End 0000020, KuangWei, 2014-08-22 } if (taxForm.TaxFormType.Equals("G")) { TaxFormBFGPanel1.Visible = true; TaxFormBFGPanel2.Visible = true; TaxFormBFGPanel3.Visible = true; TaxFormBPanel.Visible = false; TaxFormEPanel1.Visible = false; TaxFormEPanel2.Visible = false; TaxFormFPanel1.Visible = false; TaxFormFPanel2.Visible = false; TaxFormFPanel3.Visible = false; TaxFormGPanel1.Visible = true; TaxFormGPanel2.Visible = true; TaxFormGPanel3.Visible = true; TaxFormGPanel4.Visible = true; TaxFormFGPanel.Visible = true; TaxFormEGPanel1.Visible = true; // Start 0000020, KuangWei, 2014-08-22 TaxFormMPanel1.Visible = false; lblBCapacity.Visible = true; lblMCapacity.Visible = false; TaxFormBPanel1.Visible = true; // End 0000020, KuangWei, 2014-08-22 } if (taxForm.TaxFormType.Equals("E")) { TaxFormBFGPanel1.Visible = false; TaxFormBFGPanel2.Visible = false; TaxFormBFGPanel3.Visible = false; TaxFormBPanel.Visible = false; TaxFormEPanel1.Visible = true; TaxFormEPanel2.Visible = true; TaxFormFPanel1.Visible = false; TaxFormFPanel2.Visible = false; TaxFormFPanel3.Visible = false; TaxFormGPanel1.Visible = false; TaxFormGPanel2.Visible = false; TaxFormGPanel3.Visible = false; TaxFormGPanel4.Visible = false; TaxFormFGPanel.Visible = false; TaxFormEGPanel1.Visible = true; // Start 0000020, KuangWei, 2014-08-22 TaxFormMPanel1.Visible = false; lblBCapacity.Visible = true; lblMCapacity.Visible = false; TaxFormBPanel1.Visible = true; // End 0000020, KuangWei, 2014-08-22 } // Start 0000020, KuangWei, 2014-08-22 if (taxForm.TaxFormType.Equals("M")) { TaxFormBFGPanel1.Visible = false; lblBCapacity.Visible = false; lblMCapacity.Visible = true; lblPartTime.Visible = false; TaxEmpPartTimeEmployer.Visible = false; TaxFormFPanel1.Visible = false; TaxFormBPanel1.Visible = false; TaxFormBFGPanel3.Visible = false; TaxFormEPanel1.Visible = false; TaxFormFPanel2.Visible = false; TaxFormGPanel1.Visible = false; TaxFormFGPanel.Visible = false; TaxFormEGPanel1.Visible = false; TaxFormGPanel2.Visible = false; } // End 0000020, KuangWei, 2014-08-22 } binding.toControl(values); //TaxEmpHoldAmountPanel.Visible = false; //TaxEmpReasonForNotHoldPanel.Visible = false; //if (obj.TaxEmpIsMoneyHoldByOrdinance != null) //{ // if (obj.TaxEmpIsMoneyHoldByOrdinance.Equals("Y")) // TaxEmpHoldAmountPanel.Visible = true; // if (obj.TaxEmpIsMoneyHoldByOrdinance.Equals("N")) // TaxEmpReasonForNotHoldPanel.Visible = true; //} TaxEmpIsMoneyHoldByOrdinance_SelectedIndexChanged(TaxEmpIsMoneyHoldByOrdinance, null); TaxEmpReasonForDepartureReason_SelectedIndexChanged(TaxEmpReasonForDepartureReason, null); TaxEmpIsEEReturnHK_SelectedIndexChanged(TaxEmpIsEEReturnHK, null); TaxEmpIsShareOptionsGrant_SelectedIndexChanged(TaxEmpIsShareOptionsGrant, null); return(true); }
protected bool loadObject() { ETaxEmp obj = new ETaxEmp(); bool isNew = WebFormWorkers.loadKeys(db, obj, DecryptedRequest); if (!db.select(dbConn, obj)) { return(false); } Hashtable values = new Hashtable(); db.populate(obj, values); binding.toControl(values); ucTaxation_Form_Header.CurrentTaxFormID = obj.TaxFormID; ETaxForm taxForm = new ETaxForm(); taxForm.TaxFormID = obj.TaxFormID; if (ETaxForm.db.select(dbConn, taxForm)) { if (taxForm.TaxFormType.Equals("B")) { TaxFormBFGPanel1.Visible = true; TaxFormBFGPanel2.Visible = true; TaxFormBFGPanel3.Visible = true; TaxFormBPanel.Visible = true; TaxFormEPanel1.Visible = false; TaxFormEPanel2.Visible = false; TaxFormFPanel1.Visible = false; TaxFormFPanel2.Visible = false; TaxFormGPanel1.Visible = false; TaxFormGPanel2.Visible = false; TaxFormGPanel3.Visible = false; TaxFormGPanel4.Visible = false; TaxFormFGPanel.Visible = false; TaxFormEGPanel1.Visible = false; } if (taxForm.TaxFormType.Equals("F")) { TaxFormBFGPanel1.Visible = true; TaxFormBFGPanel2.Visible = true; TaxFormBFGPanel3.Visible = true; TaxFormBPanel.Visible = false; TaxFormEPanel1.Visible = false; TaxFormEPanel2.Visible = false; TaxFormFPanel1.Visible = true; TaxFormFPanel2.Visible = true; TaxFormFPanel3.Visible = true; TaxFormGPanel1.Visible = false; TaxFormGPanel2.Visible = false; TaxFormGPanel3.Visible = false; TaxFormGPanel4.Visible = false; TaxFormFGPanel.Visible = true; TaxFormEGPanel1.Visible = false; } if (taxForm.TaxFormType.Equals("G")) { TaxFormBFGPanel1.Visible = true; TaxFormBFGPanel2.Visible = true; TaxFormBFGPanel3.Visible = true; TaxFormBPanel.Visible = false; TaxFormEPanel1.Visible = false; TaxFormEPanel2.Visible = false; TaxFormFPanel1.Visible = false; TaxFormFPanel2.Visible = false; TaxFormFPanel3.Visible = false; TaxFormGPanel1.Visible = true; TaxFormGPanel2.Visible = true; TaxFormGPanel3.Visible = true; TaxFormGPanel4.Visible = true; TaxFormFGPanel.Visible = true; TaxFormEGPanel1.Visible = true; } if (taxForm.TaxFormType.Equals("E")) { TaxFormBFGPanel1.Visible = false; TaxFormBFGPanel2.Visible = false; TaxFormBFGPanel3.Visible = false; TaxFormBPanel.Visible = false; TaxFormEPanel1.Visible = true; TaxFormEPanel2.Visible = true; TaxFormFPanel1.Visible = false; TaxFormFPanel2.Visible = false; TaxFormGPanel1.Visible = false; TaxFormGPanel2.Visible = false; TaxFormGPanel3.Visible = false; TaxFormGPanel4.Visible = false; TaxFormFGPanel.Visible = false; TaxFormEGPanel1.Visible = true; } } TaxEmpHoldAmountPanel.Visible = false; TaxEmpReasonForNotHoldPanel.Visible = false; if (!string.IsNullOrEmpty(obj.TaxEmpIsMoneyHoldByOrdinance)) { if (obj.TaxEmpIsMoneyHoldByOrdinance.Equals("Y")) { TaxEmpHoldAmountPanel.Visible = true; } else if (obj.TaxEmpIsMoneyHoldByOrdinance.Equals("N")) { TaxEmpReasonForNotHoldPanel.Visible = true; } } if (!string.IsNullOrEmpty(obj.TaxEmpReasonForDepartureReason)) { if (obj.TaxEmpReasonForDepartureReason.Equals("Other")) { TaxEmpReasonForDepartureOtherReasonPanel.Visible = true; } else { TaxEmpReasonForDepartureOtherReasonPanel.Visible = false; } } if (!string.IsNullOrEmpty(obj.TaxEmpIsEEReturnHK)) { if (obj.TaxEmpIsEEReturnHK.Equals("Y")) { TaxEmpEEReturnHKDatePanel.Visible = true; } else { TaxEmpEEReturnHKDatePanel.Visible = false; } } if (!string.IsNullOrEmpty(obj.TaxEmpIsShareOptionsGrant)) { if (obj.TaxEmpIsShareOptionsGrant.Equals("Y")) { TaxEmpIsShareOptionsGrantPanel.Visible = true; } else { TaxEmpIsShareOptionsGrantPanel.Visible = false; } } return(true); }
protected void Repeater_ItemCommand(object source, DataListCommandEventArgs e) { Button b = (Button)e.CommandSource; if (b.ID.Equals("Edit")) { Repeater.EditItemIndex = e.Item.ItemIndex; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(TaxEmpPaymentAddPanel, false); } else if (b.ID.Equals("Cancel")) { Repeater.EditItemIndex = -1; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(TaxEmpPaymentAddPanel, true); } else if (b.ID.Equals("Save")) { ETaxEmpPayment obj = new ETaxEmpPayment(); //db.toObject(((DataRowView)e.Item.DataItem).Row, obj); OR orTerms = new OR(); orTerms.add(inPaymentFilter); orTerms.add(new Match("TaxPayID", ((DropDownList)e.Item.FindControl("TaxPayID")).SelectedValue)); DBFilter taxPaymentSelectedFilter = new DBFilter(); taxPaymentSelectedFilter.add(orTerms); taxPaymentSelectedFilter.add(new Match("TaxFormType", TaxFormType.Value)); ebinding = new Binding(dbConn, db); ebinding.add(TaxEmpID); ebinding.add((HtmlInputHidden)e.Item.FindControl("TaxEmpPayID")); ebinding.add(new DropDownVLBinder(db, (DropDownList)e.Item.FindControl("TaxPayID"), ETaxPayment.VLTaxPayment, taxPaymentSelectedFilter)); ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("TaxEmpPayPeriodFr")).TextBox, "TaxEmpPayPeriodFr")); ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("TaxEmpPayPeriodTo")).TextBox, "TaxEmpPayPeriodTo")); ebinding.add((TextBox)e.Item.FindControl("TaxEmpPayAmount")); ebinding.add((TextBox)e.Item.FindControl("TaxEmpPayNature")); ebinding.init(Request, Session); // ETaxEmpPayment obj = new ETaxEmpPayment(); Hashtable values = new Hashtable(); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ebinding.toValues(values); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, obj); ValidateData(obj, errors); if (!errors.isEmpty()) { return; } ETaxPayment taxPay = new ETaxPayment(); taxPay.TaxPayID = obj.TaxPayID; ETaxPayment.db.select(dbConn, taxPay); if (!taxPay.TaxPayIsShowNature.Equals("Y")) { obj.TaxEmpPayNature = string.Empty; } else if (obj.TaxEmpPayNature.Equals(string.Empty)) { obj.TaxEmpPayNature = taxPay.TaxPayNature; } ETaxEmp taxEmp = new ETaxEmp(); taxEmp.TaxEmpID = obj.TaxEmpID; if (ETaxEmp.db.select(dbConn, taxEmp)) { WebUtils.StartFunction(Session, FUNCTION_CODE, taxEmp.EmpID); db.update(dbConn, obj); WebUtils.EndFunction(dbConn); Repeater.EditItemIndex = -1; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(TaxEmpPaymentAddPanel, true); } } }
protected void Repeater_ItemCommand(object source, DataListCommandEventArgs e) { Button b = (Button)e.CommandSource; if (b.ID.Equals("Edit")) { Repeater.EditItemIndex = e.Item.ItemIndex; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(TaxEmpPoRAddPanel, false); } else if (b.ID.Equals("Cancel")) { Repeater.EditItemIndex = -1; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(TaxEmpPoRAddPanel, true); } else if (b.ID.Equals("Save")) { ebinding = new Binding(dbConn, db); ebinding.add(TaxEmpID); ebinding.add((HtmlInputHidden)e.Item.FindControl("TaxEmpPlaceID")); ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceAddress")); ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceNature")); ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("TaxEmpPlacePeriodFr")).TextBox, "TaxEmpPlacePeriodFr")); ebinding.add(new TextBoxBinder(db, ((WebDatePicker)e.Item.FindControl("TaxEmpPlacePeriodTo")).TextBox, "TaxEmpPlacePeriodTo")); ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceERRent")); ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceEERent")); ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceEERentRefunded")); ebinding.add((TextBox)e.Item.FindControl("TaxEmpPlaceERRentByEE")); ebinding.init(Request, Session); ETaxEmpPlaceOfResidence obj = new ETaxEmpPlaceOfResidence(); Hashtable values = new Hashtable(); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); ebinding.toValues(values); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, obj); ValidateData(obj, errors); if (!errors.isEmpty()) { return; } ETaxEmp taxEmp = new ETaxEmp(); taxEmp.TaxEmpID = obj.TaxEmpID; if (ETaxEmp.db.select(dbConn, taxEmp)) { WebUtils.StartFunction(Session, FUNCTION_CODE, taxEmp.EmpID); db.update(dbConn, obj); WebUtils.EndFunction(dbConn); } Repeater.EditItemIndex = -1; view = loadData(info, db, Repeater); WebUtils.SetEnabledControlSection(TaxEmpPoRAddPanel, true); } }
protected void Delete_Click(object sender, EventArgs e) { ArrayList list = new ArrayList(); foreach (RepeaterItem item in Repeater.Items) { CheckBox c = (CheckBox)item.FindControl("ItemSelect"); HtmlInputHidden h = (HtmlInputHidden)item.FindControl("TaxEmpID"); if (c.Checked) { ETaxEmp obj = new ETaxEmp(); obj.TaxEmpID = Int32.Parse(h.Value); list.Add(obj); } } foreach (ETaxEmp obj in list) { if (ETaxEmp.db.select(dbConn, obj)) { WebUtils.StartFunction(Session, FUNCTION_CODE, obj.EmpID); db.delete(dbConn, obj); { DBFilter taxEmpPaymentFilter = new DBFilter(); taxEmpPaymentFilter.add(new Match("TaxEmpID", obj.TaxEmpID)); ArrayList taxEmpPaymentList = ETaxEmpPayment.db.select(dbConn, taxEmpPaymentFilter); foreach (ETaxEmpPayment taxEmpPayment in taxEmpPaymentList) { ETaxEmpPayment.db.delete(dbConn, taxEmpPayment); } } { DBFilter taxEmpPoRFilter = new DBFilter(); taxEmpPoRFilter.add(new Match("TaxEmpID", obj.TaxEmpID)); ArrayList taxEmpPoRList = ETaxEmpPlaceOfResidence.db.select(dbConn, taxEmpPoRFilter); foreach (ETaxEmpPlaceOfResidence taxEmpPoR in taxEmpPoRList) { ETaxEmpPlaceOfResidence.db.delete(dbConn, taxEmpPoR); } } WebUtils.EndFunction(dbConn); } } //if (DecryptedRequest["TaxFormID"] != null) //{ // try // { // CurrentTaxFormID = Int32.Parse(DecryptedRequest["TaxFormID"]); // } // catch // { // } //} //else if (!Int32.TryParse(TaxFormID.SelectedValue, out CurrentTaxFormID)) //{ // CurrentTaxFormID = 0; // //EPayrollGroup obj = new EPayrollGroup(); // //obj.PayGroupID = CurID; // //if (!db.select(dbConn, obj)) // // CurPayPeriodID = obj.CurrentPayPeriodID; //} if (CurrentTaxFormID > 0) { ETaxForm taxForm = new ETaxForm(); taxForm.TaxFormID = CurrentTaxFormID; ETaxForm.db.select(dbConn, taxForm); if (taxForm.TaxFormType.Equals("B", StringComparison.CurrentCultureIgnoreCase)) { TaxationGeneration.RearrangeSheetNo(dbConn, CurrentTaxFormID); } } view = loadData(info, db, Repeater); //Response.Redirect(Request.Url.LocalPath + "?" + Request.QueryString); }