示例#1
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string   ensName = this.Request.QueryString["EnsName"];
            int      index   = int.Parse(this.Request.QueryString["Index"]);
            Entities ens     = BP.En.ClassFactory.GetEns(ensName);
            Entity   en      = ens.GetNewEntity;

            BP.En.RefMethod rm = en.EnMap.HisRefMethods[index];

            if (rm.HisAttrs == null || rm.HisAttrs.Count == 0)
            {
                string pk = this.RefEnKey;
                if (pk == null)
                {
                    pk = this.Request.QueryString[en.PK];
                }

                en.PKVal = pk;
                en.Retrieve();
                rm.HisEn = en;

                // 如果是link.
                if (rm.RefMethodType == RefMethodType.LinkModel)
                {
                    string url = rm.Do(null) as string;
                    if (string.IsNullOrEmpty(url))
                    {
                        throw new Exception("@应该返回的url.");
                    }
                    this.Response.Redirect(url, true);
                    return;
                }

                object obj = rm.Do(null);
                if (obj == null)
                {
                    this.WinClose();
                    return;
                }

                string info = obj.ToString();
                info = info.Replace("@", "<br>@");
                if (info.Contains("<"))
                {
                    this.ToWFMsgPage(info);
                }
                else
                {
                    this.WinCloseWithMsg(info);
                }
                return;
            }
            this.Bind(rm);
            this.Label1.Text = this.GenerCaption(en.EnMap.EnDesc + "=>" + rm.GetIcon(this.Request.ApplicationPath) + rm.Title);
        }
示例#2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            this.BPToolBar1.ButtonClick += new EventHandler(BPToolBar1_ButtonClick);

            string   ensName = this.Request.QueryString["EnsName"];
            int      index   = int.Parse(this.Request.QueryString["Index"]);
            Entities ens     = BP.DA.ClassFactory.GetEns(ensName);
            Entity   en      = ens.GetNewEntity;

            BP.En.RefMethod rm = en.EnMap.HisRefMethods[index];

            //			Attrs attrs =en.EnMap.Attrs;
            //			foreach(Attr attr in attrs)
            //			{
            //				en.SetValByKey(attr.Key, this.Request.QueryString[attr.Key]);
            //			}

            //			string pk=this.Request.QueryString["PK"];
            //			if (pk==null)
            //				pk=this.Request.QueryString[en.PK];

            //rm.PK=pk;

            if (rm.HisAttrs == null || rm.HisAttrs.Count == 0)
            {
                string pk = this.Request.QueryString["RefEnKey"];
                if (pk == null)
                {
                    pk = this.Request.QueryString[en.PK];
                }

                en.PKVal = pk;
                en.Retrieve();

                rm.HisEn = en;
                object obj = rm.Do(null);
                if (obj == null)
                {
                    this.WinClose();
                    return;
                }

                string info = obj.ToString();
                if (info.Contains("<"))
                {
                    this.ToMsgPage(obj.ToString().Replace("@", "<BR>@"));
                }
                else
                {
                    this.WinCloseWithMsg(info);
                }
                return;
            }
            this.Bind(rm);

            if (this.IsPostBack == false)
            {
                this.BPToolBar1.AddBtn(NamesOfBtn.Do, rm.Title);
                this.BPToolBar1.AddSpt("sd");
                this.BPToolBar1.AddBtn(NamesOfBtn.Close);
                //  this.BPToolBar1.AddBtn(NamesOfBtn.Help);
            }

            // this.Label1.Text = this.GenerCaption(this.HisEn.EnMap.EnDesc + "" + this.HisEn.EnMap.TitleExt);
            this.UCEn2.Add(en.EnMap.EnDesc + "=>" + rm.GetIcon(this.Request.ApplicationPath) + rm.Title);
        }