protected void Page_Load(object sender, EventArgs e) { SysDataImportTemplate ent = null; switch (this.RequestAction) { case RequestActionEnum.Delete: ent = this.GetTargetData <SysDataImportTemplate>(); ent.DoDelete(); this.SetMessage("删除成功!"); break; case RequestActionEnum.Custom: IList <object> idList = RequestData.GetList <object>("IdList"); if (idList != null && idList.Count > 0) { if (RequestActionString == "batchdelete") { SysDataImportTemplate.DoBatchDelete(idList.ToArray()); } } break; default: ents = SysDataImportTemplateRule.FindAll(SearchCriterion); this.PageState.Add("SysDataImportTemplateList", ents); break; } }
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"); SysDataImportTemplate ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetTargetData <SysDataImportTemplate>(); SysDataImportTemplate pent = this.GetPostedData <SysDataImportTemplate>(); bool isTemplateFileChanged = false; if (ent.TemplateFileID != pent.TemplateFileID) { isTemplateFileChanged = true; } DataHelper.MergeData(ent, pent); // 手工合并源数据与提交数据 if (isTemplateFileChanged) { DataImportService.DoImportTemplateFileChanged(ent); // 触发模版文件变化操作 } ent.DoUpdate(); this.SetMessage("修改成功!"); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <SysDataImportTemplate>(); ent.CreaterID = UserInfo.UserID; ent.CreaterName = UserInfo.Name; DataImportService.DoImportTemplateFileChanged(ent); // 触发模版文件变化操作 ent.DoCreate(); this.SetMessage("新建成功!"); break; case RequestActionEnum.Delete: ent = this.GetTargetData <SysDataImportTemplate>(); ent.DoDelete(); this.SetMessage("删除成功!"); return; } if (op != "c" && op != "cs") { if (!String.IsNullOrEmpty(id)) { ent = SysDataImportTemplate.Find(id); } this.SetFormData(ent); } else { PageState.Add("CreaterName", UserInfo.Name); PageState.Add("CreatedDate", DateTime.Now); } }