// ////////////////////////////////////////////////////////////////////////
        // PRIVATE METHODS
        //
        private void LoadData(int employeeId, int year)
        {
            VacationsAddBasicInformationGateway vacationsAddBasicInformationGateway = new VacationsAddBasicInformationGateway(vacationsAddTDS);

            tbxEmployee.Text = vacationsAddBasicInformationGateway.GetEmployeeName(employeeId, year);
            tbxMax.Text = vacationsAddBasicInformationGateway.GetTotalVacationDays(employeeId, year).ToString();
            tbxRemaining.Text = vacationsAddBasicInformationGateway.GetRemainingPayVacationDays(employeeId, year).ToString();
        }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Tag page
                // ... for non vacation managers
                EmployeeGateway employeeGatewayManager = new EmployeeGateway();

                int employeeIdNow = employeeGatewayManager.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"]));

                employeeGatewayManager.LoadByEmployeeId(employeeIdNow);

                if (employeeGatewayManager.GetIsVacationsManager(employeeIdNow))
                {
                    hdfIsVacationManager.Value = "True";
                }
                else
                {
                    hdfIsVacationManager.Value = "False";
                }

                // Security check
                //if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_VACATIONS_ADD"])))
                //{
                if (hdfIsVacationManager.Value == "False")
                {
                    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) && ((string)Request.QueryString["employee_id"] == null) && ((string)Request.QueryString["date_to_show"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in vacations_add.aspx");
                }

                // Tag page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfEmployeeId.Value = (string)Request.QueryString["employee_id"];

                Session.Remove("vacationsAddTDS");

                ViewState["date_to_show"] = (string)Request.QueryString["date_to_show"];
                DateTime dateToShow = DateTime.Parse((string)Request.QueryString["date_to_show"]);

                // Prepare initial data
                // ... For employee list

                EmployeeList employeeList = new EmployeeList();

                string employeeTypeNow = employeeGatewayManager.GetType(employeeIdNow);

                if (employeeTypeNow.Contains("CA"))
                {
                    employeeList.LoadBySalariedEmployeeTypeAndAddItem(1, "CA", -1, "(All)");
                }
                else
                {
                    employeeList.LoadBySalariedEmployeeTypeAndAddItem(1, "US", -1, "(All)");
                }

                DropDownList ddlVacationsFor = (DropDownList)tkrpbLeftMenuAllVacations.FindItemByValue("nbVacationsForDDL").FindControl("ddlVacationsFor");
                ddlVacationsFor.DataSource = employeeList.Table;
                ddlVacationsFor.DataValueField = "EmployeeID";
                ddlVacationsFor.DataTextField = "FullName";
                ddlVacationsFor.DataBind();
                ddlVacationsFor.SelectedValue = Session["ddlVacationsForSelectedValue"].ToString();

                // ... For employee ddl
                ddlEmployee.DataSource = employeeList.Table;
                ddlEmployee.DataValueField = "EmployeeID";
                ddlEmployee.DataTextField = "FullName";
                ddlEmployee.DataBind();

                vacationsAddTDS = new VacationsAddTDS();
                vacationDaysInformation = new VacationsAddTDS.DaysInformationDataTable();

                // If there is a selected employee
                if (hdfEmployeeId.Value != "-1")
                {
                    int companyId = Int32.Parse(hdfCompanyId.Value);
                    int employeeId = Int32.Parse(hdfEmployeeId.Value);

                    // ... Verify basic information
                    VacationsAddBasicInformationGateway vacationsAddBasicInformationGateway = new VacationsAddBasicInformationGateway(vacationsAddTDS);
                    vacationsAddBasicInformationGateway.LoadByEmployeeIdYear(employeeId, dateToShow.Year, companyId);

                    if (vacationsAddBasicInformationGateway.Table.Rows.Count == 0)
                    {
                        Response.Redirect("./../../error_page.aspx?error=" + "The team member don't have total paid day vacations defined in the system. Contact your system administrator.");
                    }
                    else
                    {
                        LoadData(employeeId, dateToShow.Year);

                        // ... Load non working days
                        EmployeeGateway employeeGateway = new EmployeeGateway();
                        employeeGateway.LoadByEmployeeId(employeeId);

                        string employeeType = employeeGateway.GetType(employeeId);
                        int companyLevelId = 3; //USA

                        if (employeeType.Contains("CA"))
                        {
                            companyLevelId = 2;//Canada
                        }

                        VacationsAddDaysInformation vacationsAddDaysInformation = new VacationsAddDaysInformation(vacationsAddTDS);
                        //vacationsAddDaysInformation.LoadNonWorkingDaysByCompanyLevelId(companyLevelId, companyId);

                        // ... Load previews vacations
                        //vacationsAddDaysInformation.LoadPreviousVacations(employeeId, companyId);
                        vacationsAddDaysInformation.LoadDataForVacationsAdd(companyLevelId, employeeId, companyId);
                    }
                }

                ViewState["employee_id"] = hdfEmployeeId.Value;

                Session["vacationsAddTDS"] = vacationsAddTDS;
                Session["vacationDaysInformation"] = vacationsAddTDS.DaysInformation;

                Page.DataBind();
            }
            else
            {
                vacationsAddTDS = (VacationsAddTDS)Session["vacationsAddTDS"];
                vacationDaysInformation = (VacationsAddTDS.DaysInformationDataTable)Session["vacationDaysInformation"];

                hdfEmployeeId.Value = ViewState["employee_id"].ToString();
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // AUXILIAR EVENTS
        //
        protected void ddlEmployee_SelectedIndexChanged(object sender, EventArgs e)
        {
            ViewState["date_to_show"] = tkrsVacations.SelectedDate.ToString();
            ViewState["employee_id"] = ddlEmployee.SelectedValue;

            DateTime dateToShow = DateTime.Parse((string)ViewState["date_to_show"]);
            int companyId = Int32.Parse(hdfCompanyId.Value);
            hdfEmployeeId.Value = ddlEmployee.SelectedValue.ToString();
            int employeeId = Int32.Parse(hdfEmployeeId.Value);

            // Reload Data
            VacationsAddBasicInformationGateway vacationsAddBasicInformationGateway = new VacationsAddBasicInformationGateway(vacationsAddTDS);
            vacationsAddBasicInformationGateway.LoadByEmployeeIdYear(employeeId, dateToShow.Year, companyId);

            if (vacationsAddBasicInformationGateway.Table.Rows.Count == 0)
            {
                Response.Redirect("./../../error_page.aspx?error=" + "The team member don't have total paid day vacations defined in the system. Contact your system administrator.");
            }
            else
            {
                LoadData(employeeId, dateToShow.Year);

                // ... Load non working days
                EmployeeGateway employeeGateway = new EmployeeGateway();
                employeeGateway.LoadByEmployeeId(employeeId);

                string employeeType = employeeGateway.GetType(employeeId);
                int companyLevelId = 3; //USA

                if (employeeType.Contains("CA"))
                {
                    companyLevelId = 2;//Canada
                }

                VacationsAddDaysInformation vacationsAddDaysInformation = new VacationsAddDaysInformation(vacationsAddTDS);
                //vacationsAddDaysInformation.LoadNonWorkingDaysByCompanyLevelId(companyLevelId, companyId);

                // ... Load previews vacations
                //vacationsAddDaysInformation.LoadPreviousVacations(employeeId, companyId);
                vacationsAddDaysInformation.LoadDataForVacationsAdd(companyLevelId, employeeId, companyId);
            }

            Session["vacationsAddTDS"] = vacationsAddTDS;
            Session["vacationDaysInformation"] = vacationsAddTDS.DaysInformation;
        }
 // ////////////////////////////////////////////////////////////////////////
 // PUBLIC METHODS - DATASET
 //
 /// <summary>
 /// LoadByEmployeeIdYear
 /// </summary>
 /// <param name="employeeId">employeeId</param>
 /// <param name="year">year</param>
 /// <param name="companyId">companyId</param>
 public void LoadByEmployeeIdYear(int employeeId, int year, int companyId)
 {
     VacationsAddBasicInformationGateway vacationsAddBasicInformationGateway = new VacationsAddBasicInformationGateway(Data);
     vacationsAddBasicInformationGateway.LoadByEmployeeIdYear(employeeId, year, companyId);
 }