protected void Page_Load(object sender, EventArgs e) { Pid = RequestData.Get <string>("Pid"); ProductDetail ent = null; switch (this.RequestAction) { case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <ProductDetail>(); //判断是否存在 if (ProductDetail.FindAllByProperty("GuId", ent.GuId).FirstOrDefault <ProductDetail>() != null) { PageState.Add("error", "此编号已存在!"); break; } ent.State = true; ent.DoCreate(); this.SetMessage("新建成功!"); break; } if (RequestData.Get <string>("op") == "c") { if (!String.IsNullOrEmpty(Pid)) { Product pro = Product.TryFind(Pid); if (pro != null) { ent = new ProductDetail { PId = pro.Id, PCode = pro.Code, PISBN = pro.Isbn, PName = pro.Name, PPcn = pro.Pcn }; this.SetFormData(ent); } } } }