예제 #1
0
        public Map GenerMap()
        {
            bool isdebug = SystemConfig.IsDebug;

            if (isdebug == false)
            {
                Map m = BP.DA.Cash.GetMap(this.No);
                if (m != null)
                {
                    return(m);
                }
            }

            MapAttrs mapAttrs = this.MapAttrs;
            Map      map      = new Map(this.PTable);

            map.EnDesc             = this.Name;
            map.EnType             = EnType.App;
            map.DepositaryOfEntity = Depositary.None;
            map.DepositaryOfMap    = Depositary.Application;

            Attrs attrs = new Attrs();

            foreach (MapAttr mapAttr in mapAttrs)
            {
                map.AddAttr(mapAttr.HisAttr);
            }

            BP.DA.Cash.SetMap(this.No, map);
            return(map);
        }
예제 #2
0
        protected override bool beforeUpdateInsertAction()
        {
            BP.Sys.MapData md = new BP.Sys.MapData();
            md.No = this.No;
            if (md.RetrieveFromDBSources() == 0)
            {
                md.Name = this.Name;
                md.Insert();
            }

            if (this.IsRowLock == true)
            {
                /*检查是否启用了行锁定.*/
                MapAttrs attrs = new MapAttrs(this.No);
                if (attrs.Contains(MapAttrAttr.KeyOfEn, "IsRowLock") == false)
                {
                    throw new Exception("您启用了从表单(" + this.Name + ")行数据锁定功能,但是该从表里没IsRowLock字段,请参考帮助文档。");
                }
            }

            if (this.IsEnablePass)
            {
                /*判断是否有IsPass 字段。*/
                MapAttrs attrs = new MapAttrs(this.No);
                if (attrs.Contains(MapAttrAttr.KeyOfEn, "IsPass") == false)
                {
                    throw new Exception("您启用了从表单(" + this.Name + ")条数据审核选项,但是该从表里没IsPass字段,请参考帮助文档。");
                }
            }
            return(base.beforeUpdateInsertAction());
        }
예제 #3
0
        /// <summary>
        /// 记录人
        /// </summary>
        /// <returns></returns>
        protected override bool beforeInsert()
        {
            // 判断是否有变化的项目,决定是否执行储存。
            MapAttrs mattrs   = new MapAttrs(this.FK_MapDtl);
            bool     isChange = false;

            foreach (MapAttr mattr in mattrs)
            {
                if (isChange)
                {
                    break;
                }
                switch (mattr.KeyOfEn)
                {
                case "Rec":
                case "RDT":
                case "RefPK":
                case "FID":
                    break;

                default:
                    if (mattr.IsNum)
                    {
                        string s = this.GetValStrByKey(mattr.KeyOfEn);
                        if (DataType.IsNullOrEmpty(s))
                        {
                            this.SetValByKey(mattr.KeyOfEn, mattr.DefVal);
                            s = mattr.DefVal.ToString();
                        }

                        if (decimal.Parse(s) == mattr.DefValDecimal)
                        {
                            continue;
                        }
                        isChange = true;
                        break;
                    }
                    else
                    {
                        if (this.GetValStrByKey(mattr.KeyOfEn) == mattr.DefVal)
                        {
                            continue;
                        }
                        isChange = true;
                        break;
                    }
                    break;
                }
            }
            if (isChange == false)
            {
                return(false);
            }

            this.Rec = BP.Web.WebUser.No;
            this.RDT = DataType.CurrentDataTime;

            this.AutoFull(); /*处理自动计算。*/
            return(base.beforeInsert());
        }
예제 #4
0
        protected override bool beforeDelete()
        {
            // 检查这个类型是否被使用?
            MapAttrs    attrs = new MapAttrs();
            QueryObject qo    = new QueryObject(attrs);

            qo.AddWhere(MapAttrAttr.UIBindKey, this.No);
            int i = qo.DoQuery();

            if (i == 0)
            {
                BP.Sys.SysEnums ses = new SysEnums();
                ses.Delete(BP.Sys.SysEnumAttr.EnumKey, this.No);
            }
            else
            {
                string msg = "错误:下列数据已经引用了枚举您不能删除它。"; // "错误:下列数据已经引用了枚举您不能删除它。";
                foreach (MapAttr attr in attrs)
                {
                    msg += "\t\n" + attr.Field + "" + attr.Name + " Table = " + attr.FK_MapData;
                }

                //抛出异常,阻止删除.
                throw new Exception(msg);
            }
            return(base.beforeDelete());
        }
예제 #5
0
        public string TableRef_Init()
        {
            BP.Sys.MapAttrs mapAttrs = new BP.Sys.MapAttrs();
            mapAttrs.RetrieveByAttr(BP.Sys.MapAttrAttr.UIBindKey, this.FK_SFTable);

            DataTable dt = mapAttrs.ToDataTableField();

            return(BP.Tools.Json.ToJson(dt));
        }
