private ProjectTimeApproveTDS SubmitSearch()
        {
            // Load data
            ProjectTimeApproveTDS dataSet = new ProjectTimeApproveTDS();
            ProjectTimeApproveGateway projectTimeApproveGateway = new ProjectTimeApproveGateway(dataSet);

            EmployeeGateway employeeGateway1 = new EmployeeGateway(new DataSet());
            int employeeId = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"]));
            employeeGateway1.LoadByEmployeeId(employeeId);
            string employeeType = employeeGateway1.GetType(employeeId);

            if (employeeType.Contains("CA"))
            {
                projectTimeApproveGateway.LoadByEmployeeTypeEmployeeIdApproveManager("CA", employeeId);
            }
            else
            {
                if (employeeType.Contains("US"))
                {
                    projectTimeApproveGateway.LoadByEmployeeTypeEmployeeIdApproveManager("US", employeeId);
                }
                else
                {
                    projectTimeApproveGateway.LoadByEmployeeTypeEmployeeIdApproveManager("SOTA", employeeId);
                }
            }

            return dataSet;
        }
        protected void grdProjectTimeApprove_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            // Normal items
            if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate))))
            {
                Label lblJobClass = (Label)e.Row.FindControl("lblJobClass");
                Label lblTypeOfWork = (Label)e.Row.FindControl("lblTypeOfWork");

                 EmployeeGateway employeeGateway1 = new EmployeeGateway(new DataSet());
                int employeeId = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"]));
                employeeGateway1.LoadByEmployeeId(employeeId);
                string employeeType = employeeGateway1.GetType(employeeId);

                if (lblTypeOfWork.Text == "Mobilization" && employeeType.Contains("US"))
                {
                    lblJobClass.Visible = false;
                }
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // 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)
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in timesheet_approve.aspx");
                }

                // Security check
                EmployeeGateway employeeGateway1 = new EmployeeGateway(new DataSet());
                int employeeId = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"]));
                hdfCurrentEmployeeId.Value = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"])).ToString();
                employeeGateway1.LoadByEmployeeId(employeeId);

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

                // Tag page
                Session.Remove("projectTimeApproveDummy");

                // Initialize  variables
                lblError.Visible = false;

                // ... Initialize viewstate variables
                System.Configuration.AppSettingsReader appSettingReader = new System.Configuration.AppSettingsReader();
                ViewState["LHMode"] = appSettingReader.GetValue("LABOUR_HOURS_OPERATION_MODE", typeof(System.String)).ToString();

                // Labour Hours Mode check
                if ((string)ViewState["LHMode"] == "Partial")
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "The system is on partial mode. Contact your system administrator.");
                }

                ViewState["others"] = Request.QueryString["others"];

                PayPeriodGateway payPeriodGateway = new PayPeriodGateway(new DataSet());
                ViewState["period_id"] = payPeriodGateway.GetPayPeriodId(DateTime.Now);

                // Load data
                // ... Loading employees accordingly to the admins country.
                EmployeeList employeeList = new EmployeeList(new DataSet());
                string employeeType = employeeGateway1.GetType(employeeId);
                odsClient.SelectParameters.RemoveAt(2);
                if (employeeType.Contains("CA"))
                {
                    employeeList.LoadByRequestProjectTimeEmployeeTypeEmployeeIdApproveManagerAndAddItem(1, "CA", -1, "(All)", employeeId);

                    odsClient.SelectParameters.Add("countryId", "1");
                }
                else
                {
                    if (employeeType.Contains("US"))
                    {
                        employeeList.LoadByRequestProjectTimeEmployeeTypeEmployeeIdApproveManagerAndAddItem(1, "US", -1, "(All)", employeeId);

                        odsClient.SelectParameters.Add("countryId", "2");
                    }
                    else
                    {
                        employeeList.LoadByRequestProjectTimeEmployeeTypeEmployeeIdApproveManagerAndAddItem(1, "SOTA", -1, "(All)", employeeId);

                        odsClient.SelectParameters.Add("countryId", "-1");
                    }
                }

                odsClient.Select();
                ddlClient.SelectedIndex = 0;
                upnlClient.Update();

                ddlTeamMember.DataSource = employeeList.Table;
                ddlTeamMember.DataValueField = "EmployeeID";
                ddlTeamMember.DataTextField = "FullName";
                ddlTeamMember.DataBind();

                odsProject.SelectParameters.RemoveAt(2);
                odsProject.SelectParameters.Add("clientId", "-1");
                odsProject.Select();
                ddlProject.DataBind();
                ddlProject.SelectedIndex = 0;
                upnlProject.Update();

                projectTimeApproveTDS = this.SubmitSearch();

                // Store Datasets
                Session["projectTimeApproveTDS"] = projectTimeApproveTDS;
                projectTimeApprove = projectTimeApproveTDS.ProjectTimeApprove;
                Session["projectTimeApprove"] = projectTimeApproveTDS.ProjectTimeApprove;

                // If coming from
                // ... timesheet_edit.aspx, timesheet_summary.aspx or timesheet_delete.aspx
                if ((Request.QueryString["source_page"] == "timesheet_edit.aspx") || (Request.QueryString["source_page"] == "timesheet_summary.aspx") || (Request.QueryString["source_page"] == "timesheet_delete.aspx"))
                {
                    // ... restore top values
                    RestoreNavigatorState();

                    // ... filter grid information
                    //SetFilterByCountryIdClientIdProjectId();
                    //SetFilterByEmployeeIdDate();
                    SetFilterByClientIdProjectIdEmployeeIdDate();
                }

                ViewState["filter_expression"] = "Deleted = 0";

                SetFocus();
            }
            else
            {
                // Restore dataset
                projectTimeApproveTDS = (ProjectTimeApproveTDS)Session["projectTimeApproveTDS"];
                projectTimeApprove = projectTimeApproveTDS.ProjectTimeApprove;
                Session["projectTimeApprove"] = projectTimeApproveTDS.ProjectTimeApprove;
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // 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;
        }
        // ////////////////////////////////////////////////////////////////////////
        // 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 (hdfIsVacationManager.Value == "False")
                {
                    //if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_VACATIONS_EDIT"])))
                    //{
                        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["vacation_id"] == null) && ((string)Request.QueryString["request_id"] == null) && ((string)Request.QueryString["date_to_show"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in vacations_edit.aspx");
                }

                // Tag page
                hdfCompanyId.Value = Session["companyID"].ToString();
                hdfVacationId.Value = (string)Request.QueryString["vacation_id"];
                hdfRequestId.Value = (string)Request.QueryString["request_id"];

                int requestId = Int32.Parse(hdfRequestId.Value);
                int companyId = Int32.Parse(hdfCompanyId.Value);

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

                // Initialize values
                DropDownList ddlVacationsFor = (DropDownList)tkrpbLeftMenuAllVacations.FindItemByValue("nbVacationsForDDL").FindControl("ddlVacationsFor");
                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)");
                }
                ddlVacationsFor.DataSource = employeeList.Table;
                ddlVacationsFor.DataValueField = "EmployeeID";
                ddlVacationsFor.DataTextField = "FullName";
                ddlVacationsFor.DataBind();
                ddlVacationsFor.SelectedValue = Session["ddlVacationsForSelectedValue"].ToString();

                // Load Data
                vacationsInformationTDS = new VacationsInformationTDS();
                vacationDaysInformation = new VacationsInformationTDS.DaysInformationDataTable();

                VacationsInformationDaysInformationGateway vacationsInformationDaysInformationGateway = new VacationsInformationDaysInformationGateway(vacationsInformationTDS);
                vacationsInformationDaysInformationGateway.LoadByRequestId(requestId, companyId);

                VacationsInformationRequestsInformationGateway vacationsInformationRequestsInformationGateway = new VacationsInformationRequestsInformationGateway(vacationsInformationTDS);
                vacationsInformationRequestsInformationGateway.LoadByRequestId(requestId, companyId);

                hdfEmployeeId.Value = vacationsInformationRequestsInformationGateway.GetEmployeeID(requestId).ToString();
                int employeeId = Int32.Parse(hdfEmployeeId.Value);

                VacationsInformationBasicInformationGateway vacationsInformationBasicInformationGateway = new VacationsInformationBasicInformationGateway(vacationsInformationTDS);
                vacationsInformationBasicInformationGateway.LoadByEmployeeIdYear(employeeId, dateToShow.Year, companyId);

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

                LoadData(employeeId, dateToShow.Year, requestId);

                Page.DataBind();
            }
            else
            {
                vacationsInformationTDS = (VacationsInformationTDS)Session["vacationsInformationTDS"];
                vacationDaysInformation = (VacationsInformationTDS.DaysInformationDataTable)Session["vacationDaysInformation"];
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // 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();
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_VACATIONS_VIEW"])))
                {
                    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 vacations_all.aspx");
                }

                // Tag page
                int companyId = Int32.Parse(Session["companyID"].ToString());
                hdfCompanyId.Value = companyId.ToString();

                // ... 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";
                }

                // Initialize values
                DropDownList ddlVacationsFor = (DropDownList)tkrpbLeftMenuAllVacations.FindItemByValue("nbVacationsForDDL").FindControl("ddlVacationsFor");
                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)");
                }
                ddlVacationsFor.DataSource = employeeList.Table;
                ddlVacationsFor.DataValueField = "EmployeeID";
                ddlVacationsFor.DataTextField = "FullName";
                ddlVacationsFor.DataBind();

                //... date_to_show
                if ((string)Request.QueryString["date_to_show"] == null)
                {
                    ViewState["date_to_show"] = DateTime.Now.ToString();
                }
                else
                {
                    ViewState["date_to_show"] = (string)Request.QueryString["date_to_show"];
                }

                // Load vacations
                vacationsInformationTDS = new VacationsInformationTDS();
                vacationsInformation = new VacationsInformationTDS.VacationsInformationDataTable();

                VacationsInformationGateway vacationsInformationGateway = new VacationsInformationGateway(vacationsInformationTDS);

                if (hdfIsVacationManager.Value == "False")
                {
                    EmployeeGateway employeeGateway1 = new EmployeeGateway();
                    ViewState["employee_id"] = employeeGateway1.GetEmployeIdByLoginId(Convert.ToInt32(Session["loginID"]));

                    EmployeeInformationBasicInformationGateway employeeInformationBasicInformationGateway = new EmployeeInformationBasicInformationGateway();
                    employeeInformationBasicInformationGateway.LoadByEmployeeId(Int32.Parse(ViewState["employee_id"].ToString()));

                    string employeeType = employeeInformationBasicInformationGateway.GetType(Int32.Parse(ViewState["employee_id"].ToString()));

                    if (employeeType.Contains("CA"))
                    {
                        ddlWorkingLocation.SelectedValue = "CA";

                    }
                    else
                    {
                        ddlWorkingLocation.SelectedValue = "US";
                    }

                    vacationsInformationGateway.LoadByEmployeeIdEmployeeType(Int32.Parse(ViewState["employee_id"].ToString()), employeeType, companyId);
                }
                else
                {
                    if ((string)Request.QueryString["employee_id"] == null)
                    {
                        ViewState["employee_id"] = "-1";

                        if (employeeTypeNow.Contains("CA"))
                        {
                            ddlWorkingLocation.SelectedValue = "CA";
                        }
                        else
                        {
                            ddlWorkingLocation.SelectedValue = "US";
                        }

                        vacationsInformationGateway.LoadByEmployeeType(employeeTypeNow, companyId);
                    }
                    else
                    {
                        ViewState["employee_id"] = (string)Request.QueryString["employee_id"];

                        EmployeeInformationBasicInformationGateway employeeInformationBasicInformationGateway = new EmployeeInformationBasicInformationGateway();
                        employeeInformationBasicInformationGateway.LoadByEmployeeId(Int32.Parse(ViewState["employee_id"].ToString()));

                        string employeeType = employeeInformationBasicInformationGateway.GetType(Int32.Parse(ViewState["employee_id"].ToString()));

                        if (employeeTypeNow.Contains("CA"))
                        {
                            ddlWorkingLocation.SelectedValue = "CA";
                        }
                        else
                        {
                            ddlWorkingLocation.SelectedValue = "US";
                        }

                        vacationsInformationGateway.LoadByEmployeeIdEmployeeType(Int32.Parse(ViewState["employee_id"].ToString()), employeeType, companyId);

                        ddlVacationsFor.SelectedValue = ViewState["employee_id"].ToString();
                    }
                }

                Session["vacationsInformationTDS"] = vacationsInformationTDS;
                Session["vacationsInformation"] = vacationsInformationTDS.VacationsInformation;

                tkrsVacations.SelectedDate = DateTime.Parse(ViewState["date_to_show"].ToString());
                lblTitle.Text = "Vacations Calendar for " + tkrsVacations.SelectedDate.ToString("MMMM") + " " + tkrsVacations.SelectedDate.Year.ToString();

                // Databind
                Page.DataBind();

                // For Open Vacation event
                if ((Request.Params["__EVENTTARGET"]) == "openVacation")
                {
                    int vacationId = Int32.Parse(Request.Params.Get("__EVENTARGUMENT").ToString()) ;
                    VacationsInformationDaysInformationGateway vacationsInformationDaysInformationGateway = new VacationsInformationDaysInformationGateway();
                    vacationsInformationDaysInformationGateway.LoadByVacationId(vacationId, companyId);
                    int requestId = vacationsInformationDaysInformationGateway.GetRequestID(vacationId);

                    Session["ddlVacationsForSelectedValue"] = ddlVacationsFor.SelectedValue;

                    Response.Redirect("./vacations_summary.aspx?source_page=vacations_all.aspx&vacation_id=" + vacationId.ToString() + "&request_id=" + requestId.ToString() + "&date_to_show=" + ViewState["date_to_show"]);
                }
            }
            else
            {
                vacationsInformationTDS = (VacationsInformationTDS)Session["vacationsInformationTDS"];
                vacationsInformation = (VacationsInformationTDS.VacationsInformationDataTable)Session["vacationsInformation"];

                // For Open Vacation event
                if ((Request.Params["__EVENTTARGET"]) == "openVacation")
                {
                    int vacationId = Int32.Parse(Request.Params.Get("__EVENTARGUMENT").ToString());
                    VacationsInformationDaysInformationGateway vacationsInformationDaysInformationGateway = new VacationsInformationDaysInformationGateway();
                    vacationsInformationDaysInformationGateway.LoadByVacationId(vacationId, Int32.Parse(hdfCompanyId.Value));
                    int requestId = vacationsInformationDaysInformationGateway.GetRequestID(vacationId);

                    DropDownList ddlVacationsFor = (DropDownList)tkrpbLeftMenuAllVacations.FindItemByValue("nbVacationsForDDL").FindControl("ddlVacationsFor");
                    Session["ddlVacationsForSelectedValue"] = ddlVacationsFor.SelectedValue;

                    Response.Redirect("./vacations_summary.aspx?source_page=vacations_all.aspx&vacation_id=" + vacationId.ToString() + "&request_id=" + requestId.ToString() + "&date_to_show=" + ViewState["date_to_show"]);
                }
            }
        }
