string type = String.Empty; // 对象类型 protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); type = RequestData.Get <string>("type"); NotePad ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <NotePad>(); ent.DoUpdate(); this.PageState.Add("Id", ent.Id); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <NotePad>(); ent.UserId = UserInfo.UserID; ent.UserName = UserInfo.Name; ent.DoCreate(); this.PageState.Add("Id", ent.Id); break; case RequestActionEnum.Delete: ent = this.GetTargetData <NotePad>(); ent.DoDelete(); this.SetMessage("删除成功!"); return; default: if (RequestActionString == "delete") { if (!string.IsNullOrEmpty(id)) { ent = NotePad.Find(id); ent.DoDelete(); } } break; } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = NotePad.Find(id); } this.SetFormData(ent); } }
protected void Page_Load(object sender, EventArgs e) { NotePad ent = null; switch (this.RequestAction) { case RequestActionEnum.Delete: ent = this.GetTargetData <NotePad>(); ent.DoDelete(); this.SetMessage("删除成功!"); break; default: if (RequestActionString == "batchdelete") { DoBatchDelete(); } else { DoSelect(); } break; } }