private void LoadData(int projectId, int refId)
        {
            string category = hdfCategory.Value;

            // Load Data
            if (category == "Subcontractors")
            {
                ActualCostsInformationSubcontractorBasicInformationGateway actualCostsInformationSubcontractorBasicInformationGateway = new ActualCostsInformationSubcontractorBasicInformationGateway(actualCostsInformationTDS);
                if (actualCostsInformationSubcontractorBasicInformationGateway.Table.Rows.Count > 0)
                {
                    // Load subcontractor basic data
                    tbxCategory.Text = actualCostsInformationSubcontractorBasicInformationGateway.GetSubcontractor(projectId, refId);

                    if (tbxState.Visible)
                    {
                        if (actualCostsInformationSubcontractorBasicInformationGateway.GetActive(projectId, refId))
                        {
                            tbxState.Text = "Active";
                        }
                        else
                        {
                            tbxState.Text = "Inactive";
                        }
                    }

                    tbxClient.Text = actualCostsInformationSubcontractorBasicInformationGateway.GetClient(projectId, refId);
                    tbxProject.Text = actualCostsInformationSubcontractorBasicInformationGateway.GetProject(projectId, refId);
                    hdfClientId.Value = actualCostsInformationSubcontractorBasicInformationGateway.GetClientID(projectId, refId).ToString();

                    tkrdpDate_.SelectedDate = (DateTime)(actualCostsInformationSubcontractorBasicInformationGateway.GetDate(projectId, refId));

                    if (tbxQuantity.Visible)
                    {
                        decimal quantity = decimal.Parse(actualCostsInformationSubcontractorBasicInformationGateway.GetQuantity(projectId, refId).ToString());
                        tbxQuantity.Text = decimal.Round(quantity, 1).ToString();
                    }

                    if (actualCostsInformationSubcontractorBasicInformationGateway.GetCountryId(projectId, refId) == 1) // Canada
                    {
                        decimal rate = decimal.Parse(actualCostsInformationSubcontractorBasicInformationGateway.GetRateCad(projectId, refId).ToString());
                        tbxRate.Text = decimal.Round(rate, 2).ToString();

                        if (tbxTotal.Visible)
                        {
                            decimal total = decimal.Parse(actualCostsInformationSubcontractorBasicInformationGateway.GetTotalCad(projectId, refId).ToString());
                            tbxTotal.Text = decimal.Round(total, 2).ToString();
                        }
                    }
                    else // Usa
                    {
                        decimal rate = decimal.Parse(actualCostsInformationSubcontractorBasicInformationGateway.GetRateUsd(projectId, refId).ToString());
                        tbxRate.Text = decimal.Round(rate, 2).ToString();

                        if (tbxTotal.Visible)
                        {
                            decimal total = decimal.Parse(actualCostsInformationSubcontractorBasicInformationGateway.GetTotalUsd(projectId, refId).ToString());
                            tbxTotal.Text = decimal.Round(total, 2).ToString();
                        }
                    }

                    hdfCountryId.Value = actualCostsInformationSubcontractorBasicInformationGateway.GetCountryId(projectId, refId).ToString();
                    tbxComments.Text = actualCostsInformationSubcontractorBasicInformationGateway.GetComment(projectId, refId);
                }
            }
            else
            {
                if (category == "Hotels")
                {
                    ActualCostsInformationHotelCostsBasicInformationGateway actualCostsInformationHotelCostsBasicInformationGateway = new ActualCostsInformationHotelCostsBasicInformationGateway(actualCostsInformationTDS);
                    if (actualCostsInformationHotelCostsBasicInformationGateway.Table.Rows.Count > 0)
                    {
                        // Load subcontractor basic data
                        tbxCategory.Text = actualCostsInformationHotelCostsBasicInformationGateway.GetHotel(projectId, refId);
                        tbxClient.Text = actualCostsInformationHotelCostsBasicInformationGateway.GetClient(projectId, refId);
                        tbxProject.Text = actualCostsInformationHotelCostsBasicInformationGateway.GetProject(projectId, refId);
                        hdfClientId.Value = actualCostsInformationHotelCostsBasicInformationGateway.GetClientID(projectId, refId).ToString();

                        tkrdpDate_.SelectedDate = (DateTime)(actualCostsInformationHotelCostsBasicInformationGateway.GetDate(projectId, refId));

                        if (actualCostsInformationHotelCostsBasicInformationGateway.GetCountryId(projectId, refId) == 1) // Canada
                        {
                            decimal rate = decimal.Parse(actualCostsInformationHotelCostsBasicInformationGateway.GetRateCad(projectId, refId).ToString());
                            tbxRate.Text = decimal.Round(rate, 2).ToString();
                        }
                        else // Usa
                        {
                            decimal rate = decimal.Parse(actualCostsInformationHotelCostsBasicInformationGateway.GetRateUsd(projectId, refId).ToString());
                            tbxRate.Text = decimal.Round(rate, 2).ToString();
                        }

                        hdfCountryId.Value = actualCostsInformationHotelCostsBasicInformationGateway.GetCountryId(projectId, refId).ToString();
                        tbxComments.Text = actualCostsInformationHotelCostsBasicInformationGateway.GetComment(projectId, refId);
                    }
                }
                else
                {
                    if (category == "Insurance")
                    {
                        ActualCostsInformationInsuranceCostsBasicInformationGateway actualCostsInformationInsuranceCostsBasicInformationGateway = new ActualCostsInformationInsuranceCostsBasicInformationGateway(actualCostsInformationTDS);
                        if (actualCostsInformationInsuranceCostsBasicInformationGateway.Table.Rows.Count > 0)
                        {
                            // Load subcontractor basic data
                            tbxCategory.Text = actualCostsInformationInsuranceCostsBasicInformationGateway.GetInsurance(projectId, refId);
                            tbxClient.Text = actualCostsInformationInsuranceCostsBasicInformationGateway.GetClient(projectId, refId);
                            tbxProject.Text = actualCostsInformationInsuranceCostsBasicInformationGateway.GetProject(projectId, refId);
                            hdfClientId.Value = actualCostsInformationInsuranceCostsBasicInformationGateway.GetClientID(projectId, refId).ToString();

                            tkrdpDate_.SelectedDate = (DateTime)(actualCostsInformationInsuranceCostsBasicInformationGateway.GetDate(projectId, refId));

                            if (actualCostsInformationInsuranceCostsBasicInformationGateway.GetCountryId(projectId, refId) == 1) // Canada
                            {
                                decimal rate = decimal.Parse(actualCostsInformationInsuranceCostsBasicInformationGateway.GetRateCad(projectId, refId).ToString());
                                tbxRate.Text = decimal.Round(rate, 2).ToString();
                            }
                            else // Usa
                            {
                                decimal rate = decimal.Parse(actualCostsInformationInsuranceCostsBasicInformationGateway.GetRateUsd(projectId, refId).ToString());
                                tbxRate.Text = decimal.Round(rate, 2).ToString();
                            }

                            hdfCountryId.Value = actualCostsInformationInsuranceCostsBasicInformationGateway.GetCountryId(projectId, refId).ToString();
                            tbxComments.Text = actualCostsInformationInsuranceCostsBasicInformationGateway.GetComment(projectId, refId);
                        }
                    }
                    else
                    {
                        if (category == "Bonding")
                        {
                            ActualCostsInformationBondingCostsBasicInformationGateway actualCostsInformationBondingCostsBasicInformationGateway = new ActualCostsInformationBondingCostsBasicInformationGateway(actualCostsInformationTDS);
                            if (actualCostsInformationBondingCostsBasicInformationGateway.Table.Rows.Count > 0)
                            {
                                // Load subcontractor basic data
                                tbxCategory.Text = actualCostsInformationBondingCostsBasicInformationGateway.GetBonding(projectId, refId);
                                tbxClient.Text = actualCostsInformationBondingCostsBasicInformationGateway.GetClient(projectId, refId);
                                tbxProject.Text = actualCostsInformationBondingCostsBasicInformationGateway.GetProject(projectId, refId);
                                hdfClientId.Value = actualCostsInformationBondingCostsBasicInformationGateway.GetClientID(projectId, refId).ToString();

                                tkrdpDate_.SelectedDate = (DateTime)(actualCostsInformationBondingCostsBasicInformationGateway.GetDate(projectId, refId));

                                if (actualCostsInformationBondingCostsBasicInformationGateway.GetCountryId(projectId, refId) == 1) // Canada
                                {
                                    decimal rate = decimal.Parse(actualCostsInformationBondingCostsBasicInformationGateway.GetRateCad(projectId, refId).ToString());
                                    tbxRate.Text = decimal.Round(rate, 2).ToString();
                                }
                                else // Usa
                                {
                                    decimal rate = decimal.Parse(actualCostsInformationBondingCostsBasicInformationGateway.GetRateUsd(projectId, refId).ToString());
                                    tbxRate.Text = decimal.Round(rate, 2).ToString();
                                }

                                hdfCountryId.Value = actualCostsInformationBondingCostsBasicInformationGateway.GetCountryId(projectId, refId).ToString();
                                tbxComments.Text = actualCostsInformationBondingCostsBasicInformationGateway.GetComment(projectId, refId);
                            }
                        }
                        else
                        {
                            // for other categories
                            ActualCostsInformationOtherCostsBasicInformationGateway actualCostsInformationOtherCostsBasicInformationGateway = new ActualCostsInformationOtherCostsBasicInformationGateway(actualCostsInformationTDS);
                            if (actualCostsInformationOtherCostsBasicInformationGateway.Table.Rows.Count > 0)
                            {
                                // Load subcontractor basic data
                                tbxCategory.Text = actualCostsInformationOtherCostsBasicInformationGateway.GetCategory(projectId, refId);
                                tbxClient.Text = actualCostsInformationOtherCostsBasicInformationGateway.GetClient(projectId, refId);
                                tbxProject.Text = actualCostsInformationOtherCostsBasicInformationGateway.GetProject(projectId, refId);
                                hdfClientId.Value = actualCostsInformationOtherCostsBasicInformationGateway.GetClientID(projectId, refId).ToString();

                                tkrdpDate_.SelectedDate = (DateTime)(actualCostsInformationOtherCostsBasicInformationGateway.GetDate(projectId, refId));

                                if (actualCostsInformationOtherCostsBasicInformationGateway.GetCountryId(projectId, refId) == 1) // Canada
                                {
                                    decimal rate = decimal.Parse(actualCostsInformationOtherCostsBasicInformationGateway.GetRateCad(projectId, refId).ToString());
                                    tbxRate.Text = decimal.Round(rate, 2).ToString();
                                }
                                else // Usa
                                {
                                    decimal rate = decimal.Parse(actualCostsInformationOtherCostsBasicInformationGateway.GetRateUsd(projectId, refId).ToString());
                                    tbxRate.Text = decimal.Round(rate, 2).ToString();
                                }

                                hdfCountryId.Value = actualCostsInformationOtherCostsBasicInformationGateway.GetCountryId(projectId, refId).ToString();
                                tbxComments.Text = actualCostsInformationOtherCostsBasicInformationGateway.GetComment(projectId, refId);
                            }
                        }
                    }
                }
            }
        }