示例#8
0
        /// <summary>
        /// IsValidApproveTimesheetsManager
        /// </summary>
        /// <param name="employeeIdToApprove">employeeIdToApprove</param>
        /// <param name="employeeIdApproveManager">employeeIdApproveManager</param>
        /// <returns>TRUE OR FALSE</returns>
        public bool IsValidApproveTimesheetsManager(int employeeIdToApprove, int employeeIdApproveManager)
        {
            EmployeeGateway employeeGatewayForEmployeeApproveManager = new EmployeeGateway(new DataSet());
            employeeGatewayForEmployeeApproveManager.LoadByEmployeeId(employeeIdApproveManager);

            EmployeeGateway employeeGatewayForEmployeeToApprove = new EmployeeGateway(new DataSet());
            employeeGatewayForEmployeeToApprove.LoadByEmployeeId(employeeIdToApprove);

            if (!employeeGatewayForEmployeeApproveManager.GetApproveTimesheets(employeeIdApproveManager))
            {
                return false;
            }
            else
            {
                if (employeeIdToApprove == employeeIdApproveManager)
                {
                    return true;
                }
                else
                {
                    string employeeToApproveType = employeeGatewayForEmployeeToApprove.GetType(employeeIdToApprove);
                    string employeeApproveManagerType = employeeGatewayForEmployeeApproveManager.GetType(employeeIdApproveManager);

                    string employeeToApproveCategory = employeeGatewayForEmployeeToApprove.GetCategory(employeeIdToApprove);

                    if (ContainsType(employeeToApproveType, employeeApproveManagerType))
                    {
                        EmployeeGateway employeeGateway = new EmployeeGateway();
                        if (employeeGateway.IsEmployeeWithApproveTimesheetInCategory(employeeIdApproveManager, employeeToApproveCategory))
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    else
                    {
                        return false;
                    }
                }
            }
        }
示例#9
0
        /// <summary>
        /// ValidateExistPayPeriod
        /// </summary>
        /// <param name="date">date</param>
        public static bool ValidateIfNonWorkingDay(DateTime date, int employeeId, int companyId)
        {
            int companyLevelId = 2;//Default for Canada

            EmployeeGateway employeeGateway = new EmployeeGateway();
            employeeGateway.LoadByEmployeeId(employeeId);

            if (employeeGateway.GetType(employeeId).Contains("US"))
            {
                companyLevelId = 3;
            }

            VacationsNonWorkingDaysInformationGateway vacationsNonWorkingDaysInformationGateway = new VacationsNonWorkingDaysInformationGateway();
            if (vacationsNonWorkingDaysInformationGateway.IsNonWorkingDay(date, companyLevelId, companyId))
            {
                return false;
            }
            else
            {
                return true;
            }
        }
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            // Register client scripts
            this.RegisterClientScripts();

            if (!IsPostBack)
            {
                // Security check
                if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_VACATIONS_HOLIDAY_FULL_EDITING"])))
                {
                    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["date_to_show"] == null))
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in vacations_non_working_days_definition.aspx");
                }

                // 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";
                }

                // Tag page
                ViewState["date_to_show"] = (string)Request.QueryString["date_to_show"];
                ViewState["level"] = "-1";
                int companyId = Int32.Parse(Session["companyID"].ToString());
                hdfCompanyId.Value = companyId.ToString();

                // Prepare initial data
                DropDownList ddlVacationsFor = (DropDownList)tkrpbLeftMenuAllVacations.FindItemByValue("nbVacationsForDDL").FindControl("ddlVacationsFor");
                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)");
                }
                ddlVacationsFor.DataSource = employeeList.Table;
                ddlVacationsFor.DataValueField = "EmployeeID";
                ddlVacationsFor.DataTextField = "FullName";
                ddlVacationsFor.DataBind();
                ddlVacationsFor.SelectedValue = Session["ddlVacationsForSelectedValue"].ToString();

                // ... For ddl working location
                companyLevels = new CompanyLevelsTDS();
                CompanyLevel companyLevel = new CompanyLevel(companyLevels);
                companyLevel.LoadNodes(companyId);
                GetNodeForCompanyLevel(1);
                int companyLevelId = 0;
                if (employeeTypeNow.Contains("CA"))
                {
                    ddlWorkingLocation.SelectedValue = "2";//Canada
                    companyLevelId = 2;
                }
                else
                {
                    ddlWorkingLocation.SelectedValue = "3";//Canada
                    companyLevelId = 3;
                }

                // ... Load non working days
                vacationsNonWorkingDaysInformationTDS = new VacationsNonWorkingDaysInformationTDS();
                nonWorkingDaysInformation = new VacationsNonWorkingDaysInformationTDS.NonWorkingDaysInformationDataTable();

                VacationsNonWorkingDaysInformationGateway vacationsNonWorkingDaysInformationGateway = new VacationsNonWorkingDaysInformationGateway(vacationsNonWorkingDaysInformationTDS);
                vacationsNonWorkingDaysInformationGateway.LoadByCompanyLevelId(companyLevelId, companyId);

                Session["vacationsNonWorkingDaysInformationTDS"] = vacationsNonWorkingDaysInformationTDS;
                Session["nonWorkingDaysInformation"] = vacationsNonWorkingDaysInformationTDS.NonWorkingDaysInformation;

                tkrsNonWorkingDays.SelectedDate = DateTime.Parse(ViewState["date_to_show"].ToString());

                // Databind
                Page.DataBind();
            }
            else
            {
                vacationsNonWorkingDaysInformationTDS = (VacationsNonWorkingDaysInformationTDS)Session["vacationsNonWorkingDaysInformationTDS"];
                nonWorkingDaysInformation = (VacationsNonWorkingDaysInformationTDS.NonWorkingDaysInformationDataTable)Session["nonWorkingDaysInformation"];
            }
        }