protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList();

            if (ddlType.SelectedItem.Text.Contains("Canada"))
            {
                projectTimeJobClassTypeList.LoadAndAddItem(1, 3, "");
                ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                ddlJobClassType.DataValueField = "JobClassType";
                ddlJobClassType.DataTextField = "JobClassType";
                ddlJobClassType.DataBind();
            }
            else
            {
                projectTimeJobClassTypeList.LoadAndAddItem(2, 3, "");
                ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                ddlJobClassType.DataValueField = "JobClassType";
                ddlJobClassType.DataTextField = "JobClassType";
                ddlJobClassType.DataBind();
            }

            upnlJobClassType.Update();
        }
        private void LoadBasicData(int employeeId)
        {
            // Load Data
            EmployeeInformationBasicInformationGateway employeeInformationBasicInformationGateway = new EmployeeInformationBasicInformationGateway(employeeInformationTDS);
            if (employeeInformationBasicInformationGateway.Table.Rows.Count > 0)
            {
                // Load employee basic data
                tbxFisrtName.Text = employeeInformationBasicInformationGateway.GetFirstName(employeeId);
                tbxLastName.Text = employeeInformationBasicInformationGateway.GetLastName(employeeId);
                tbxeMail.Text = employeeInformationBasicInformationGateway.GeteMail(employeeId);
                ckbxIsSalesman.Checked = employeeInformationBasicInformationGateway.GetIsSalesman(employeeId);
                ckbxRequestTimesheet.Checked = employeeInformationBasicInformationGateway.GetRequestProjectTime(employeeId);
                ckbxSalaried.Checked = employeeInformationBasicInformationGateway.GetSalaried(employeeId);
                ckbxAssignableSrs.Checked = employeeInformationBasicInformationGateway.GetAssignableSRS(employeeId);
                ddlType.SelectedValue = employeeInformationBasicInformationGateway.GetType(employeeId);
                ddlState.SelectedValue = employeeInformationBasicInformationGateway.GetState(employeeId);
                ddlCategory.SelectedValue = employeeInformationBasicInformationGateway.GetCategory(employeeId);
                ddlPersonalAgency.SelectedValue = employeeInformationBasicInformationGateway.GetPersonalAgencyName(employeeId);
                ckbxVacationsManager.Checked = employeeInformationBasicInformationGateway.GetIsVacationsManager(employeeId);
                ckbxApproveTimesheets.Checked = employeeInformationBasicInformationGateway.GetApproveTimesheets(employeeId);
                if (employeeInformationBasicInformationGateway.GetCrew(employeeId) != "")
                {
                    ddlCrew.SelectedValue = employeeInformationBasicInformationGateway.GetCrew(employeeId);
                }
                else
                {
                    ddlCrew.SelectedIndex = 0;
                }

                if (employeeInformationBasicInformationGateway.GetType(employeeId).Contains("CA"))
                {
                    ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList();
                    projectTimeJobClassTypeList.LoadAndAddItem(1, 3, "");
                    ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                    ddlJobClassType.DataValueField = "JobClassType";
                    ddlJobClassType.DataTextField = "JobClassType";
                    ddlJobClassType.DataBind();
                }
                else
                {
                    ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList();
                    projectTimeJobClassTypeList.LoadAndAddItem(2, 3, "");
                    ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                    ddlJobClassType.DataValueField = "JobClassType";
                    ddlJobClassType.DataTextField = "JobClassType";
                    ddlJobClassType.DataBind();
                }

                ddlJobClassType.SelectedValue = employeeInformationBasicInformationGateway.GetJobClassType(employeeId);

                // Job costing factors
                decimal? bourdenFactor = employeeInformationBasicInformationGateway.GetBourdenFactor(employeeId);
                if (bourdenFactor.HasValue)
                {
                    tbxBourdenFactor.Text = decimal.Round((decimal)bourdenFactor, 1).ToString();
                }

                decimal? usHealthBenefitFactor = employeeInformationBasicInformationGateway.GetUSHealthBenefitFactor(employeeId);
                if (usHealthBenefitFactor.HasValue)
                {
                    tbxUSHealthBenefitFactor.Text = decimal.Round((decimal)usHealthBenefitFactor, 1).ToString();
                }

                decimal? benefitFactorCad = employeeInformationBasicInformationGateway.GetBenefitFactorCad(employeeId);
                if (benefitFactorCad.HasValue)
                {
                    tbxBenefitFactorCad.Text = decimal.Round((decimal)benefitFactorCad, 2).ToString();
                }

                decimal? benefitFactorUsd = employeeInformationBasicInformationGateway.GetBenefitFactorUsd(employeeId);
                if (benefitFactorUsd.HasValue)
                {
                    tbxBenefitFactorUsd.Text = decimal.Round((decimal)benefitFactorUsd, 2).ToString();
                }
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Validate query string
                if (((string)Request.QueryString["source_page"] == null) && ((string)Request.QueryString["others"] == null) && ((string)Request.QueryString["employee_id"] == null) && ((string)Request.QueryString["period_id"] == null) && ((string)Request.QueryString["projecttime_id"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in timesheet_edit.aspx");
                }

                // Security check
                if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_FULL_EDITING"]))
                {
                    if (Request.QueryString["others"] == "no")
                    {
                        if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_EDIT"])))
                        {
                            if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT"]))
                            {
                                if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT_WED"]))
                                {
                                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_EDIT"])))
                        {
                            if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT"]))
                            {
                                if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT_WED"]))
                                {
                                    if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_EDIT"])))
                                    {
                                        if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_MANAGEMENT"]))
                                        {
                                            if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_MANAGEMENT_WED"]))
                                            {
                                                Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                // Initialize viewstate variables
                ViewState["others"] = Request.QueryString["others"];
                ViewState["employee_id"] = int.Parse(Request.QueryString["employee_id"]);
                ViewState["period_id"] = int.Parse(Request.QueryString["period_id"]);
                ViewState["projecttime_id"] = int.Parse(Request.QueryString["projecttime_id"]);
                System.Configuration.AppSettingsReader appSettingReader = new System.Configuration.AppSettingsReader();
                ViewState["LHMode"] = appSettingReader.GetValue("LABOUR_HOURS_OPERATION_MODE", typeof(System.String)).ToString();
                hdfCompanyId.Value = Session["companyID"].ToString();

                // Get ProjectTime record
                ProjectTimeGateway projectTimeGateway = new ProjectTimeGateway(projectTimeTDS);
                projectTimeGateway.LoadByProjectTimeId((int)ViewState["projecttime_id"]);

                // Project time state check
                if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_FULL_EDITING"]))
                {
                    if (projectTimeGateway.GetProjectTimeState((int)ViewState["projecttime_id"]) == "Approved")
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "You cannot edit an approved project time.");
                    }
                }

                if (!Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_FULL_EDITING"]))
                {
                    if (Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT"]) || Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_MANAGEMENT"]))
                    {
                        bool isValidLimitPayPeriodToManagementEdit = LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime.ValidateLimitedPayPeriodToManagementEdit(projectTimeGateway.GetDate_((int)ViewState["projecttime_id"]), projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"]));

                        if (!isValidLimitPayPeriodToManagementEdit)
                        {
                            Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                        }
                    }
                    else
                    {
                        if (Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_MY_TIMESHEETS_MANAGEMENT_WED"]) || Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_OTHERS_TIMESHEETS_MANAGEMENT_WED"]))
                        {
                            bool isValidLimitPayPeriodToManagementEdit = LiquiForce.LFSLive.BL.LabourHours.ProjectTime.ProjectTime.ValidateLimitedPayPeriodToWednesdayManagementEdit(projectTimeGateway.GetDate_((int)ViewState["projecttime_id"]), projectTimeGateway.GetProjectId((int)ViewState["projecttime_id"]));

                            if (!isValidLimitPayPeriodToManagementEdit)
                            {
                                Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                            }
                        }
                    }
                }

                // Store datasets
                Session["projectTimeTDS"] = projectTimeTDS;

                // Databind
                tkrdpDate_.DataBind();
                ddlLunch.DataBind();
                tbxComments.DataBind();
                tbxState.DataBind();

                // Prepare initial data for client
                StoreNavigatorState();

                EmployeeGateway employeeGateway = new EmployeeGateway(new DataSet());
                employeeGateway.LoadByEmployeeId((int)ViewState["employee_id"]);
                tbxEmployee.Text = employeeGateway.GetFullName(int.Parse(Request.QueryString["employee_id"]));

                int companyId = Int32.Parse(hdfCompanyId.Value);
                CompaniesList companiesList = new CompaniesList();
                companiesList.LoadAndAddItem(-1, "(Select a client)", companyId);
                ddlClient.DataSource = companiesList.Table;
                ddlClient.DataValueField = "COMPANIES_ID";
                ddlClient.DataTextField = "Name";
                ddlClient.DataBind();

                CompaniesGateway companiesGateway = new CompaniesGateway();
                companiesGateway.LoadAllByCompaniesId(Int32.Parse(DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].CompaniesID").ToString()), companyId);

                // ... If Company is active
                bool deleted = companiesGateway.GetDeleted(Int32.Parse(DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].CompaniesID").ToString()));

                if (deleted)
                {
                    ddlClient.SelectedIndex = -1;
                }
                else
                {
                    ddlClient.SelectedValue = DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].CompaniesID").ToString();
                }

                ProjectList projectList = new ProjectList();
                projectList.LoadProjectsInternalProjectsBallparkProjectsAndAddItem(-1, "(Select a project)", int.Parse(ddlClient.SelectedValue));
                ddlProject.DataSource = projectList.Table;
                ddlProject.DataValueField = "ProjectID";
                ddlProject.DataTextField = "Name";
                ddlProject.DataBind();

                if (!deleted)
                {
                    try
                    {
                        ddlProject.SelectedValue = DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].ProjectID").ToString();
                    }
                    catch
                    {
                        ddlProject.SelectedIndex = -1;
                    }
                }
                else
                {
                    ddlProject.SelectedIndex = -1;
                }

                if (ddlProject.SelectedIndex != 0)
                {
                    ProjectGateway projectGateway = new ProjectGateway();
                    projectGateway.LoadByProjectId(Int32.Parse(ddlProject.SelectedValue));

                    if (projectGateway.GetCountryID(Int32.Parse(ddlProject.SelectedValue)) == 1) //Canada
                    {
                        if (projectGateway.GetFairWageApplies(int.Parse(ddlProject.SelectedValue)))
                        {
                            ddlJobClassType.Visible = true;
                            lblJobClassType.Visible = true;

                            ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList();
                            projectTimeJobClassTypeList.LoadAndAddItem(1, companyId, "(Select a Job Class Type)");
                            ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                            ddlJobClassType.DataValueField = "JobClassType";
                            ddlJobClassType.DataTextField = "JobClassType";
                            ddlJobClassType.DataBind();

                            if (projectTimeGateway.GetJobClassType((int)ViewState["projecttime_id"]).ToString() == "")
                            {
                                ddlJobClassType.SelectedIndex = 0;
                            }
                            else
                            {
                                ddlJobClassType.SelectedValue = (string)DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].JobClassType");
                            }
                        }
                        else
                        {
                            ddlJobClassType.Visible = false;
                            lblJobClassType.Visible = false;
                        }
                    }
                    else
                    {
                        if (projectGateway.GetFairWageApplies(int.Parse(ddlProject.SelectedValue)))
                        {
                            ddlJobClassType.Visible = true;
                            lblJobClassType.Visible = true;

                            ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList();
                            projectTimeJobClassTypeList.LoadAndAddItem(2, companyId, "(Select a Job Class Type)");
                            ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                            ddlJobClassType.DataValueField = "JobClassType";
                            ddlJobClassType.DataTextField = "JobClassType";
                            ddlJobClassType.DataBind();

                            if (projectTimeGateway.GetJobClassType((int)ViewState["projecttime_id"]).ToString() == "")
                            {
                                ddlJobClassType.SelectedIndex = 0;
                            }
                            else
                            {
                                ddlJobClassType.SelectedValue = (string)DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].JobClassType");
                            }
                        }
                        else
                        {
                            ddlJobClassType.Visible = false;
                            lblJobClassType.Visible = false;
                        }
                    }
                }
                else
                {
                    ddlJobClassType.Visible = false;
                    lblJobClassType.Visible = false;
                }

                WorkingDetailsGateway workingDetailsGateway = new WorkingDetailsGateway(new DataSet());
                workingDetailsGateway.Load();
                ddlWorkingDetails.DataSource = workingDetailsGateway.Table;
                ddlWorkingDetails.DataValueField = "WorkingDetails";
                ddlWorkingDetails.DataTextField = "WorkingDetails";
                ddlWorkingDetails.DataBind();

                if (!deleted)
                {
                    ddlWorkingDetails.SelectedValue = projectTimeGateway.GetWorkingDetails((int)ViewState["projecttime_id"]);
                }
                else
                {
                    ddlWorkingDetails.SelectedIndex = -1;
                }

                ProjectTimeWorkList projectTimeWorkList = new ProjectTimeWorkList(new DataSet());

                int projectId = 0;
                try
                {
                    projectId = Int32.Parse(ddlProject.SelectedValue);
                }
                catch
                {
                }

                if (projectId == 35 || projectId == 39 || projectId == 716)
                {
                    projectTimeWorkList.LoadAndAddItem("");
                }
                else
                {
                    projectTimeWorkList.LoadAndAddItem("(Select a Type)");
                }

                // Setting start time, end time
                string startTime = DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].StartTime", "{0:H:mm}").ToString();
                if (!String.IsNullOrEmpty(startTime))
                {
                    string[] hoursMin1 = startTime.Split(':');
                    ddlStartTimeHour.SelectedValue = hoursMin1[0].Trim();
                    ddlStartTimeMinute.SelectedValue = hoursMin1[1].Trim();
                }
                else
                {
                    ddlStartTimeHour.SelectedIndex = 0;
                    ddlStartTimeMinute.SelectedIndex = 0;
                }

                string endTime = DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].EndTime", "{0:H:mm}").ToString();
                if (!String.IsNullOrEmpty(endTime))
                {
                    string[] endHoursMin1 = endTime.Split(':');
                    ddlEndTimeHour.SelectedValue = endHoursMin1[0].Trim();
                    ddlEndTimeMinute.SelectedValue = endHoursMin1[1].Trim();
                }
                else
                {
                    ddlEndTimeHour.SelectedIndex = 0;
                    ddlEndTimeMinute.SelectedIndex = 0;
                }

                // Setting type of Work
                ddlTypeOfWork.DataSource = projectTimeWorkList.Table;
                ddlTypeOfWork.DataValueField = "Work_";
                ddlTypeOfWork.DataTextField = "Work_";
                ddlTypeOfWork.DataBind();
                if (projectTimeGateway.GetWork((int)ViewState["projecttime_id"]) == "") ddlTypeOfWork.SelectedIndex = -1; else ddlTypeOfWork.SelectedValue = projectTimeGateway.GetWork((int)ViewState["projecttime_id"]);

                ProjectTimeWorkFunctionList projectTimeWorkFunctionList = new ProjectTimeWorkFunctionList(new DataSet());
                if (projectTimeGateway.GetWork((int)ViewState["projecttime_id"]) == "")
                {
                    // ... If there is no type of Work, no function should be loaded
                    projectTimeWorkFunctionList.LoadAndAddItem("", "-1");
                }
                else
                {
                    projectTimeWorkFunctionList.LoadAndAddItem("(Select a Function)", projectTimeGateway.GetWork((int)ViewState["projecttime_id"]).ToString());
                }
                ddlFunction.DataSource = projectTimeWorkFunctionList.Table;
                ddlFunction.DataValueField = "Function_";
                ddlFunction.DataTextField = "Function_";
                ddlFunction.DataBind();
                if (projectTimeGateway.GetWork((int)ViewState["projecttime_id"]).ToString() == "")
                {
                    ddlFunction.SelectedValue = "";
                }
                else
                {
                    ddlFunction.SelectedValue = (string)DataBinder.Eval(projectTimeTDS, "Tables[LFS_PROJECT_TIME].DefaultView.[0].Function_");
                }

                CountryList countryList = new CountryList(new DataSet());
                countryList.LoadAndAddItem(-1, " ");
                ddlMealsCountry.DataSource = countryList.Table;
                ddlMealsCountry.DataValueField = "CountryID";
                ddlMealsCountry.DataTextField = "Name";
                ddlMealsCountry.DataBind();

                if (!deleted)
                {
                    if (projectTimeGateway.GetMealsCountry((int)ViewState["projecttime_id"]).HasValue)
                    {
                        ddlMealsCountry.SelectedValue = projectTimeGateway.GetMealsCountry((int)ViewState["projecttime_id"]).ToString();
                    }
                    else
                    {
                        ddlMealsCountry.SelectedValue = "-1";
                    }
                }
                else
                {
                    ddlMealsCountry.SelectedIndex = -1;
                }

                //if (projectTimeGateway.GetMealsAllowance((int)ViewState["projecttime_id"]) > 0)
                //{
                //    cbxMealsAllowance.Checked = true;
                //}

                string unitType = "Vehicle";
                UnitsList unitsList = new UnitsList(new DataSet());
                unitsList.LoadAndAddItem("-1", " ", Int32.Parse(Session["companyID"].ToString()), true, 0, unitType);
                ddlUnit.DataSource = unitsList.Table;
                ddlUnit.DataValueField = "UnitID";
                ddlUnit.DataTextField = "UnitCode";
                ddlUnit.DataBind();
                if (projectTimeGateway.GetUnitId((int)ViewState["projecttime_id"]).HasValue)
                {
                    ddlUnit.SelectedValue = ((int)projectTimeGateway.GetUnitId((int)ViewState["projecttime_id"])).ToString();
                }

                UnitsList towed = new UnitsList(new DataSet());
                towed.LoadAndAddItem("-1", " ", Int32.Parse(Session["companyID"].ToString()), true, 1, unitType);
                ddlTowed.DataSource = towed.Table;
                ddlTowed.DataValueField = "UnitID";
                ddlTowed.DataTextField = "UnitCode";
                ddlTowed.DataBind();
                if (projectTimeGateway.GetTowedUnitId((int)ViewState["projecttime_id"]).HasValue)
                {
                    ddlTowed.SelectedValue = ((int)projectTimeGateway.GetTowedUnitId((int)ViewState["projecttime_id"])).ToString();
                }
            }
            else
            {
                // Restore datasets
                projectTimeTDS = (ProjectTimeTDS)Session["projectTimeTDS"];
            }
        }
        protected void ddlProject_SelectedIndexChanged(object sender, EventArgs e)
        {
            if ((ddlProject.SelectedValue != null) && (ddlProject.SelectedValue != "-1"))
            {
                ProjectGateway projectGateway = new ProjectGateway(new DataSet());
                ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList();
                ProjectTimeWorkList projectTimeWorkList = new ProjectTimeWorkList(new DataSet());

                projectGateway.LoadByProjectId(int.Parse(ddlProject.SelectedValue));

                if (int.Parse(ddlProject.SelectedValue) == 35 || int.Parse(ddlProject.SelectedValue) == 39 || int.Parse(ddlProject.SelectedValue) == 716)
                {
                    projectTimeWorkList.LoadAndAddItem("");
                }
                else
                {
                    projectTimeWorkList.LoadAndAddItem("(Select a Type)");
                }

                // Setting type of Work
                ddlTypeOfWork.DataSource = projectTimeWorkList.Table;
                ddlTypeOfWork.DataValueField = "Work_";
                ddlTypeOfWork.DataTextField = "Work_";
                ddlTypeOfWork.DataBind();
                ddlTypeOfWork.SelectedIndex = 0;

                switch (projectGateway.GetCountryID(int.Parse(ddlProject.SelectedValue)))
                {
                    case 1:
                        ddlWorkingDetails.SelectedValue = "Canada";
                        ddlMealsCountry.SelectedValue = "1";
                        if (projectGateway.GetFairWageApplies(int.Parse(ddlProject.SelectedValue)))
                        {
                            ddlJobClassType.Visible = true;
                            lblJobClassType.Visible = true;

                            int companyId = Int32.Parse(hdfCompanyId.Value);
                            projectTimeJobClassTypeList.LoadAndAddItem(1, companyId, "(Select a Job Class Type)");
                            ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                            ddlJobClassType.DataValueField = "JobClassType";
                            ddlJobClassType.DataTextField = "JobClassType";
                            ddlJobClassType.DataBind();
                        }
                        else
                        {
                            ddlJobClassType.Visible = false;
                            lblJobClassType.Visible = false;
                        }
                        break;

                    case 2:
                        ddlWorkingDetails.SelectedValue = "USA";
                        ddlMealsCountry.SelectedValue = "2";
                        if (projectGateway.GetFairWageApplies(int.Parse(ddlProject.SelectedValue)))
                        {
                            ddlJobClassType.Visible = true;
                            lblJobClassType.Visible = true;

                            int companyId = Int32.Parse(hdfCompanyId.Value);
                            projectTimeJobClassTypeList.LoadAndAddItem(2, companyId, "(Select a Job Class Type)");
                            ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                            ddlJobClassType.DataValueField = "JobClassType";
                            ddlJobClassType.DataTextField = "JobClassType";
                            ddlJobClassType.DataBind();
                        }
                        else
                        {
                            ddlJobClassType.Visible = false;
                            lblJobClassType.Visible = false;
                        }
                        break;
                }
            }

            upnlWorkingDetails.Update();
            upnlMealsCountry.Update();
            upnlJobClassType.Update();
            upnlJobClassTypeLabel.Update();
            upnlTypeOfWork.Update();

            rfvProject.Validate();
        }
        // ////////////////////////////////////////////////////////////////////////
        // INITIAL EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_RESOURCES_EMPLOYEES_ADD"])))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator.");
                }

                // Validate query string
                if ((string)Request.QueryString["source_page"] == null)
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in employees_add.aspx");
                }

                // Tag Page
                hdfCompanyId.Value = Convert.ToInt32(Session["companyID"]).ToString();

                // If coming from
                // ... employee_navigator.aspx
                if (Request.QueryString["source_page"] == "lm")
                {
                    // ... Initialize tables
                    employeesAddTDS = new EmployeesAddTDS();

                    EmployeeAddGateway employeeAddGateway = new EmployeeAddGateway();
                    employeeAddGateway.LoadAll();

                    // ... Store tables
                    Session["employeesAddTDS"] = employeesAddTDS;
                }

                int companyId = Int32.Parse(hdfCompanyId.Value);
                ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList();
                projectTimeJobClassTypeList.LoadAndAddItem(1, companyId, "");
                ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table;
                ddlJobClassType.DataValueField = "JobClassType";
                ddlJobClassType.DataTextField = "JobClassType";
                ddlJobClassType.DataBind();
                ddlJobClassType.SelectedIndex = 0;

                // StepSection1In
                wzTeamMember.ActiveStepIndex = 0;
                lblUserErrorMessage.Visible = false;
                StepBeginIn();
            }
            else
            {
                // Restore tables
                employeesAddTDS = (EmployeesAddTDS)Session["employeesAddTDS"];
            }
        }