Ejemplo n.º 1
0
        public void FromRow(Lbl.IElementoDeDatos row)
        {
            // Si todavía no conozco el tipo de elemento de este formulario, lo tomo de row
            if (this.ElementoTipo == null || this.ElementoTipo == typeof(Lbl.ElementoDeDatos))
            {
                this.ElementoTipo = row.GetType();
            }

            this.ReadOnly   = true;
            this.Connection = row.Connection;
            this.Elemento   = row;

            if (this.Encabezado.Visible && this.Encabezado.DisplayStyle.Icon == null)
            {
                if (this.Elemento.Existe)
                {
                    this.StockImage = "editar";
                }
                else
                {
                    this.StockImage = "crear";
                }
            }

            bool PuedeVerHistorial = Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(this.Elemento, Lbl.Sys.Permisos.Operaciones.Administrar) || Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(typeof(Lbl.Sys.Log.Entrada), Lbl.Sys.Permisos.Operaciones.Ver);

            this.PanelAccionesTerciarias.FormActions["historial"].Visibility   = (this.Elemento.Existe && PuedeVerHistorial) ? Lazaro.Pres.Forms.FormActionVisibility.Tertiary : Lazaro.Pres.Forms.FormActionVisibility.Hidden;
            this.PanelAccionesTerciarias.FormActions["comentarios"].Visibility = this.Elemento.Existe ? Lazaro.Pres.Forms.FormActionVisibility.Tertiary : Lazaro.Pres.Forms.FormActionVisibility.Hidden;

            Lbl.Atributos.Presentacion AttrMuestraPanel = this.ElementoTipo.GetAttribute <Lbl.Atributos.Presentacion>();
            if (AttrMuestraPanel != null)
            {
                EntradaComentarios.Visible = this.Elemento.Existe;
                MuestraPanel = AttrMuestraPanel.PanelExtendido;
                this.PanelAccionesTerciarias.FormActions["panelextendido"].Visibility = (MuestraPanel != Lbl.Atributos.PanelExtendido.Nunca) ? Lazaro.Pres.Forms.FormActionVisibility.Tertiary : Lazaro.Pres.Forms.FormActionVisibility.Hidden;
            }

            if (this.ControlUnico != null)
            {
                this.ControlUnico.FromRow(row);
                if (this.MuestraPanel != Lbl.Atributos.PanelExtendido.Nunca)
                {
                    if (row is Lbl.IElementoConImagen)
                    {
                        EntradaImagen.Elemento = row;
                        EntradaImagen.ActualizarControl();
                        EntradaImagen.Visible = true;
                    }
                    else
                    {
                        EntradaImagen.Visible = false;
                    }

                    EntradaComentarios.Elemento = row;
                    EntradaTags.Elemento        = row;

                    EntradaComentarios.ActualizarControl();
                    EntradaTags.ActualizarControl();

                    if (MuestraPanel == Lbl.Atributos.PanelExtendido.Siempre)
                    {
                        PanelExtendido.Show();
                    }
                }
            }

            Lbl.Atributos.Nomenclatura Attr = this.ElementoTipo.GetAttribute <Lbl.Atributos.Nomenclatura>();
            if (row != null && row.Existe)
            {
                if (Attr != null && Attr.PrefijarNombreConTipo)
                {
                    this.Text = Attr.NombreSingular + " " + row.ToString();
                }
                else
                {
                    this.Text = row.ToString();
                }
            }
            else
            {
                if (Attr != null)
                {
                    this.Text = "Creando " + Attr.NombreSingular.ToLowerInvariant();
                }
                else
                {
                    this.Text = "Creando " + row.GetType().ToString();
                }
            }

            this.ReadOnly = !this.PuedeEditar();

            this.PanelAccionesPrimariasYSecundarias.FormActions["imprimir"].Visibility = this.PuedeImprimir() ? Lazaro.Pres.Forms.FormActionVisibility.Main : Lazaro.Pres.Forms.FormActionVisibility.Hidden;
            this.ActualizarFormActions();
            this.SetControlsChanged(this.Controls, false);
        }
