コード例 #1
0
ファイル: ObjectEdit.ascx.cs プロジェクト: alex765022/IBN
        protected void btnSave_Click(object sender, EventArgs e)
        {
            this.Page.Validate();
            if (!this.Page.IsValid)
            {
                return;
            }

            if (ObjectId != PrimaryKeyId.Empty)
            {
                _bindObject = MetaObjectActivator.CreateInstance <BusinessObject>(MetaDataWrapper.ResolveMetaClassByNameOrCardName(ClassName), ObjectId);
            }
            else
            {
                _bindObject = MetaObjectActivator.CreateInstance <BusinessObject>(MetaDataWrapper.ResolveMetaClassByNameOrCardName(ClassName));
            }

            if (_bindObject != null)
            {
                ProcessCollection(this.Page.Controls, (BusinessObject)_bindObject);

                ((BusinessObject)_bindObject).Save();

                PrimaryKeyId objectId = ((BusinessObject)_bindObject).PrimaryKeyId.Value;

                if (Mode.ToLower() == "popup")
                {
                    string param = "";
                    if (!String.IsNullOrEmpty(CommandName))
                    {
                        CommandParameters cp = new CommandParameters(CommandName);
                        param = cp.ToString();
                    }
                    Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, param);
                }
                else
                {
                    Response.Redirect(CHelper.GetLinkObjectView_Edit(ClassName, objectId.ToString()));
                }
            }
        }