Exemplo n.º 1
0
        string type = String.Empty; // 对象类型

        #endregion

        #region ASP.NET 事件

        protected void Page_Load(object sender, EventArgs e)
        {
            op   = RequestData.Get <string>("op");
            id   = RequestData.Get <string>("id");
            type = RequestData.Get <string>("type");

            Treaty ent = null;

            switch (this.RequestAction)
            {
            case RequestActionEnum.Update:
                ent = this.GetMergedData <Treaty>();
                ent.DoUpdate();

                break;

            case RequestActionEnum.Insert:
            case RequestActionEnum.Create:
                ent = this.GetPostedData <Treaty>();
                ent.DoCreate();
                break;

            case RequestActionEnum.Delete:
                ent = this.GetTargetData <Treaty>();
                ent.DoDelete();

                return;
            }

            if (op != "c" && op != "cs")
            {
                if (!String.IsNullOrEmpty(id))
                {
                    ent = Treaty.Find(id);
                }
                this.SetFormData(ent);
            }
        }