//Listing 7-7. Performing screen-level validation
 partial void Issue_Validate(ScreenValidationResultsBuilder results)
 {
     if (this.Issue.Priority == null)
     {
         results.AddPropertyError("Priority must be entered");
     }
 }
        partial void Orders_Validate(ScreenValidationResultsBuilder results)
        {
            /*
             * This is where the business logic would have gone
             * Compare this code to the code in OrderScreenValidationController.ValidateOrders
             *
             * foreach (var o in this.Orders)
             * {
             *  if (o.Customer == null)
             *      results.AddPropertyError("An order requires a customer.");
             *
             *  if (o.Customer == null)
             *      results.AddPropertyError("An order requires a product.");
             *
             *  if (o.Product != null && !o.Product.Available)
             *      results.AddPropertyError(o.Product.Name + " is not available to order.");
             * }
             */
            var controller = new OrderScreenValidationController(this);

            IEnumerable <string> errorMessages;

            if (!controller.ValidateOrders(out errorMessages))
            {
                foreach (var error in errorMessages)
                {
                    results.AddPropertyError(error);
                }
            }
        }
Esempio n. 3
0
 //<Snippet1>
 partial void CityCode_Validate
     (ScreenValidationResultsBuilder results)
 {
     if (this.CityCode.Length < 3)
     {
         results.AddPropertyError("This string must have at least 3 letters.");
     }
 }
        partial void Division_Gerencia_Validate(ScreenValidationResultsBuilder results)
        {
            // results.AddPropertyError("<Mensaje de error>");
            try
            {
                if (this.GerenciaGeneral.First().Nombre != "GERENCIA GENERAL")
                {
                    results.AddPropertyError("No se puede cambiar el nombre de la 'GERENCIA GENERAL'");

                }
            }
            catch { }
        }
 partial void NuevoComentarioRechazar_Validate(ScreenValidationResultsBuilder results)
 {
     // results.AddPropertyError("<Mensaje de error>");
     if (this.NuevoComentarioRechazar != null)
     {
         if (this.NuevoComentarioRechazar.Length > 100) { results.AddPropertyError("<El comentario no debe pasar los 100 caracteres>"); }
     }
 }
        partial void Persona_Validate(ScreenValidationResultsBuilder results)
        {
            try
            {
                this.Persona.Rut_Persona = this.RUN + '-' + this.Dig_Verificador;
                this.Persona.Email = this.Email;
            
                if (this.Persona.CargoRolPrivadoItem == null)
                {
                    this.IDAREA = null;
                    this.IDSUBGERENCIA = null;
                    this.IDGERENCIA = null;

                    this.ES_JEFE_DE_AREA = false;
                    this.ES_SUBGERENTE = false;
                    this.ES_GERENTE = false;
                }
                else
                {
                    if (this.Persona.CargoRolPrivadoItem.IDArea != null)
                    {
                        this.IDAREA = this.Persona.CargoRolPrivadoItem.IDArea;

                        if (this.Division_AreaItem.Division_SubGerenciaItem != null)
                        {
                            this.IDSUBGERENCIA = this.Division_AreaItem.Division_SubGerenciaItem.Id_SubGerencia;
                        }
                        else
                        {
                            this.IDSUBGERENCIA = null;
                        }

                        if (this.Division_AreaItem.Division_GerenciaItem != null)
                        {
                            this.IDGERENCIA = this.Division_AreaItem.Division_GerenciaItem.Id_Gerencia;
                        }
                        else

                            if (this.Division_AreaItem.Division_SubGerenciaItem.Division_GerenciaItem != null)
                            {
                                this.IDGERENCIA = this.Division_AreaItem.Division_SubGerenciaItem.Division_GerenciaItem.Id_Gerencia;
                            }

                        if (this.Persona.CargoRolPrivadoItem.EsJefeDeArea != true)
                        {
                            this.ES_JEFE_DE_AREA = false;
                            this.ES_SUBGERENTE = false;
                            this.ES_GERENTE = false;
                        }
                        else

                            if (this.Persona.CargoRolPrivadoItem.EsJefeDeArea == true)
                            {
                                this.ES_JEFE_DE_AREA = true;
                                this.ES_SUBGERENTE = false;
                                this.ES_GERENTE = false;

                                if (this.Division_AreaItem.Superior_JefeDirecto.First() != null)
                                {
                                    if (this.Division_AreaItem.Superior_JefeDirecto.First().PersonaItem1 != this.Persona)
                                    {
                                        results.AddPropertyError("No puede haber más de un jefe de área por área. " + this.Division_AreaItem.Superior_JefeDirecto.First().PersonaItem1.NombreAD + " es el actual jefe de área de " + this.Division_AreaItem.Nombre);
                                    }
                                }
                            }

                    }
                    else

                        if (this.Persona.CargoRolPrivadoItem.IDSubgerencia != null)
                        {
                            this.IDSUBGERENCIA = this.Persona.CargoRolPrivadoItem.IDSubgerencia;

                            this.IDGERENCIA = this.Division_SubGerenciaItem.Division_GerenciaItem.Id_Gerencia;

                            this.IDAREA = null;

                            if (this.Persona.CargoRolPrivadoItem.EsSubgerente == true)
                            {
                                this.ES_JEFE_DE_AREA = false;
                                this.ES_SUBGERENTE = true;
                                this.ES_GERENTE = false;

                                if (this.Division_SubGerenciaItem.Superior_SubGerente.First() != null)
                                {
                                    if (this.Division_SubGerenciaItem.Superior_SubGerente.First().PersonaItem1 != this.Persona)
                                    {
                                        results.AddPropertyError("No puede haber más de un subgerente por subgerencia. " + this.Division_SubGerenciaItem.Superior_SubGerente.First().PersonaItem1.NombreAD + " es el actual subgerente de " + this.Division_SubGerenciaItem.Nombre);
                                    }
                                }
                            }

                        }
                        else

                            if (this.Persona.CargoRolPrivadoItem.IDGerencia != null)
                            {
                                this.IDGERENCIA = this.Persona.CargoRolPrivadoItem.IDGerencia;

                                this.IDSUBGERENCIA = null;

                                this.IDAREA = null;

                                if (this.Persona.CargoRolPrivadoItem.EsGerente == true)
                                {
                                    this.ES_JEFE_DE_AREA = false;
                                    this.ES_SUBGERENTE = false;
                                    this.ES_GERENTE = true;

                                    if (this.Division_GerenciaItem.Superior_Gerente.First() != null)
                                    {
                                        if (this.Division_GerenciaItem.Superior_Gerente.First().PersonaItem1 != this.Persona)
                                        {
                                            results.AddPropertyError("No puede haber más de un gerente por gerencia. " + this.Division_GerenciaItem.Superior_Gerente.First().PersonaItem1.NombreAD + " es el actual gerente de " + this.Division_GerenciaItem.Nombre);
                                        }
                                    }
                                }
                            }
                }
            }
            catch { }
        }
        partial void Dig_Verificador_Validate(ScreenValidationResultsBuilder results) // validador de run
        {
            try
            {
                string rutAux = this.RUN; //control que contenga rut
                int suma = 0;
                try
                {
                    for (int x = rutAux.Length - 1; x >= 0; x--)
                        suma += int.Parse(char.IsDigit(rutAux[x]) ? rutAux[x].ToString() : "0") * (((rutAux.Length - (x + 1)) % 6) + 2);
                }
                catch { }
                int numericDigito = (11 - suma % 11);
                string digito = numericDigito == 11 ? "0" : numericDigito == 10 ? "K" : numericDigito.ToString();
                string Dig = digito;
                Regex expresion = new Regex("^([0-9]+-[0-9K])$");
                string dv = this.Dig_Verificador.ToUpper(); //control que contenga DV

                if (!expresion.IsMatch(rutAux) && dv != Dig)
                {
                    results.AddPropertyError("Run invalido");
                }
            }
            catch { }
        }
 //Valida que la justificacion(Observaciones) para Horas extras y permiso no sean vacias
 partial void OBSERVACIONES_Validate(ScreenValidationResultsBuilder results)
 {
     if (TIPOSOLICITUD == 3 || TIPOSOLICITUD == 4)
     {
         if (this.OBSERVACIONES == null) { results.AddPropertyError("La justificación no puede quedar vacía"); }
     }
 }
        //Validaciones para el campo requiere prestamo en las solicitudes de vacaciones
        partial void RequierePrestamo_Validate(ScreenValidationResultsBuilder results)
        {
            if (this.RequierePrestamo == false)
            {
                try
                {
                    this.FindControl("SOLICITUDESItemProperty_Prestamo1").IsEnabled = false;
                }
                catch { }

                if (TIPOSOLICITUD == 2)// si la solicitud es del tipo vacaciones
                {
                    this.SOLICITUD.Prestamo = null; //Limpiar el valor del campo prestamo
                }
            }
            else if (this.RequierePrestamo == true)
            {
                try
                {
                    this.FindControl("SOLICITUDESItemProperty_Prestamo1").IsEnabled = true;

                    if (this.SOLICITUD.Prestamo == null)
                    {
                        //Si la casilla es verdadera, el campo debe tener algún valor
                        results.AddPropertyError("El préstamo a solicitar no puede ser vacío"); 
                    }
                }
                catch { }
            }
        }
