protected void lbtnSearch_Click(object sender, EventArgs e) { SOSOshop.BLL.Advertising ad = new SOSOshop.BLL.Advertising(); SOSOshop.BLL.Advertising newad = ad.GetModelByCode(this.Code.Text); List <int> pid = newad.ProductID; pid.Remove(Convert.ToInt32(this.PorductId.Text)); newad.ProductID = pid; ad.Update(newad); //this.w_l_sitename.Text = "ddd" + TextBox1.Text; //this.lblList.Text = GetList(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string id = context.Request["pid"]; string code = context.Request["code"]; if (!string.IsNullOrEmpty(id) && !string.IsNullOrEmpty(code)) { try { SOSOshop.BLL.Advertising ad = new SOSOshop.BLL.Advertising(); SOSOshop.BLL.Advertising ads = ad.GetModelByCode(code); List <int> ids = new List <int>(); if (ads != null) { if (ads.ProductID != null) { ids = ads.ProductID; if (ids.IndexOf(Convert.ToInt32(id)) == -1) { ids.Add(Convert.ToInt32(id)); ads.ProductID = ids; } } else { ids.Add(Convert.ToInt32(id)); ads.ProductID = ids; } ad.Update(ads); } else { ad.Code = code; ids.Add(Convert.ToInt32(id)); ad.ProductID = ids; ad.Update(ad); } context.Response.Write("{\"state\":0,\"message\":\"添加成功!\"}"); } catch (Exception x) { context.Response.Write("{\"state\":0,\"message\":\"添加失败Error!\"}"); } } else { context.Response.Write("{\"state\":0,\"message\":\"添加失败!\"}"); } }
protected void Create_Click(object sender, EventArgs e) { SOSOshop.BLL.Advertising ad = new SOSOshop.BLL.Advertising(); SOSOshop.BLL.Advertising newad = ad.GetModelByCode(dropdown.SelectedValue); if (newad != null) { newad.Code = dropdown.SelectedValue; newad.Title = w_l_sitename.Text; ad.Update(newad); } else { ad.Code = dropdown.SelectedValue; ad.Title = w_l_sitename.Text; ad.Update(ad); } }