/// <summary> /// Actualiza el control con los datos del elemento. /// </summary> public override void ActualizarControl() { Lazaro.Pres.Forms.Section Sect = new Lazaro.Pres.Forms.Section("Campos adicionales"); this.Tabla = Lfx.Workspace.Master.Tables[m_Elemento.TablaDatos]; //Tabla.Connection = this.Connection; if (Tabla.Tags != null) { foreach (Lfx.Data.Tag Tg in Tabla.Tags) { if (Tg.Internal == false) { Lazaro.Pres.Field Fld = new Lazaro.Pres.Field(Tg.FieldName, Tg.Label, Tg.InputFieldType); if (string.IsNullOrEmpty(Tg.LblType) == false) { Fld.LblType = Lbl.Instanciador.InferirTipo(Tg.LblType); } if (Tg.Access > 0) { Lbl.Sys.Permisos.Operaciones Oper = (Lbl.Sys.Permisos.Operaciones)(Tg.Access); if (Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(m_Elemento, Oper) == false) { Fld.ReadOnly = true; } } Fld.Relation = Tg.Relation; Sect.Fields.Add(Fld); } } } this.FromSection(Sect); base.ActualizarControl(); }
/// <summary> /// Actualiza el control con los datos del elemento. /// </summary> public override void ActualizarControl() { Lazaro.Pres.Forms.Section Sect = new Lazaro.Pres.Forms.Section("Campos adicionales"); this.Tabla = m_Elemento.Connection.Tables[m_Elemento.TablaDatos]; Tabla.Connection = this.Connection; if (Tabla.Tags != null) { foreach (Lfx.Data.Tag Tg in Tabla.Tags) { if (Tg.Internal == false) { Lazaro.Pres.Field Fld = new Lazaro.Pres.Field(Tg.FieldName, Tg.Label, Tg.InputFieldType); if (string.IsNullOrEmpty(Tg.LblType) == false) { Fld.LblType = Lbl.Instanciador.InferirTipo(Tg.LblType); } if (Tg.Access > 0) { Lbl.Sys.Permisos.Operaciones Oper = (Lbl.Sys.Permisos.Operaciones)(Tg.Access); if (Lbl.Sys.Config.Actual.UsuarioConectado.TienePermiso(m_Elemento, Oper) == false) { Fld.ReadOnly = true; } } Fld.Relation = Tg.Relation; Sect.Fields.Add(Fld); } } } this.FromSection(Sect); base.ActualizarControl(); }
public void FromSection(Lazaro.Pres.Forms.Section section) { this.EliminarCampos(); this.Text = section.Label; foreach (Lazaro.Pres.Field Fld in section.Fields) { Lui.Forms.EditableControl Ctrl; switch (Fld.DataType) { case Lfx.Data.InputFieldTypes.Bool: Lui.Forms.YesNo BoolField = new Lui.Forms.YesNo(); //BoolField.SetData = new string[] { "Sí|1", "No|0" }; //BoolField.AlwaysExpanded = false; //BoolField.AutoSize = false; BoolField.Value = m_Elemento.GetFieldValue <bool>(Fld.Name); Ctrl = BoolField; break; case Lfx.Data.InputFieldTypes.Set: Lui.Forms.ComboBox SetField = new Lui.Forms.ComboBox(); SetField.FromDictionary(Fld.SetValues); SetField.TextKey = m_Elemento.GetFieldValue <string>(Fld.Name); SetField.AlwaysExpanded = true; SetField.AutoSize = true; Ctrl = SetField; break; case Lfx.Data.InputFieldTypes.Relation: Entrada.CodigoDetalle RelationField = new Entrada.CodigoDetalle(); RelationField.Relation = Fld.Relation; RelationField.ValueInt = m_Elemento.GetFieldValue <int>(Fld.Name); RelationField.PlaceholderText = Fld.Label; RelationField.Required = false; RelationField.ElementoTipo = Fld.LblType; Ctrl = RelationField; break; default: Lui.Forms.TextBox TextField = new Lui.Forms.TextBox(); switch (Fld.DataType) { case Lfx.Data.InputFieldTypes.Currency: TextField.DataType = Lui.Forms.DataTypes.Currency; TextField.ValueDecimal = m_Elemento.GetFieldValue <decimal>(Fld.Name); break; case Lfx.Data.InputFieldTypes.Date: TextField.DataType = Lui.Forms.DataTypes.Date; TextField.Text = m_Elemento.GetFieldValue <DateTime>(Fld.Name).ToString(Lfx.Types.Formatting.DateTime.ShortDatePattern); break; case Lfx.Data.InputFieldTypes.DateTime: TextField.DataType = Lui.Forms.DataTypes.DateTime; TextField.Text = m_Elemento.GetFieldValue <DateTime>(Fld.Name).ToString(Lfx.Types.Formatting.DateTime.FullDateTimePattern); break; case Lfx.Data.InputFieldTypes.Numeric: TextField.DataType = Lui.Forms.DataTypes.Float; TextField.ValueDecimal = m_Elemento.GetFieldValue <decimal>(Fld.Name); break; case Lfx.Data.InputFieldTypes.Integer: TextField.DataType = Lui.Forms.DataTypes.Integer; TextField.ValueInt = m_Elemento.GetFieldValue <int>(Fld.Name); break; case Lfx.Data.InputFieldTypes.Text: TextField.Text = m_Elemento.GetFieldValue <string>(Fld.Name); break; case Lfx.Data.InputFieldTypes.Memo: TextField.MultiLine = true; TextField.Size = new Size(this.FieldContainer.ClientSize.Width, 72); TextField.Text = m_Elemento.GetFieldValue <string>(Fld.Name); break; } TextField.PlaceholderText = Fld.Label; Ctrl = TextField; break; } Ctrl.ReadOnly = Fld.ReadOnly; if (Ctrl.Size == System.Drawing.Size.Empty) { Ctrl.Size = new Size(this.FieldContainer.ClientSize.Width, 24); } Ctrl.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Top; Ctrl.FieldName = Fld.Name; this.AgregarCampo(Fld.Label, Ctrl); } }