Esempio n. 10
0
        partial void SOLICITUD_Validate(ScreenValidationResultsBuilder results)
        {
            if (InvocarSaldoVacaciones == true) 
            { 
                this.ConsultarSaldo_Execute();
                InvocarSaldoVacaciones = false;
            }
                
            if (TIPOSOLICITUD == 2)// si la solicitud es del tipo vacaciones
            {
                this.NUEVOESTADO.Observaciones = this.OBSERVACIONES;

                //Valida el campo solo si se le ha ingresado un valor
                if (this.SOLICITUD.Prestamo.HasValue)
                {
                    if (this.SOLICITUD.Prestamo.Value < 0 || this.SOLICITUD.Prestamo.Value > 50)
                    {
                        results.AddPropertyError("El prestamo debe ser entre 0 y 50");
                    }
                }

                
                //GUARDAR LOS REGISTROS DE FERIADOS EN UN ARREGLO

                DateTime[] FERIADOS = new DateTime[100];//DateTime[] FERIADOS = new DateTime[] { };
                int dia; int mes; int año; int i = 0;

                foreach (FeriadosItem feriado in this.Feriados)
                {
                    dia = feriado.Feriado.Day;
                    mes = feriado.Feriado.Month;
                    año = feriado.Feriado.Year;
                    //DateTime DiaAux = new DateTime(DateTime.Today.Year, mes, dia);//Cambia el año del registro al año actual
                    DateTime DiaAux = new DateTime(año, mes, dia);
                    FERIADOS[i] = DiaAux;
                    i++;
                }

                //Validar que las fechas de inicio y terminio no sean feriados ni fin de semanas
                foreach (DateTime feriado in FERIADOS)
                {
                    if (this.SOLICITUD.Inicio.Value == feriado)
                    {
                        results.AddPropertyError("La fecha de inicio no puede ser un día feriado ");
                    }

                    if (this.SOLICITUD.Termino.Value == feriado)
                    {

                        results.AddPropertyError("La fecha de término no puede ser un día feriado ");
                    }
                }

                if (this.SOLICITUD.Inicio.Value.DayOfWeek == DayOfWeek.Saturday || this.SOLICITUD.Inicio.Value.DayOfWeek == DayOfWeek.Sunday)
                {
                    results.AddPropertyError("La fecha de inicio no puede ser fin de semana ");
                }

                if (this.SOLICITUD.Termino.Value.DayOfWeek == DayOfWeek.Saturday || this.SOLICITUD.Termino.Value.DayOfWeek == DayOfWeek.Sunday)
                {
                    results.AddPropertyError("La fecha de término no puede ser fin de semana ");
                }

                if(this.SOLICITUD.Inicio > this.SOLICITUD.Termino){
                    results.AddPropertyError("Día de Término debe ser después o igual al día de Inicio ");
                }else{ 
                    this.SOLICITUD.DiasSolicitados = BusinessDaysUntil(this.SOLICITUD.Inicio.Value, this.SOLICITUD.Termino.Value, FERIADOS);
                }

                if (this.SOLICITUD.Inicio <= DateTime.Today)
                {
                    results.AddPropertyError("Día de Inicio debe ser después hoy");
                }

                if (this.SOLICITUD.DiasSolicitados > this.SOLICITUD.SaldoDias)
                {
                    results.AddPropertyError("El número de días a solicitar debe ser menor o igual a tu SALDO DE DÍAS");
                }

            }

            if (TIPOSOLICITUD == 3)// si la solicitud es del tipo horas extras
            {
                if (this.SOLICITUD.TaxiBoolean == true)
                {
                    this.SOLICITUD.Taxi = "Sí";
                }
                else
                {
                    this.SOLICITUD.Taxi = "No";
                }

                if (this.SOLICITUD.ColacionBoolean == true)
                {
                    this.SOLICITUD.Colacion = "Sí";
                }
                else
                {
                    this.SOLICITUD.Colacion = "No";
                }

                this.NUEVOESTADO.Observaciones = this.OBSERVACIONES;
                this.SOLICITUD.ColacionBoolean = this.COLACION;
                this.SOLICITUD.TaxiBoolean = this.TAXI;

                if (this.SOLICITUD.HorasAutorizadas > 2)
                {
                    results.AddPropertyError("El máximo de horas extras a trabajar es 2");

                }
                else { this.SOLICITUD.HorasAutorizadas = this.SOLICITUD.HorasAutorizadas; }

                if (this.SOLICITUD.HorasAutorizadas <= 0 || this.SOLICITUD.HorasAutorizadas == null)
                {
                    results.AddPropertyError("Las horas autorizadas deben ser mayor a 0");
                }
                else { this.SOLICITUD.HorasAutorizadas = this.SOLICITUD.HorasAutorizadas; }

                if (this.SOLICITUD.Inicio < DateTime.Today)
                {
                    results.AddPropertyError("La fecha de realización no puede ser antes de hoy");
                }

                if (this.SOLICITUD.PersonaItem1 == null)
                {
                    results.AddPropertyError("Debe seleccionar un empleado");
                }

                //if (COLACION == true) { this.SOLICITUDESItemProperty.Colacion = true; } else { this.SOLICITUDESItemProperty.Colacion = false; }
                //if (TAXI == true) { this.SOLICITUDESItemProperty.Taxi = true; } else { this.SOLICITUDESItemProperty.Taxi = false; }

            }

            if (TIPOSOLICITUD == 4)// si la solicitud es del tipo permiso
            {
                if (this.SOLICITUD.ConDescuentoBoolean == true)
                {
                    this.SOLICITUD.ConDescuento = "Sí";
                }
                else
                {
                    this.SOLICITUD.ConDescuento = "No";
                }

                this.NUEVOESTADO.Observaciones = this.OBSERVACIONES;

                //GUARDAR LOS REGISTROS DE FERIADOS EN UN ARREGLO

                DateTime[] FERIADOS = new DateTime[50];//DateTime[] FERIADOS = new DateTime[] { };
                int dia; int mes; int año; int i = 0;

                foreach (FeriadosItem feriado in this.Feriados)
                {
                    dia = feriado.Feriado.Day;
                    mes = feriado.Feriado.Month;
                    año = feriado.Feriado.Year;
                    //DateTime DiaAux = new DateTime(DateTime.Today.Year, mes, dia);//Cambia el año del registro al año actual
                    DateTime DiaAux = new DateTime(año, mes, dia);
                    FERIADOS[i] = DiaAux;

                    i++;

                }

                //Validar que las fechas de inicio y terminio no sean feriados ni fin de semanas
                foreach (DateTime feriado in FERIADOS)
                {
                    if (this.SOLICITUD.Inicio.Value == feriado)
                    {
                        results.AddPropertyError("La fecha de inicio no puede ser un día feriado ");
                    }

                    if (this.SOLICITUD.Termino.Value == feriado)
                    {

                        results.AddPropertyError("La fecha de término no puede ser un día feriado ");
                    }
                }

                if (this.SOLICITUD.Inicio.Value.DayOfWeek == DayOfWeek.Saturday || this.SOLICITUD.Inicio.Value.DayOfWeek == DayOfWeek.Sunday)
                {
                    results.AddPropertyError("La fecha de inicio no puede ser fin de semana ");
                }

                if (this.SOLICITUD.Termino.Value.DayOfWeek == DayOfWeek.Saturday || this.SOLICITUD.Termino.Value.DayOfWeek == DayOfWeek.Sunday)
                {
                    results.AddPropertyError("La fecha de término no puede ser fin de semana ");
                }

                if (this.SOLICITUD.Inicio < DateTime.Today)
                {

                    results.AddPropertyError("La fecha de inicio no puede ser antes de hoy");
                }


                if (this.SOLICITUD.Termino < this.SOLICITUD.Inicio)
                {

                    results.AddPropertyError("La fecha de término debe ser después de la fecha de inicio");

                }else
                    {
                        //this.SOLICITUD.DiasSolicitados = BusinessDaysUntil(this.SOLICITUD.Inicio.Value, this.SOLICITUD.Termino.Value, FERIADOS);

                        this.SOLICITUD.DiasSolicitados = Math.Round((BusinessDaysUntil(this.SOLICITUD.Inicio.Value, this.SOLICITUD.Termino.Value, FERIADOS) - 1) + (ConvertHoursToTotalDays(this.SOLICITUD.Termino.Value.Hour - this.SOLICITUD.Inicio.Value.Hour)) + (ConvertMinutesToTotalDays(this.SOLICITUD.Termino.Value.Minute - this.SOLICITUD.Inicio.Value.Minute)), 2);

                        this.SOLICITUD.ddhhmmOTROPERMISO = "(" + (BusinessDaysUntil(this.SOLICITUD.Inicio.Value, this.SOLICITUD.Termino.Value, FERIADOS) - 1).ToString() + " Días, " + (this.SOLICITUD.Termino.Value.Hour - this.SOLICITUD.Inicio.Value.Hour).ToString() + " Horas, " + (this.SOLICITUD.Termino.Value.Minute - this.SOLICITUD.Inicio.Value.Minute).ToString() + " Minutos )";
                    }
            }

            if (TIPOSOLICITUD == 1)// si la solicitud es del tipo dia administrativo
            {
                //GUARDAR LOS REGISTROS DE FERIADOS EN UN ARREGLO

                DateTime[] FERIADOS = new DateTime[50];//DateTime[] FERIADOS = new DateTime[] { };
                int dia; int mes; int año; int i = 0;

                foreach (FeriadosItem feriado in this.Feriados)
                {
                    dia = feriado.Feriado.Day;
                    mes = feriado.Feriado.Month;
                    año = feriado.Feriado.Year;
                    //DateTime DiaAux = new DateTime(DateTime.Today.Year, mes, dia);//Cambia el año del registro al año actual
                    DateTime DiaAux = new DateTime(año, mes, dia);
                    FERIADOS[i] = DiaAux;
                    i++;
                }

                this.NUEVOESTADO.Observaciones = this.OBSERVACIONES;

                this.SOLICITUD.ConDescuentoBoolean = this.CONDESCUENTO;

                //Validar que las fechas de inicio y terminio no sean feriados ni fin de semanas
                foreach (DateTime feriado in FERIADOS)
                {
                    if (this.SOLICITUD.Inicio.Value == feriado)
                    { 
                        results.AddPropertyError("La fecha de inicio no puede ser un día feriado "); 
                    }

                    if (this.SOLICITUD.Termino.Value == feriado)
                    {
                        results.AddPropertyError("La fecha de término no puede ser un día feriado ");
                    }    
                }

                if (this.SOLICITUD.Inicio.Value.DayOfWeek == DayOfWeek.Saturday || this.SOLICITUD.Inicio.Value.DayOfWeek == DayOfWeek.Sunday)
                {
                    results.AddPropertyError("La fecha de inicio no puede ser fin de semana ");
                }

                if (this.SOLICITUD.Termino.Value.DayOfWeek == DayOfWeek.Saturday || this.SOLICITUD.Termino.Value.DayOfWeek == DayOfWeek.Sunday)
                {
                    results.AddPropertyError("La fecha de término no puede ser fin de semana ");
                }

                if (this.SOLICITUD.Inicio < DateTime.Today)
                {
                    results.AddPropertyError("La fecha de inicio no puede ser antes de hoy");
                }

                if (this.SOLICITUD.Termino < this.SOLICITUD.Inicio)
                {
                    results.AddPropertyError("Día de Término debe ser después o igual al día de Inicio ");
                }
                else
                {
                    if (this.AdministrativoDesde == "La tarde (Medio día)" && this.AdministrativoHasta == "La mañana (Medio día)")
                    {
                        this.SOLICITUD.DiasSolicitados = BusinessDaysUntil(this.SOLICITUD.Inicio.Value, this.SOLICITUD.Termino.Value, FERIADOS) - 1;
                    }
                    else if (this.AdministrativoDesde == "La mañana (Todo el día)" && this.AdministrativoHasta == "La tarde (Todo el día)")//ok
                    {
                        this.SOLICITUD.DiasSolicitados = BusinessDaysUntil(this.SOLICITUD.Inicio.Value, this.SOLICITUD.Termino.Value, FERIADOS);
                    }
                    else
                    {
                        this.SOLICITUD.DiasSolicitados = BusinessDaysUntil(this.SOLICITUD.Inicio.Value, this.SOLICITUD.Termino.Value, FERIADOS) - 0.5;
                    }
                }

                if (this.SOLICITUD.DiasSolicitados > this.SOLICITUD.SaldoDias)
                {
                    results.AddPropertyError("El número de días a solicitar debe ser menor o igual a tu saldo de días ");
                }

                if (this.SOLICITUD.DiasSolicitados <= 0)
                {
                    results.AddPropertyError("El número de días a solicitar debe ser mayor a 0");
                }
            }
        }
        partial void HORASTRABAJADAS_Validate(ScreenValidationResultsBuilder results)
        {
            
            // results.AddPropertyError("<Mensaje de error>");
            if (this.HORASTRABAJADAS <= 0 || this.HORASTRABAJADAS == null)
            {

                results.AddPropertyError("Horas trabajadas debe ser mayor a 0");
            }
            
        }
        partial void Solicitud_Detalle_OtroPermiso_Validate(ScreenValidationResultsBuilder results)
        {
            // results.AddPropertyError("<Mensaje de error>");

            if (TIPOSOLICITUD == 4)// si la solicitud es del tipo horas extras
            {

                if (this.Solicitud_Detalle_OtroPermiso.Inicio.Day <= DateTime.Today.Day)
                {

                    results.AddPropertyError("La fecha de inicio debe ser después de hoy");

                }

                if (this.Solicitud_Detalle_OtroPermiso.Termino < this.Solicitud_Detalle_OtroPermiso.Inicio)
                {

                    results.AddPropertyError("La fecha de término debe ser después de la fecha de inicio");

                }
            }
        }
        partial void Solicitud_Detalles_HorasExtras_Validate(ScreenValidationResultsBuilder results)
        {
            // results.AddPropertyError("<Mensaje de error>");

            if (TIPOSOLICITUD == 3)// si la solicitud es del tipo horas extras
            {

                if (this.Solicitud_Detalles_HorasExtras.HorasAutorizadas > 2)
                {

                    results.AddPropertyError("El máximo de horas extras a trabajar es 2");

                }

                if (this.Solicitud_Detalles_HorasExtras.HorasAutorizadas <= 0)
                {

                    results.AddPropertyError("Las horas autorizadas deben ser mayor a 0");

                }

                if (this.Solicitud_Detalles_HorasExtras.FechaRealizacion <= DateTime.Today)
                {

                    results.AddPropertyError("La fecha de realización debe ser después de hoy");

                }

                if (COLACIÓN == true) { this.Solicitud_Detalles_HorasExtras.Colacion = true; } else { this.Solicitud_Detalles_HorasExtras.Colacion = false; }
                if (TAXI == true) { this.Solicitud_Detalles_HorasExtras.Taxi = true;  } else { this.Solicitud_Detalles_HorasExtras.Taxi = false; }

            }

        }
        partial void Solicitud_Detalle_Vacaciones_Validate(ScreenValidationResultsBuilder results)
        {
            if (TIPOSOLICITUD == 2)// si la solicitud es del tipo vacaciones
            {

                if (InvocarSaldoVacaciones == true) { this.ConsultarSaldo_Execute(); }
                InvocarSaldoVacaciones = false;

                if (TIPOSOLICITUD == 2)// si la solicitud es del tipo vacaciones
                {
                    if (this.Solicitud_Detalle_Vacaciones.Prestamo.HasValue)
                    {
                        if (this.Solicitud_Detalle_Vacaciones.Prestamo.Value < 0 || this.Solicitud_Detalle_Vacaciones.Prestamo.Value > 50)
                        {
                            results.AddPropertyError("El prestamo debe ser entre 0 y 50");
                        }
                    }
                }

                //GUARDAR LOS REGISTROS DE FERIADOS EN UN ARREGLO

                DateTime[] FERIADOS = new DateTime[50];//DateTime[] FERIADOS = new DateTime[] { };
                int dia; int mes; int i = 0;

                foreach( FeriadosItem feriado in this.Feriados ){

                    dia = feriado.Feriado.Day;
                    mes = feriado.Feriado.Month;
                    DateTime DiaAux = new DateTime(DateTime.Today.Year, mes, dia);//Cambia el año del registro al año actual
                    FERIADOS[i] = DiaAux;
                
                    i++;
            
                }

                this.Solicitud_Detalle_Vacaciones.NumeroDias = BusinessDaysUntil(this.Solicitud_Detalle_Vacaciones.Inicio,this.Solicitud_Detalle_Vacaciones.Termino,FERIADOS);
            }
        }
        partial void CargoRolPrivadoItemProperty_Validate(ScreenValidationResultsBuilder results)
        {
            try
            {
                // results.AddPropertyError("<Mensaje de error>");
                if (this.CargoRolPrivadoItemProperty.EsGerente == true)
                {
                    //Desabilita los campos
                    this.FindControl("CargoRolPrivadoItemProperty_EsSubgerente").IsEnabled = false;
                    this.FindControl("CargoRolPrivadoItemProperty_EsJefeDeArea").IsEnabled = false;

                    this.FindControl("Subgerencia").IsEnabled = false;
                    this.FindControl("Área").IsEnabled = false;

                    this.FindControl("Gerencia").IsEnabled = true;

                    this.Área = null;//Limpia el campo área
                    this.Subgerencia = null;//Limpia el campo subgerencia

                    if (this.Gerencia == null)
                    {
                        results.AddPropertyError("Debe escoger una gerencia");
                    }

                    if (this.CargoRolPrivadoGerente.First() != this.CargoRolPrivadoItemProperty)//Error si ya existe otro cargo con la misma asignación de supervisión
                    {
                        if (this.CargoRolPrivadoGerente.Count() != 0)
                        {
                            results.AddPropertyError("Ya existe el cargo ' " + CargoRolPrivadoGerente.First().Nombre + " ' el cual tiene asignado 'es gerente' para ' " + this.Gerencia.Nombre + " '. No puede haber más de un cargo con la asignación de gerente para la misma gerencia.");
                        }
                    }
                }
                else

                    if (this.CargoRolPrivadoItemProperty.EsSubgerente == true)
                    {

                        //Desabilita los campos
                        this.FindControl("CargoRolPrivadoItemProperty_EsGerente").IsEnabled = false;
                        this.FindControl("CargoRolPrivadoItemProperty_EsJefeDeArea").IsEnabled = false;

                        this.FindControl("Gerencia").IsEnabled = false;
                        this.FindControl("Área").IsEnabled = false;

                        this.FindControl("Subgerencia").IsEnabled = true;

                        if (this.Subgerencia == null)
                        {
                            results.AddPropertyError("Debe escoger una subgerencia");
                        }

                        if (this.CargoRolPrivadoSubgerente.First() != this.CargoRolPrivadoItemProperty)//Error si ya existe otro cargo con la misma asignación de supervisión
                        {
                            if (this.CargoRolPrivadoSubgerente.Count() != 0)
                            {
                                results.AddPropertyError("Ya existe el cargo ' " + CargoRolPrivadoSubgerente.First().Nombre + " ' el cual tiene asignado 'es subgerente' para ' " + this.Subgerencia.Nombre + " '. No puede haber más de un cargo con la asignación de subgerente para la misma subgerencia.");
                            }
                        }

                        this.Área = null;//Limpia el campo área
                        this.Gerencia = this.Subgerencia.Division_GerenciaItem;//Muestra a que gerencia pertenece el área
                    }
                    else

                        if (this.CargoRolPrivadoItemProperty.EsJefeDeArea == true)
                        {
                            //Desabilita los campos
                            this.FindControl("CargoRolPrivadoItemProperty_EsGerente").IsEnabled = false;
                            this.FindControl("CargoRolPrivadoItemProperty_EsSubgerente").IsEnabled = false;

                            this.FindControl("Gerencia").IsEnabled = false;
                            this.FindControl("Subgerencia").IsEnabled = false;

                            this.FindControl("Área").IsEnabled = true;

                            if (this.Área == null)
                            {
                                results.AddPropertyError("Debe escoger una área");
                            }

                            if (this.CargoRolPrivadoJefedearea.First() != this.CargoRolPrivadoItemProperty)//Error si ya existe otro cargo con la misma asignación de supervisión
                            {
                                if (this.CargoRolPrivadoJefedearea.Count() != 0)
                                {
                                    results.AddPropertyError("Ya existe el cargo ' " + CargoRolPrivadoJefedearea.First().Nombre + " ' el cual tiene asignado 'es Jefe de área' para ' " + this.Área.Nombre + " '. No puede haber más de un cargo con la asignación de jefe de área para la misma área.");
                                }
                            }
                        }
            }
            catch { }
        }