Ejemplo n.º 2
0
                public void FromRow(Lbl.IElementoDeDatos row)
                {
                        // Si todavía no conozco el tipo de elemento de este formulario, lo tomo de row
                        if (this.ElementoTipo == null || this.ElementoTipo == typeof(Lbl.ElementoDeDatos))
                                this.ElementoTipo = row.GetType();

                        this.ReadOnly = true;
                        this.Connection = row.Connection;
                        this.Elemento = row;

                        if (this.Encabezado.Visible && this.Encabezado.DisplayStyle.Icon == null) {
                                if (this.Elemento.Existe)
                                        this.StockImage = "editar";
                                else
                                        this.StockImage = "crear";
                        }

                        bool PuedeVerHistorial = Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(this.Elemento, Lbl.Sys.Permisos.Operaciones.Administrar) || Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(typeof(Lbl.Sys.Log.Entrada), Lbl.Sys.Permisos.Operaciones.Ver);
                        this.PanelAccionesTerciarias.FormActions["historial"].Visibility = (this.Elemento.Existe && PuedeVerHistorial) ? Lazaro.Pres.Forms.FormActionVisibility.Tertiary : Lazaro.Pres.Forms.FormActionVisibility.Hidden;
                        this.PanelAccionesTerciarias.FormActions["comentarios"].Visibility = this.Elemento.Existe ? Lazaro.Pres.Forms.FormActionVisibility.Tertiary : Lazaro.Pres.Forms.FormActionVisibility.Hidden;

                        Lbl.Atributos.Presentacion AttrMuestraPanel = this.ElementoTipo.GetAttribute<Lbl.Atributos.Presentacion>();
                        if (AttrMuestraPanel != null) {
                                EntradaComentarios.Visible = this.Elemento.Existe;
                                MuestraPanel = AttrMuestraPanel.PanelExtendido;
                                this.PanelAccionesTerciarias.FormActions["panelextendido"].Visibility = (MuestraPanel != Lbl.Atributos.PanelExtendido.Nunca) ? Lazaro.Pres.Forms.FormActionVisibility.Tertiary : Lazaro.Pres.Forms.FormActionVisibility.Hidden;
                        }

                        if (this.ControlUnico != null) {
                                this.ControlUnico.FromRow(row);
                                if (this.MuestraPanel != Lbl.Atributos.PanelExtendido.Nunca) {
                                        if (row is Lbl.IElementoConImagen) {
                                                EntradaImagen.Elemento = row;
                                                EntradaImagen.ActualizarControl();
                                                EntradaImagen.Visible = true;
                                        } else {
                                                EntradaImagen.Visible = false;
                                        }

                                        EntradaComentarios.Elemento = row;
                                        EntradaTags.Elemento = row;

                                        EntradaComentarios.ActualizarControl();
                                        EntradaTags.ActualizarControl();

                                        if (MuestraPanel == Lbl.Atributos.PanelExtendido.Siempre)
                                                PanelExtendido.Show();
                                }
                        }

                        Lbl.Atributos.Nomenclatura Attr = this.ElementoTipo.GetAttribute<Lbl.Atributos.Nomenclatura>();
                        if (row != null && row.Existe) {
                                if (Attr != null && Attr.PrefijarNombreConTipo)
                                        this.Text = Attr.NombreSingular + " " + row.ToString();
                                else
                                        this.Text = row.ToString();
                        } else {
                                if (Attr != null)
                                        this.Text = "Creando " + Attr.NombreSingular.ToLowerInvariant();
                                else
                                        this.Text = "Creando " + row.GetType().ToString();
                        }

                        this.ReadOnly = !this.PuedeEditar();

                        this.PanelAccionesPrimariasYSecundarias.FormActions["imprimir"].Visibility = this.PuedeImprimir() ? Lazaro.Pres.Forms.FormActionVisibility.Main : Lazaro.Pres.Forms.FormActionVisibility.Hidden;
                        this.ActualizarFormActions();
                        this.SetControlsChanged(this.Controls, false);
                }