protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.procate myb = new BLL.procate(); DataSet ds = myb.dataset(); _cateid.DataSource = ds.Tables[0]; _cateid.DataBind(); L_id.Text = Request.QueryString["id"].ToString(); int u_id = Convert.ToInt32( L_id.Text); BLL.product prob = new BLL.product(); MySqlDataReader dr = prob.selectupdate(u_id); if (dr.Read()) { _title.Text = dr["_title"].ToString(); FCKeditor1.Value = dr["_content"].ToString(); _posttime.Text = dr["_posttime"].ToString(); _weight.Text = dr["_weight"].ToString(); _imageid.Text = dr["_imageid"].ToString(); _marketprice.Text = dr["_marketprice"].ToString(); _localprice.Text = dr["_localprice"].ToString(); _procount.Text = dr["_procount"].ToString(); _ischeap.SelectedIndex = Convert.ToInt32(dr["_ischeap"].ToString()); _isrecomment.SelectedIndex = Convert.ToInt32(dr["_isrecommend"].ToString()); _top.SelectedIndex = Convert.ToInt32(dr["_top"].ToString()); _cateid.SelectedIndex = Convert.ToInt32(dr["_cateid"].ToString()) + 1; } dr.Close(); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { z_id.Text = e.CommandArgument.ToString(); } if (e.CommandName == "Delete") { int z_id = Convert.ToInt32(e.CommandArgument); BLL.product myb = new BLL.product(); int result = myb.num(z_id); if (result > 0) { msg("先把含有此子类的商品记录删除,才能删除子类"); } else { BLL.procate d_bll = new BLL.procate(); int rs = d_bll.dalete(z_id); if (rs > 0) { msg("删除成功"); bing(); } else { msg("删除失败!"); } } } }
protected void tijiao_Click(object sender, EventArgs e) { Model.product mym = new Model.product(); mym.title = _title.Text; mym.content = FCKeditor1.Value; mym.imageid = _imageid.Text; mym.ischeap = Convert.ToInt32(_ischeap.SelectedValue); mym.isrecomment = Convert.ToInt32(_isrecomment.SelectedValue); mym.localprice = Convert.ToDouble(_localprice.Text); mym.marketprice = Convert.ToDouble(_marketprice.Text); mym.posttime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); mym.procount = Convert.ToInt32(_procount.Text); mym.top = Convert.ToInt32(_top.SelectedValue); mym.weight = _weight.Text; mym.cateid = Convert.ToInt32(_cateid.SelectedValue); BLL.product bpro = new BLL.product(); int result = bpro.insert(mym); if (result > 0) { msg("成功添加产品!!"); string mmmm = DateTime.Now.ToString("yyyyMMddhhmmssfff"); _imageid.Text = mmmm; _title.Text = ""; FCKeditor1.Value = ""; _procount.Text = ""; _weight.Text = ""; _localprice.Text = ""; _marketprice.Text = ""; imagela.Text = ""; } }
public void bing() { BLL.product myb = new BLL.product(); DataSet ds = myb.dataset(); GridView1.DataSource =ds.Tables[0]; GridView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.procate myb = new BLL.procate(); DataSet ds = myb.dataset(); _cateid.DataSource = ds.Tables[0]; _cateid.DataBind(); L_id.Text = Request.QueryString["id"].ToString(); int u_id = Convert.ToInt32(L_id.Text); BLL.product prob = new BLL.product(); SqlDataReader dr = prob.selectupdate(u_id); if (dr.Read()) { _title.Text = dr["_title"].ToString(); FCKeditor1.Value = dr["_content"].ToString(); _posttime.Text = dr["_posttime"].ToString(); _weight.Text = dr["_weight"].ToString(); _imageid.Text = dr["_imageid"].ToString(); _marketprice.Text = dr["_marketprice"].ToString(); _localprice.Text = dr["_localprice"].ToString(); _procount.Text = dr["_procount"].ToString(); _ischeap.SelectedIndex = Convert.ToInt32(dr["_ischeap"].ToString()); _isrecomment.SelectedIndex = Convert.ToInt32(dr["_isrecommend"].ToString()); _top.SelectedIndex = Convert.ToInt32(dr["_top"].ToString()); _cateid.SelectedIndex = Convert.ToInt32(dr["_cateid"].ToString()) + 1; } dr.Close(); } }
public void sbing() { int cateid = Convert.ToInt32(l_cateid.Text); BLL.product b_date = new BLL.product(); DataSet ds = b_date.p_dataset(cateid, AspNetPager1.PageSize * (AspNetPager1.CurrentPageIndex - 1), AspNetPager1.PageSize, "helpcate"); DataList1.DataSource = ds.Tables[0]; DataList1.DataBind(); }
public void bing() { BLL.product myb = new BLL.product(); DataSet ds = myb.dataset(); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); }
public void s_cateid() { string cate_id = Request.QueryString["cateid"].ToString(); l_cateid.Text = cate_id; BLL.product b_p = new BLL.product(); int result = b_p.num_cateid(Convert.ToInt32(cate_id)); AspNetPager1.RecordCount = result; AspNetPager1.PageSize = 9; }
protected void sous_Click(object sender, EventArgs e) { Model.product mym = new Model.product(); mym.title = Text_title.Text; BLL.product myb = new BLL.product(); DataSet ds = myb.select_title(mym); GridView1.DataSource = ds.Tables[0]; GridView1.DataBind(); }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { Model.product mym = new Model.product(); mym.id = Convert.ToInt32(e.CommandArgument); BLL.product myb = new BLL.product(); string s_imageid = myb.select_imageid(mym); BLL.proimage b_image = new BLL.proimage(); DataSet ds = b_image.select_sizeid(s_imageid); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string size_id = Convert.ToString(ds.Tables[0].Rows[i]["_sizeid"]); BLL.size s_bll = new BLL.size(); int result_s = s_bll.delete(size_id); string path1 = Convert.ToString(ds.Tables[0].Rows[i]["_imageurl"]); string path = "~/" + path1; if (File.Exists(Server.MapPath(path))) { File.Delete(Server.MapPath(path)); } } int r_image = b_image.delete(s_imageid); int result = myb.delete_id(mym); if (result > 0) { msg("删除成功!!"); bing(); } } if (e.CommandName == "Edit") { Response.Redirect("proupdate.aspx?id=" + e.CommandArgument + ""); } }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Delete") { Model.product mym = new Model.product(); mym.id = Convert.ToInt32(e.CommandArgument); BLL.product myb = new BLL.product(); string s_imageid = myb.select_imageid(mym); BLL.proimage b_image = new BLL.proimage(); DataSet ds = b_image.select_sizeid(s_imageid); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string size_id = Convert.ToString(ds.Tables[0].Rows[i]["_sizeid"]); BLL.size s_bll = new BLL.size(); int result_s = s_bll.delete(size_id); string path1 = Convert.ToString(ds.Tables[0].Rows[i]["_imageurl"]); string path = "~/" + path1; if (File.Exists(Server.MapPath(path))) { File.Delete(Server.MapPath(path)); } } int r_image = b_image.delete(s_imageid); int result = myb.delete_id(mym); if (result > 0) { msg("删除成功!!"); bing(); } } if (e.CommandName == "Edit") { Response.Redirect("proupdate.aspx?id="+e.CommandArgument+""); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BLL.fathercate my_f = new BLL.fathercate(); DataSet ds_f = my_f.dataset(); Repeater1.DataSource = ds_f.Tables[0]; Repeater1.DataBind(); uid.Text = Request.QueryString["uid"].ToString(); int u_id = Convert.ToInt32(uid.Text); BLL.product prob = new BLL.product(); SqlDataReader dr_pro = prob.selectupdate(u_id); dr_pro.Read(); market.Text = Math.Round(Convert.ToDecimal(dr_pro["_market_price"].ToString()), 2).ToString(); local.Text = Math.Round(Convert.ToDecimal(dr_pro["_local_price"].ToString()), 2).ToString(); image_id.Text = dr_pro["_imageid"].ToString(); title_l.Text = dr_pro["_product_name"].ToString(); content_s.Text = dr_pro["_describe"].ToString(); int cate_id = Convert.ToInt32(dr_pro["_cateid"].ToString()); catename(cate_id); dr_pro.Close(); BLL.proimage b_image = new BLL.proimage(); DataSet ds_image = b_image.select_sizeid(image_id.Text); DataList1.DataSource = ds_image.Tables[0]; DataList1.DataBind(); Image_1.ImageUrl = Convert.ToString(ds_image.Tables[0].Rows[0]["_imageurl"]); im_url = Image_1.ImageUrl; img_url.Text = im_url; d_color.Text = Convert.ToString(ds_image.Tables[0].Rows[0]["_color"]); if (ds_image.Tables[0].Rows[0]["_sizeid"] != null) { string size_id = Convert.ToString(ds_image.Tables[0].Rows[0]["_sizeid"]); sizeid.Text = size_id; siz(sizeid.Text); } } }
protected void tijiao_Click(object sender, EventArgs e) { Model.product mym = new Model.product(); mym.title = _title.Text; mym.content = FCKeditor1.Value; mym.imageid = _imageid.Text; mym.ischeap = Convert.ToInt32(_ischeap.SelectedValue); mym.isrecomment = Convert.ToInt32(_isrecomment.SelectedValue); mym.localprice = Convert.ToDouble(_localprice.Text); mym.marketprice = Convert.ToDouble(_marketprice.Text); mym.posttime = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); mym.procount = Convert.ToInt32(_procount.Text); mym.top = Convert.ToInt32(_top.SelectedValue); mym.weight = _weight.Text; mym.cateid = Convert.ToInt32(_cateid.SelectedValue); BLL.product bpro = new BLL.product(); int result = bpro.insert(mym); if (result > 0) { msg("成功添加产品!!"); string mmmm = DateTime.Now.ToString("yyyyMMddhhmmssfff"); _imageid.Text = mmmm; _title.Text = ""; FCKeditor1.Value = ""; _procount.Text = ""; _weight.Text = ""; sizela.Text = ""; _localprice.Text = ""; _marketprice.Text = ""; imagela.Text = ""; } }
protected void tijiao_Click(object sender, EventArgs e) { Model.product mym = new Model.product(); mym.title = _title.Text; mym.content = FCKeditor1.Value; mym.id = Convert.ToInt32(L_id.Text); mym.ischeap = Convert.ToInt32(_ischeap.SelectedValue); mym.isrecomment = Convert.ToInt32(_isrecomment.SelectedValue); mym.localprice = Convert.ToDouble(_localprice.Text); mym.marketprice = Convert.ToDouble(_marketprice.Text); mym.procount = Convert.ToInt32(_procount.Text); mym.top = Convert.ToInt32(_top.SelectedValue); mym.weight = _weight.Text; mym.cateid = Convert.ToInt32(_cateid.SelectedValue); BLL.product bpro = new BLL.product(); int result = bpro.update(mym); if (result > 0) { msg("成功更新商品!!"); Response.Redirect("proselect.aspx"); } }
protected void info() { try { int c = 1; string str = "select * from product where _ischeap=" + c + " limit 10"; DataSet ds = new BLL.product().getProductDS(str); DataList1.DataSource = ds.Tables[0]; DataList1.DataBind(); /*----------------- hot--------------*/ string str2 = @"select * from product where _id in (select _proid from orderdetail group by _proid order by sum(_count) ) limit 10"; DataSet ds2 = new BLL.product().getProductDS(str2); DataList2.DataSource = ds2.Tables[0]; DataList2.DataBind(); /*----------------- time--------------*/ string str3 = "select * from product order by _id desc limit 10"; DataSet ds3 = new BLL.product().getProductDS(str3); DataList3.DataSource = ds3.Tables[0]; DataList3.DataBind(); } catch { } }
public static product Getproduct(product p0) { string sql = "select * from product where id = @id"; return(DAL.SqlHelper <Model.product> .Query(sql, p0)[0]); }
protected string bd(string str) { string sql = " select _imageurl from proimage where _imageid= '" + str + "' "; DataTable sdr = new BLL.product().getProductDS(sql).Tables[0]; if (sdr.Rows.Count > 0) { return sdr.Rows[0]["_imageurl"].ToString(); } else { return "images\\11_03.jpg"; } }