Ejemplo n.º 1
0
        /// <summary>
        /// Obtiene el detalle de las horas turno que se está configurando
        /// </summary>
        /// <returns>objeto de tipo DetalleHorasTurnoTarifaBO</returns>
        private DetalleHorasTurnoTarifaBO InterfazAHorasTurnoPeriodoTarifarioPSLBO()
        {
            DetalleHorasTurnoTarifaBO horasTurno = new DetalleHorasTurnoTarifaBO()
            {
                TurnoTarifa = this.vista.TarifaTurno,
                Dia         = this.vista.MaximoHorasDia,
                Semana      = this.vista.MaximoHorasSemana,
                Mes         = this.vista.MaximoHorasMes,
                Auditoria   = new AuditoriaBO()
                {
                    UC = this.vista.UsuarioID, FC = DateTime.Now, UUA = this.vista.UsuarioID, FUA = DateTime.Now
                }
            };

            return(horasTurno);
        }
        protected void grvTurnos_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    DetalleHorasTurnoTarifaBO horasTurno = (DetalleHorasTurnoTarifaBO)e.Row.DataItem;

                    #region Agregar el nombre del turno a la tabla
                    Label labelTurno = e.Row.FindControl("lblTurno") as Label;
                    if (labelTurno != null)
                    {
                        string tipoAutorizacion = string.Empty;
                        if (horasTurno.TurnoTarifa != null)
                        {
                            switch (this.UnidadOperativaID)
                            {
                            case (int)ETipoEmpresa.Generacion:
                            case (int)ETipoEmpresa.Construccion:
                            case (int)ETipoEmpresa.Equinova:
                                Type type = this.UnidadOperativaID == (int)ETipoEmpresa.Construccion ? typeof(ETarifaTurnoConstruccion) :
                                            this.UnidadOperativaID == (int)ETipoEmpresa.Generacion ? typeof(ETarifaTurnoGeneracion) : typeof(ETarifaTurnoEquinova);
                                var memInfo = type.GetMember(type.GetEnumName(horasTurno.TurnoTarifa));
                                var display = memInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false).FirstOrDefault() as DescriptionAttribute;
                                if (display != null)
                                {
                                    tipoAutorizacion = display.Description.ToUpper();
                                }
                                break;
                            }
                        }
                        labelTurno.Text = tipoAutorizacion.Replace("_", " ");
                    }
                    #endregion

                    if (this.EsModoEdicion != null)
                    {
                        var boton = e.Row.FindControl("ibtEliminar") as ImageButton;
                        if (boton != null)
                        {
                            boton.Enabled = this.EsModoEdicion.Value;
                        }
                    }
                }
            } catch (Exception ex) {
                throw new Exception(this.nombreClase + ".grvTurnos_RowDataBound: Inconsistencias al agregar los Rangos: " + ex.Message);
            }
        }