/// <summary> /// 新增或修改渠道类型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //修改渠道类型,首先获取渠道类型数据 int id; if (int.TryParse(Request.QueryString["id"], out id)) { ViewState["channelType"] = new ChannelTypeBll().GetEntityById(id); } } else { //将渠道类型新增或修改的数据保存到数据库 var entity = new ChannelTypeEntity() { ID = Request.Form["ID"] == null ? 0 : int.Parse(Request.Form["ID"]), Name = Request.Form["Name"] }; new ChannelTypeBll().UpdateOrInsertEntity(entity); //回到渠道类型列表页面 Response.Redirect("ChannelTypeList.aspx"); Response.End(); } }
/// <summary> /// 删除渠道类型 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { //获取渠道类型ID int id; if (int.TryParse(Request.QueryString["id"], out id)) { //删除渠道类型并返回删除结果 bool result = new ChannelTypeBll().DeleteEntityById(id); Response.Write(result.ToString()); Response.End(); } }
/// <summary> /// 渠道类型列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { //获取渠道类型列表数据 ViewState["ChannelTypeList"] = new ChannelTypeBll().GetEntities(); }