Ejemplo n.º 1
0
 public Field(string name, string label, Lfx.Data.InputFieldTypes dataType, int width)
     : this(name, label, dataType)
 {
     this.Width = width;
     if (this.Width < 28)
     {
         this.Visible   = false;
         this.Printable = false;
     }
 }
Ejemplo n.º 2
0
 public Field(string name, string label, Lfx.Data.InputFieldTypes dataType, int width, string format)
     : this(name, label, dataType, width)
 {
     this.Format = format;
 }
Ejemplo n.º 3
0
        public Tag(Connection dataBase, string tableName, Lfx.Data.Row fromRow)
        {
            this.DataBase  = dataBase;
            this.TableName = tableName;
            this.Id        = System.Convert.ToInt32(fromRow["id_tag"]);
            this.FieldName = fromRow["fieldname"].ToString();
            this.Label     = fromRow["label"].ToString();
            if (fromRow["extra"] != null)
            {
                this.Extra = fromRow["extra"].ToString();
            }
            string FldType = fromRow["fieldtype"].ToString();

            switch (FldType)
            {
            case "relation":
                this.FieldType = DbTypes.Integer;
                string[] RelationFields = this.Extra.Split(new char[] { ',' });
                string   ReferenceTable = RelationFields[0], ReferenceColumn, DetailColumn;

                if (RelationFields.Length >= 2)
                {
                    ReferenceColumn = RelationFields[1];
                }
                else
                {
                    ReferenceColumn = dataBase.Tables[ReferenceTable].PrimaryKey;
                }

                if (RelationFields.Length >= 3)
                {
                    DetailColumn = RelationFields[2];
                }
                else
                {
                    DetailColumn = "nombre";
                }

                this.Relation = new Relation(this.FieldName, ReferenceTable, ReferenceColumn, DetailColumn);

                if (RelationFields.Length >= 4)
                {
                    LblType = RelationFields[3];
                }
                else
                {
                    LblType = null;
                }
                break;

            default:
                this.FieldType = Lfx.Data.Types.FromSqlType(FldType);
                break;
            }

            if (fromRow["inputtype"] != null && fromRow["inputtype"].ToString() != string.Empty)
            {
                this.InputFieldType = (Lfx.Data.InputFieldTypes)(Enum.Parse(typeof(Lfx.Data.InputFieldTypes), fromRow["inputtype"].ToString()));
            }

            this.Nullable     = System.Convert.ToBoolean(fromRow["fieldnullable"]);
            this.Internal     = System.Convert.ToBoolean(fromRow["internal"]);
            this.Access       = System.Convert.ToInt32(fromRow["access"]);
            this.DefaultValue = fromRow["fielddefault"];
            if (this.DefaultValue is DBNull)
            {
                this.DefaultValue = null;
            }
        }
Ejemplo n.º 4
0
                public Tag(Connection dataBase, string tableName, Lfx.Data.Row fromRow)
                {
                        this.DataBase = dataBase;
                        this.TableName = tableName;
                        this.Id = System.Convert.ToInt32(fromRow["id_tag"]);
                        this.FieldName = fromRow["fieldname"].ToString();
                        this.Label = fromRow["label"].ToString();
                        if (fromRow["extra"] != null)
                                this.Extra = fromRow["extra"].ToString();
                        string FldType = fromRow["fieldtype"].ToString();
                        switch(FldType) {
                                case "relation":
                                        this.FieldType = DbTypes.Integer;
                                        string[] RelationFields = this.Extra.Split(new char[] { ',' });
                                        string ReferenceTable = RelationFields[0], ReferenceColumn, DetailColumn;
                                        
                                        if(RelationFields.Length >= 2)
                                                ReferenceColumn = RelationFields[1];
                                        else
                                                ReferenceColumn = dataBase.Tables[ReferenceTable].PrimaryKey;

                                        if(RelationFields.Length >= 3)
                                                DetailColumn = RelationFields[2];
                                        else
                                                DetailColumn = "nombre";

                                        this.Relation = new Relation(this.FieldName, ReferenceTable, ReferenceColumn, DetailColumn);

                                        if (RelationFields.Length >= 4)
                                                LblType = RelationFields[3];
                                        else
                                                LblType = null;
                                        break;
                                default:
                                        this.FieldType = Lfx.Data.Types.FromSqlType(FldType);
                                        break;
                        }

                        if (fromRow["inputtype"] != null && fromRow["inputtype"].ToString() != string.Empty)
                                this.InputFieldType = (Lfx.Data.InputFieldTypes)(Enum.Parse(typeof(Lfx.Data.InputFieldTypes), fromRow["inputtype"].ToString()));
                                                
                        this.Nullable = System.Convert.ToBoolean(fromRow["fieldnullable"]);
                        this.Internal = System.Convert.ToBoolean(fromRow["internal"]);
                        this.Access = System.Convert.ToInt32(fromRow["access"]);
                        this.DefaultValue = fromRow["fielddefault"];
                        if (this.DefaultValue is DBNull)
                                this.DefaultValue = null;

                }
Ejemplo n.º 5
0
 public Field(string name, string label, Lfx.Data.InputFieldTypes dataType, int width, bool sorteable)
     : this(name, label, dataType, width)
 {
     this.Sorteable = sorteable;
 }