protected void cvDuplicateMealsAllowanceFooter_ServerValidate(object source, ServerValidateEventArgs args)
        {
            int employeeId = Int32.Parse(hdfEmployeeID.Value);
            bool isMealsAllowance = false;// ((CheckBox)grdProjectTime.FooterRow.FindControl("ckbxMealsAllowanceFooter")).Checked;

            ProjectTimeTemp projectTimeTemp = new ProjectTimeTemp(projectTimeTDS);
            bool validMealsAllowance1 = projectTimeTemp.ValidateMealsAllowance(employeeId, isMealsAllowance);

            args.IsValid = true;

            int projectId = int.Parse(ddlProject.SelectedValue);

            if (projectId == 35 || projectId == 39 || projectId == 716)
            {
                if (isMealsAllowance)
                {
                    args.IsValid = false;
                    CustomValidator cvAlreadyRegisterdMealsAllowanceEdit = (CustomValidator)source;
                    cvAlreadyRegisterdMealsAllowanceEdit.ErrorMessage = "Please don't select meals allowance.";
                }
            }
            else
            {
                if (!validMealsAllowance1)
                {
                    args.IsValid = false;
                }
            }
        }
        protected void cvAlreadyRegisteredMealsAllowanceFooter_ServerValidate(object source, ServerValidateEventArgs args)
        {
            int companyId = Int32.Parse(hdfCompanyId.Value);
            int employeeId = Int32.Parse(hdfEmployeeID.Value);
            DateTime startDate = tkrdpStartDate.SelectedDate.Value;
            DateTime lastDate = tkrdpEndDate.SelectedDate.Value;
            bool isMealsAllowance = false;// ((CheckBox)grdProjectTime.FooterRow.FindControl("ckbxMealsAllowanceFooter")).Checked;
            string mealsCountry = ddlMealsCountry.SelectedValue;
            int projectTimeId = -1;
            args.IsValid = true;

            int projectId = int.Parse(ddlProject.SelectedValue);

            if (projectId == 35 || projectId == 39 || projectId == 716)
            {
                if (isMealsAllowance)
                {
                    args.IsValid = false;
                }
            }
            else
            {
                ProjectTimeTemp projectTimeTemp = new ProjectTimeTemp(projectTimeTDS);
                bool validMealsAllowance1 = projectTimeTemp.ValidateMealsAllowance(employeeId, isMealsAllowance);
                if (validMealsAllowance1)
                {
                    if ((mealsCountry != "-1") && (isMealsAllowance))
                    {
                        ProjectTimeGateway projectTimeGateway = new ProjectTimeGateway();
                        if (projectTimeId == -1)
                        {
                            if (projectTimeGateway.ExistsMealsAllowanceByEmployeIdDate(employeeId, startDate, companyId))
                            {
                                args.IsValid = false;
                            }
                        }
                        else
                        {
                            if (projectTimeGateway.ExistsMealsAllowanceByProjectTimeIdEmployeIdDate(projectTimeId, employeeId, startDate, companyId))
                            {
                                args.IsValid = false;
                            }
                        }
                    }
                }
            }
        }