protected void cvJobClassEmptyFooter_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = true;

            int employeeId = Int32.Parse(hdfEmployeeID.Value);
            EmployeeGateway employee = new EmployeeGateway();
            employee.LoadByEmployeeId(employeeId);
            string jobClass = employee.GetJobClassType(employeeId);

            if (jobClass == "")
            {
                args.IsValid = false;
            }
        }
        protected void cvJobClassEmpty_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = true;
            int employeeId = Int32.Parse(ViewState["employee_id"].ToString());
            EmployeeGateway employee = new EmployeeGateway();
            employee.LoadByEmployeeId(employeeId);
            string jobClass = employee.GetJobClassType(employeeId);

            if ((jobClass == "") && (ddlJobClassType.Visible))
            {
                args.IsValid = false;
            }
        }
        protected void cvJobClassEmptyEdit_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = true;

            int employeeId = Int32.Parse(((Label)grdProjectTime.Rows[grdProjectTime.EditIndex].FindControl("lblEmployeeIdEdit")).Text);

            EmployeeGateway employee = new EmployeeGateway();
            employee.LoadByEmployeeId(employeeId);
            string jobClass = employee.GetJobClassType(employeeId);

            if (jobClass == "")
            {
                args.IsValid = false;
            }
        }
        protected void cvJobClassEmptyFooter_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = true;

            int employeeId = Int32.Parse(((DropDownList)grdProjectTime.FooterRow.FindControl("ddlEmployeesFooter")).SelectedValue);

            EmployeeGateway employee = new EmployeeGateway();
            employee.LoadByEmployeeId(employeeId);
            string jobClass = employee.GetJobClassType(employeeId);

            if (jobClass == "")
            {
                args.IsValid = false;
            }
        }
        private bool StepEndFinish()
        {
            lblError.Visible = false;
            lblError2.Visible = false;
            int companyId = Int32.Parse(hdfCompanyId.Value);

            if (ValidateStepEnd())
            {
                if (cbxEndConfirm.Checked)
                {
                    // Review all times
                    if (rbtnBeginTemplate.Checked)
                    {
                        if (grdProjectTime.Rows.Count > 0)
                        {
                            foreach (GridViewRow row in grdProjectTime.Rows)
                            {
                                if ((row.RowType == DataControlRowType.DataRow) && ((row.RowState == DataControlRowState.Normal) || (row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate))))
                                {
                                    ProjectTimeGateway projectTimeGatewayForVerify = new ProjectTimeGateway();
                                    int employeeId = 0; if (((HiddenField)row.FindControl("hdfEmployeeId")).Value.Trim() != "") employeeId = Int32.Parse(((HiddenField)row.FindControl("hdfEmployeeId")).Value.Trim());

                                    DateTime date_ = DateTime.Parse(tbxDate.Text);
                                    string startTime = ""; if (((TextBox)row.FindControl("tbxStartTime")).Text.Trim() != "") startTime = ((TextBox)row.FindControl("tbxStartTime")).Text.Trim();

                                    string endTime = ""; if (((TextBox)row.FindControl("tbxEndTime")).Text.Trim() != "") endTime = ((TextBox)row.FindControl("tbxEndTime")).Text.Trim();

                                    // Verify if the time not exists at DB
                                    if (projectTimeGatewayForVerify.NotExistsByEmployeIdDate_StartTimeEndTime(employeeId, date_, startTime, endTime, companyId))
                                    {
                                        // Verify Job Class
                                        EmployeeGateway employee = new EmployeeGateway();
                                        employee.LoadByEmployeeId(employeeId);
                                        string jobClass = employee.GetJobClassType(employeeId);

                                        if (jobClass == "")
                                        {
                                            lblError2.Visible = true;
                                            lblError2.Text = lblError2.Text + ((TextBox)row.FindControl("tbxTeamMember")).Text.Trim() + ", ";
                                        }
                                    }
                                    else
                                    {
                                        lblError.Visible = true;
                                        lblError.Text = lblError.Text + ((TextBox)row.FindControl("tbxTeamMember")).Text.Trim() + ", ";
                                    }
                                }
                            }
                        }
                    }
                }

                if ((lblError.Visible)||(lblError2.Visible))
                {
                    return false;
                }
                else
                {
                    if (PostStepEndChanges(companyId))
                    {
                        UpdateDatabase();
                        return true;
                    }
                    else
                    {
                       return false;
                    }
                }
            }
            else
            {
                return false;
            }
        }