protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["loginUser"] == null) { Response.Redirect("/admin/login.aspx"); return; } if (userId != 0) { ViewState["userId"] = userId; } DataSet ds = ProductTypeService.GetList("parentId = 0"); if (ds.Tables[0].Rows.Count > 0) { ddlProductType.DataSource = ds; ddlProductType.DataTextField = "typeName"; ddlProductType.DataValueField = "id"; ddlProductType.DataBind(); } ddlProductType.Items.Insert(0, new ListItem("请选择", "0")); this.ddlSon.Items.Insert(0, new ListItem("请选择", "0")); sp.InitBindData(Repeater1, pager1, "Product", "id", sear()); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { KeyWordBind(); //产品I am a DataSet ds = ProductTypeService.GetList("parentId = 0"); if (ds.Tables[0].Rows.Count > 0) { this.ddlProductType.DataSource = ds; ddlProductType.DataTextField = "typeName"; ddlProductType.DataValueField = "id"; ddlProductType.DataBind(); } ddlProductType.Items.Insert(0, new ListItem("Category", "0")); if (id != 0) { ViewState["id"] = id; } ViewState["headImg"] = "images/product_default.png"; BindData(); } }
/// <summary> /// 获取子类信息 /// </summary> /// <param name="id"></param> /// <returns></returns> protected string GetSon(object id) { StringBuilder sb = new StringBuilder(); DataSet ds = ProductTypeService.GetList("parentId = " + id); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { sb.Append(" <li><dl>"); sb.Append("<dt><a href=\"/project_" + id + "_" + dr["id"] + "_0_0_0_0_0_0.html\">" + dr["typeName"] + "</a></dt>"); sb.Append("<dd>"); DataSet ds2 = ProductTypeService.GetList("parentId = " + dr["id"]); if (ds2.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds2.Tables[0].Rows.Count; i++) { if (i == ds2.Tables[0].Rows.Count - 1) { sb.Append("<p><a href=\"/project_" + id + "_" + dr["id"] + "_" + ds2.Tables[0].Rows[i]["id"] + "_0_0_0_0_0.html\">" + ds2.Tables[0].Rows[i]["typeName"] + " </a></p>"); } else { sb.Append("<p><a href=\"/project_" + id + "_" + dr["id"] + "_" + ds2.Tables[0].Rows[i]["id"] + "_0_0_0_0_0.html\">" + ds2.Tables[0].Rows[i]["typeName"] + " </a>丨</p>"); } } } sb.Append("</dd>"); sb.Append("</dl></li>"); } } return(sb.ToString()); }
/// <summary> /// 加载数据 /// </summary> private void LoadData() { //产品类别下拉框 DataSet ds = ProductTypeService.GetList("typeValue = 0"); if (ds.Tables[0].Rows.Count > 0) { ddlProductType.DataSource = ds; ddlProductType.DataTextField = "typeName"; ddlProductType.DataValueField = "id"; ddlProductType.DataBind(); ddlSelProductType.DataSource = ds; ddlSelProductType.DataTextField = "typeName"; ddlSelProductType.DataValueField = "id"; ddlSelProductType.DataBind(); } ddlSelProductType.Items.Insert(0, new ListItem("请选择", "0")); ddlSelOne.Items.Insert(0, new ListItem("请选择", "0")); ddlProductType.Items.Insert(0, new ListItem("请选择", "0")); ddlOne.Items.Insert(0, new ListItem("请选择", "0")); ddlSelTwo.Items.Insert(0, new ListItem("请选择", "0")); ddlTwo.Items.Insert(0, new ListItem("请选择", "0")); }
/// <summary> /// 加载数据 /// </summary> private void LoadData() { //一级类别 DataSet ds = ProductTypeService.GetList("parentId = 0"); if (ds.Tables[0].Rows.Count > 0) { this.ddlOne.DataSource = ds; ddlOne.DataTextField = "typeName"; ddlOne.DataValueField = "id"; ddlOne.DataBind(); ddlSelProductType.DataSource = ds; ddlSelProductType.DataTextField = "typeName"; ddlSelProductType.DataValueField = "id"; ddlSelProductType.DataBind(); } ddlOne.Items.Insert(0, new ListItem("请选择", "0")); ddlSelProductType.Items.Insert(0, new ListItem("请选择", "0")); ddlSelTwo.Items.Insert(0, new ListItem("请选择", "0")); this.ddlSelThree.Items.Insert(0, new ListItem("请选择", "0")); ddlTwo.Items.Insert(0, new ListItem("请选择", "0")); this.ddlThree.Items.Insert(0, new ListItem("请选择", "0")); this.ddlFour.Items.Insert(0, new ListItem("请选择", "0")); }
/// <summary> /// 绑定数据 /// </summary> private void BindData() { DataSet ds = ProductTypeService.GetList("parentId = 0"); if (ds.Tables[0].Rows.Count > 0) { repOne.DataSource = ds; repOne.DataBind(); } }
/// <summary> /// 获取对象 /// </summary> private void LoadModelInfo() { Product item = ProductService.GetModel(id); if (item != null) { txtTjOrder.Text = item.speed.ToString(); txtStoreCount.Text = item.proType.ToString(); txtMobileGood.Text = item.stopTypeName; ddlRelieve.SelectedValue = item.relieveId.ToString(); ddlCook.SelectedValue = item.cookId.ToString(); this.content2.Value = item.advantage; lblImgUrl.Text = item.listImgUrl; Label1.Text = item.detailImg1; txtFrom.Text = item.fromName; ddlOne.SelectedValue = item.oneId.ToString(); txtProductName.Text = item.proName; content1.Value = item.proContent; content3.Value = item.ImgDesc; ddlTwo.Items.Clear(); DataSet ds = ProductTypeService.GetList("parentId = " + ddlOne.SelectedValue); if (ds.Tables[0].Rows.Count > 0) { ddlTwo.DataSource = ds; ddlTwo.DataTextField = "typeName"; ddlTwo.DataValueField = "id"; ddlTwo.DataBind(); } ddlTwo.Items.Insert(0, new ListItem("请选择", "0")); ddlTwo.SelectedValue = item.twoId.ToString(); ddlThree.Items.Clear(); ds = ProductTypeService.GetList("parentId = " + ddlTwo.SelectedValue); if (ds.Tables[0].Rows.Count > 0) { ddlThree.DataSource = ds; ddlThree.DataTextField = "typeName"; ddlThree.DataValueField = "id"; ddlThree.DataBind(); } this.ddlThree.Items.Insert(0, new ListItem("请选择", "0")); ddlThree.SelectedValue = item.threeId.ToString(); ddlVariety.SelectedValue = item.varietyId.ToString(); prodesc.Text = item.proDesc; unit1.Text = item.unit1; price1.Text = item.price1.ToString("0.00"); ViewState["userId"] = item.useId; } }
/// <summary> /// 控件行命令事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void repInfo_ItemCommand(object source, RepeaterCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); if (e.CommandName.Equals("del")) { ProductTypeService.Delete(id); sp.InitBindData(repInfo, this.pager1, "ProductType", "id", sear()); } if (e.CommandName.Equals("mod")) { ProductType item = ProductTypeService.GetModel(id); if (item != null) { this.txtTypeName.Text = item.typeName; ddlOne.SelectedValue = item.oneId.ToString(); ddlTwo.Items.Clear(); DataSet ds = ProductTypeService.GetList("parentId = " + ddlOne.SelectedValue); if (ds.Tables[0].Rows.Count > 0) { ddlTwo.DataSource = ds; ddlTwo.DataTextField = "typeName"; ddlTwo.DataValueField = "id"; ddlTwo.DataBind(); } ddlTwo.Items.Insert(0, new ListItem("请选择", "0")); ddlTwo.SelectedValue = item.twoId.ToString(); ddlThree.Items.Clear(); ds = ProductTypeService.GetList("parentId = " + ddlTwo.SelectedValue); if (ds.Tables[0].Rows.Count > 0) { ddlThree.DataSource = ds; ddlThree.DataTextField = "typeName"; ddlThree.DataValueField = "id"; ddlThree.DataBind(); } ddlThree.Items.Insert(0, new ListItem("请选择", "0")); ddlThree.SelectedValue = item.threeId.ToString(); if (item.imgUrl != "") { lblUrl.Text = item.imgUrl; Button6.Visible = true; } lblUrl2.Text = item.diaryImg; ViewState["mod"] = id; lblUrl3.Text = item.remark; txtNameEn.Text = item.typeDesc; ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "overKeyWordDiv();", true); } } }
/// <summary> /// 二级下拉 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlTwo_SelectedIndexChanged(object sender, EventArgs e) { ddlThree.Items.Clear(); DataSet ds = ProductTypeService.GetList("parentId = " + ddlTwo.SelectedValue); if (ds.Tables[0].Rows.Count > 0) { ddlThree.DataSource = ds; ddlThree.DataTextField = "typeName"; ddlThree.DataValueField = "id"; ddlThree.DataBind(); } this.ddlThree.Items.Insert(0, new ListItem("请选择", "0")); }
protected void ddlThree_SelectedIndexChanged(object sender, EventArgs e) { this.ddlFour.Items.Clear(); DataSet ds = ProductTypeService.GetList("parentId = " + ddlThree.SelectedValue); if (ds.Tables[0].Rows.Count > 0) { ddlFour.DataSource = ds; ddlFour.DataTextField = "typeName"; ddlFour.DataValueField = "id"; ddlFour.DataBind(); } ddlFour.Items.Insert(0, new ListItem("请选择", "0")); ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "", "overKeyWordDiv();", true); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { KeyWordBind(); //产品I am a DataSet ds = ProductTypeService.GetList("parentId = 0"); if (ds.Tables[0].Rows.Count > 0) { this.ddlProductType.DataSource = ds; ddlProductType.DataTextField = "typeName"; ddlProductType.DataValueField = "id"; ddlProductType.DataBind(); } ddlProductType.Items.Insert(0, new ListItem("Category", "0")); ViewState["imgUrl"] = "images/product_default.png"; UserInfo user = Session["user"] as UserInfo; if (user != null) { if (id != 0) { this.hidId.Value = id.ToString(); ViewState["id"] = id; Product p = ProductService.GetModel(id); if (p != null) { ViewState["modItem"] = p; if (p.listImgUrl != "") { ViewState["imgUrl"] = p.listImgUrl; } proname.Text = p.proName; ddlProductType.SelectedValue = p.productType.ToString(); storeCount.Text = p.proType.ToString(); unit1.Text = p.unit1; price1.Text = p.price1.ToString("0.00"); infoDesc.Text = p.advantage; } } } else { Response.Redirect("login.html"); } } }
public ActionResult Index(int rootId = 0, int parentId = 0, int childId = 0) { ViewBag.ListRoot = ProductTypeService.GetListByType((int)ProductCategoryLevelEnum.Root, 0); ViewBag.ListParent = ProductTypeService.GetListByType((int)ProductCategoryLevelEnum.Parent, rootId); ViewBag.ListChild = ProductTypeService.GetListByType((int)ProductCategoryLevelEnum.Child, parentId); var data = ProductTypeService.GetList(rootId, parentId, childId); var model = new ProductTypeViewModels { RootId = rootId, ParentId = parentId, ChildId = childId, Data = data }; return(View("Index", model)); }
/// <summary> /// 加载信息 /// </summary> private void LoadOneCate() { //产品类型 DataSet ds = ProductTypeService.GetList("parentId = 0"); if (ds.Tables[0].Rows.Count > 0) { this.ddlOne.DataSource = ds; ddlOne.DataTextField = "typeName"; ddlOne.DataValueField = "id"; ddlOne.DataBind(); } ddlOne.Items.Insert(0, new ListItem("请选择", "0")); this.ddlTwo.Items.Insert(0, new ListItem("请选择", "0")); this.ddlThree.Items.Insert(0, new ListItem("请选择", "0")); ds = TypeInfoService.GetList("infoType = 1"); if (ds.Tables[0].Rows.Count > 0) { ddlVariety.DataSource = ds; ddlVariety.DataTextField = "typeName"; ddlVariety.DataValueField = "id"; ddlVariety.DataBind(); } ddlVariety.Items.Insert(0, new ListItem("请选择", "0")); ds = TypeInfoService.GetList("infoType = 2"); if (ds.Tables[0].Rows.Count > 0) { this.ddlRelieve.DataSource = ds; ddlRelieve.DataTextField = "typeName"; ddlRelieve.DataValueField = "id"; ddlRelieve.DataBind(); } ddlRelieve.Items.Insert(0, new ListItem("请选择", "0")); ds = TypeInfoService.GetList("infoType = 3"); if (ds.Tables[0].Rows.Count > 0) { this.ddlCook.DataSource = ds; ddlCook.DataTextField = "typeName"; ddlCook.DataValueField = "id"; ddlCook.DataBind(); } ddlCook.Items.Insert(0, new ListItem("请选择", "0")); }
/// <summary> /// 绑定数据 /// </summary> private void BindData() { DataSet ds = ProductTypeService.GetList("parentId = 0"); if (ds.Tables[0].Rows.Count > 0) { repOne.DataSource = ds; repOne.DataBind(); } ///导航 ds = FriendsInfoService.GetList(5, "infoType = 12", "orderNum"); if (ds.Tables[0].Rows.Count > 0) { repBanner.DataSource = ds; repBanner.DataBind(); } }
/// <summary> /// 获取Category /// </summary> /// <returns></returns> protected string GetCate() { StringBuilder sb = new StringBuilder(); DataSet ds = ProductTypeService.GetList("parentId = " + oneId); if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { sb.Append("<li class=\"pro_z\"><a href=\"/project_1_" + ds.Tables[0].Rows[i]["id"] + "_0_0_0_0_0_0.html\">" + ds.Tables[0].Rows[i]["typeName"] + "</a></li>"); if (i != ds.Tables[0].Rows.Count - 1) { sb.Append("<li>|</li>"); } } } return(sb.ToString()); }
private void LoadData() { DataSet ds = ProductTypeService.GetList(8, "parentId = 0", "id"); if (ds.Tables[0].Rows.Count > 0) { ddlCate.DataSource = ds; ddlCate.DataTextField = "typeName"; ddlCate.DataValueField = "id"; ddlCate.DataBind(); } ddlCate.Items.Insert(0, new ListItem("请选择", "0")); ds = IndexProductService.GetList(""); if (ds.Tables[0].Rows.Count > 0) { repInfo.DataSource = ds; repInfo.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { KeyWordBind(); if (keywordvalue != "") { txtKeyWord.Text = keywordvalue; } if (twoId != 0) { ViewState["twoId"] = twoId; } if (threeId != 0) { ViewState["threeId"] = threeId; } if (fourId != 0) { ViewState["fourId"] = fourId; } if (fiveId != 0) { ViewState["fiveId"] = fiveId; } if (sixId != 0) { ViewState["sixId"] = sixId; } if (sevenId != 0) { ViewState["sevenId"] = sevenId; } ViewState["priceClass"] = "triangle top_active"; ViewState["commitClass"] = "triangle top_active"; ViewState["addtimeClass"] = "triangle top_active"; //和用户控件交互 Type ucType = this.bottom1.GetType(); PropertyInfo PageId = ucType.GetProperty("PageId"); PageId.SetValue(this.bottom1, 2, null); BindData(0); StringBuilder sb = new StringBuilder(); sb.Append("1=1"); DataSet ds = ProductTypeService.GetList(sb.ToString()); if (ds.Tables[0].Rows.Count > 0) { repType.DataSource = ds; repType.DataBind(); } //sb = new StringBuilder(); //sb.Append("1=1"); //if (oneId != 0 && ViewState["twoId"] != null) //{ // sb.Append(" and oneId = " + oneId + " and twoId = " + ViewState["twoId"]); // ds = ProductTypeService.GetList(sb.ToString()); // if (ds.Tables[0].Rows.Count > 0) // { // this.repSon.DataSource = ds; // repSon.DataBind(); // } //} } }