protected void Page_Load(object sender, EventArgs e) { string action = GetstringKey("action"); if (action != "save") { if (!string.IsNullOrEmpty(this.Request["iD"])) { int _iD = Convert.ToInt32(this.Request["iD"]); Light condition = new Light(); condition.ID = _iD; news = TableOperate <Light> .GetRowData(condition); iD.Value = Convert.ToString(news.ID); State.Value = Convert.ToString(news.State); // } DataBind(); } else { Result result = new Result(); string logbrief = ""; Light newChannelNews = new Light(); newChannelNews.ID = 0; newChannelNews.AutoForm(this.Page); string Title = newChannelNews.Title; int _iD; if (!string.IsNullOrEmpty(this.Request["iD"])) { _iD = Convert.ToInt32(this.Request["iD"]); TableOperate <Light> .Update(newChannelNews); result.msg = "编辑成功,等待返回列表"; logbrief = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "编辑了为【" + Title + "】的灯光"; } else { newChannelNews.AddTime = DateTime.Now; newChannelNews.AddID = AdminMethod.AdminID; newChannelNews.ExhibitionID = AdminMethod.ExhibitionID; newChannelNews.OrderID = CloudSQL.GetNowTime(); _iD = TableOperate <Light> .InsertReturnID(newChannelNews); result.msg = "添加成功,等待返回列表"; logbrief = "管理员:【" + AdminMethod.AdminFullName + "】在" + DateTime.Now.GetDateTimeFormats('f')[0].ToString() + "添加了为【" + Title + "】的灯光"; } if (_iD > 0) { result.isOk = true; Lognet.AddLogin(logbrief); } else { result.msg = "操作失败"; } Response.ContentType = "text/json"; Response.Write(new JavaScriptSerializer().Serialize(result)); Response.End(); } DataBind(); }