protected void btnSure_Click(object sender, EventArgs e) { if (this.cbCityCodeValue.SelectedIndex == 0) { return; } TrafficLimitInfoEntity entity = new TrafficLimitInfoEntity(); WebFormHelper.GetDataFromForm(this, entity); // entity.MachineMac = FT.Commons.Web.Tools.WebToolsHelper.GetMac(entity.MachineIp); //entity.StartDate = Convert.ToDateTime(this.txtBeginDate.Value.ToString()); // entity.EndDate = Convert.ToDateTime(this.txtEndDate.Value.ToString()); if (entity.Id < 0) { if (SimpleOrmOperator.Create(entity)) { WebTools.Alert(this, "添加成功!"); } else { WebTools.Alert("添加失败!"); } } else { if (SimpleOrmOperator.Update(entity)) { WebTools.Alert(this, "修改成功!"); } else { WebTools.Alert("修改失败!"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { GobalTools.BindCity(this.cbCityCodeValue); if (Request.Params["id"] != null) { TrafficLimitInfoEntity entity = SimpleOrmOperator.Query <TrafficLimitInfoEntity>(Convert.ToInt32(Request.Params["id"])); WebFormHelper.SetDataToForm(this, entity); } else { } } }