예제 #6
0
 protected override bool beforeUpdateInsertAction()
 {
     if (this.IsEnablePass)
     {
         /*判断是否有IsPass 字段。*/
         MapAttrs attrs = new MapAttrs(this.No);
         if (attrs.Contains(MapAttrAttr.KeyOfEn, "IsPass") == false)
         {
             throw new Exception("您启用了从表单(" + this.Name + ")条数据审核选项,但是该从表里没IsPass字段,请参考帮助文档。");
         }
     }
     return(base.beforeUpdateInsertAction());
 }
예제 #7
0
        protected override bool beforeUpdate()
        {
            MapAttrs attrs        = new MapAttrs(this.No);
            bool     isHaveEnable = false;

            foreach (MapAttr attr in attrs)
            {
                if (attr.UIIsEnable && attr.UIContralType == UIContralType.TB)
                {
                    isHaveEnable = true;
                }
            }
            this.InitExtMembers();
            return(base.beforeUpdate());
        }
예제 #8
0
        public string IsCanDelete()
        {
            MapAttrs attrs = new MapAttrs();

            attrs.Retrieve(MapAttrAttr.UIBindKey, this.No);
            if (attrs.Count != 0)
            {
                string err = "";
                foreach (MapAttr item in attrs)
                {
                    err += " @ " + item.MyPK + " " + item.Name;
                }
                return("err@如下实体字段在引用:" + err + "。您不能删除该表。");
            }
            return(null);
        }
예제 #9
0
        protected override bool beforeDelete()
        {
            MapAttrs attrs = new MapAttrs();

            attrs.Retrieve(MapAttrAttr.UIBindKey, this.No);
            if (attrs.Count != 0)
            {
                string err = "";
                foreach (MapAttr item in attrs)
                {
                    err += " @ " + item.MyPK + " " + item.Name;
                }
                throw new Exception("@如下实体字段在引用:" + err + "。您不能删除该表。");
            }
            return(base.beforeDelete());
        }
예제 #10
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();
            }
        }
예제 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 处理活动.
            switch (this.Request.QueryString["ActionType"])
            {
            case "Left":
                MapAttr attr = new MapAttr(this.FK_MapAttr);
                attr.DoUp();
                break;

            case "Right":
                MapAttr attrR = new MapAttr(this.FK_MapAttr);
                attrR.DoDown();
                break;

            default:
                break;
            }
            #endregion 处理活动.


            BP.WF.Rpt.MapRpt mrpt  = new BP.WF.Rpt.MapRpt(RptNo);
            BP.Sys.MapAttrs  attrs = new BP.Sys.MapAttrs(this.RptNo);

            this.Pub2.AddTable("class='Table' border='1' cellspacing='0' cellpadding='0' style='width:100%'");

            this.Pub2.AddTR();
            this.Pub2.AddTDGroupTitle("style='text-align:center;width:50px'", "序");
            this.Pub2.AddTDGroupTitle("字段");
            this.Pub2.AddTDGroupTitle("标签");
            this.Pub2.AddTDGroupTitle("显示顺序号");
            this.Pub2.AddTDGroupTitle("style='text-align:center;width:100px'", "调整");
            this.Pub2.AddTREnd();

            int    idx  = 0;
            string tKey = DateTime.Now.ToString("HHmmss");
            foreach (BP.Sys.MapAttr mattr in attrs)
            {
                switch (mattr.KeyOfEn)
                {
                case BP.WF.Data.NDXRptBaseAttr.Title:
                case BP.WF.Data.NDXRptBaseAttr.OID:
                case BP.WF.Data.NDXRptBaseAttr.MyNum:
                    continue;

                default:
                    break;
                }

                idx++;
                this.Pub2.AddTR();
                this.Pub2.AddTDIdx(idx);
                this.Pub2.AddTD(mattr.KeyOfEn);
                TextBox tb = new TextBox();
                tb.Text = mattr.Name;
                tb.ID   = "TB_" + mattr.KeyOfEn;
                this.Pub2.AddTD(tb);

                tb      = new TextBox();
                tb.ID   = "TB_" + mattr.KeyOfEn + "_Idx";
                tb.Text = idx.ToString();
                //tb.ReadOnly = true;
                this.Pub2.AddTD(tb);

                //顺序.
                this.Pub2.AddTDBegin("style='text-align:center'");
                this.Pub2.Add("<a href='javascript:void(0)' onclick='up(this, 3)' class='easyui-linkbutton' data-options=\"iconCls:'icon-up'\"></a>&nbsp;");
                this.Pub2.Add("<a href='javascript:void(0)' onclick='down(this, 3)' class='easyui-linkbutton' data-options=\"iconCls:'icon-down'\"></a>");

                this.Pub2.AddTDEnd();
                this.Pub2.AddTREnd();
            }

            this.Pub2.AddTableEnd();
        }