コード例 #1
0
        public void LoadMapAttr(BP.Sys.MapAttr attr)
        {
            this.MaxLength = attr.MaxLen;
            this.AttrKey   = attr.KeyOfEn;
            this.ReadOnly  = !attr.UIIsEnable;

            this.Visible     = attr.UIVisible;
            this.DataHelpKey = attr.UIBindKey;

            switch (attr.MyDataType)
            {
            case DataType.AppInt:
            case DataType.AppFloat:
            case DataType.AppDouble:
                this.ShowType = TBType.Num;
                break;

            case DataType.AppDate:
                this.ShowType = TBType.Date;
                this.Attributes["onfocus"] = "WdatePicker();";
                break;

            case DataType.AppDateTime:
                this.ShowType = TBType.DateTime;
                this.Attributes["onfocus"] = "WdatePicker({dateFmt:'yyyy-MM-dd HH:mm'});";
                break;

            case DataType.AppMoney:
            case DataType.AppRate:
                this.ShowType = TBType.Moneny;
                break;

            case DataType.AppString:
                this.ShowType = TBType.TB;
                break;

            default:
                break;
            }
            this.PreRender += new System.EventHandler(this.TBPreRender);
        }
コード例 #2
0
        public void IntMapAttrs()
        {
            BP.Sys.MapData md = new BP.Sys.MapData();
            md.No = this.No;
            if (md.RetrieveFromDBSources() == 0)
            {
                md.Name = this.Name;
                md.Insert();
            }

            MapAttrs attrs = new MapAttrs(this.No);

            BP.Sys.MapAttr attr = new BP.Sys.MapAttr();
            if (attrs.Contains(MapAttrAttr.KeyOfEn, "OID") == false)
            {
                attr             = new BP.Sys.MapAttr();
                attr.FK_MapData  = this.No;
                attr.HisEditType = EditType.Readonly;

                attr.KeyOfEn       = "OID";
                attr.Name          = "主键";
                attr.MyDataType    = BP.DA.DataType.AppInt;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.DefVal        = "0";
                attr.Insert();
            }

            if (attrs.Contains(MapAttrAttr.KeyOfEn, "RefPK") == false)
            {
                attr             = new BP.Sys.MapAttr();
                attr.FK_MapData  = this.No;
                attr.HisEditType = EditType.Readonly;

                attr.KeyOfEn       = "RefPK";
                attr.Name          = "关联ID";
                attr.MyDataType    = BP.DA.DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.DefVal        = "0";
                attr.Insert();
            }

            if (attrs.Contains(MapAttrAttr.KeyOfEn, "FID") == false)
            {
                attr             = new BP.Sys.MapAttr();
                attr.FK_MapData  = this.No;
                attr.HisEditType = EditType.Readonly;

                attr.KeyOfEn       = "FID";
                attr.Name          = "FID";
                attr.MyDataType    = BP.DA.DataType.AppInt;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.DefVal        = "0";
                attr.Insert();
            }

            if (attrs.Contains(MapAttrAttr.KeyOfEn, "RDT") == false)
            {
                attr             = new BP.Sys.MapAttr();
                attr.FK_MapData  = this.No;
                attr.HisEditType = EditType.UnDel;

                attr.KeyOfEn       = "RDT";
                attr.Name          = "记录时间";
                attr.MyDataType    = BP.DA.DataType.AppDateTime;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.Tag           = "1";
                attr.Insert();
            }

            if (attrs.Contains(MapAttrAttr.KeyOfEn, "Rec") == false)
            {
                attr             = new BP.Sys.MapAttr();
                attr.FK_MapData  = this.No;
                attr.HisEditType = EditType.Readonly;

                attr.KeyOfEn       = "Rec";
                attr.Name          = "记录人";
                attr.MyDataType    = BP.DA.DataType.AppString;
                attr.UIContralType = UIContralType.TB;
                attr.LGType        = FieldTypeS.Normal;
                attr.UIVisible     = false;
                attr.UIIsEnable    = false;
                attr.MaxLen        = 20;
                attr.MinLen        = 0;
                attr.DefVal        = "@WebUser.No";
                attr.Tag           = "@WebUser.No";
                attr.Insert();
            }
        }