/// <summary> /// 获取二级导航 /// </summary> void GetOptionList() { string subid = string.Empty; if (Request["subid"] != null && Request["subid"] != "") { subid = Common.Common.NoHtml(Request["subid"]); } else { return; } if (subid.Trim() != null && subid.Trim() != "") { MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetSecHandCategoryList(" and UpID='" + subid + "' "); Response.Write(Dataset2Json(ds)); } else { Response.Write("{\"success\":\"操作失败\"}"); } Response.End(); }
/// <summary> /// 获取类别 /// </summary> void getinfo() { ddlbigcategorylist.Items.Clear(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand=" + ishand); DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = ""; dr["Cname"] = "--请选择类别--"; dt.Rows.InsertAt(dr, 0); ddlbigcategorylist.DataSource = ds.Tables[0].DefaultView; ddlbigcategorylist.DataTextField = "Cname"; ddlbigcategorylist.DataValueField = "ID"; ddlbigcategorylist.DataBind(); MSCustomersDAL customerDal = new MSCustomersDAL(); if (Session["customerID"] != null && Session["customerID"].ToString() != "") { phone = customerDal.GetCustomerValueByID("Phone", Session["customerID"].ToString()).ToString(); } UserPhone.Value = phone; }
/// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "") { if (Request["sch"] != null && Request["sch"] != "") { sch =Request["sch"]; } else { sch = ""; } ddlcategorylist.Items.Clear(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand="+sch+" "); DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = ""; dr["Cname"] = "--请选择类别--"; dt.Rows.InsertAt(dr, 0); DataRow firstdr = ds.Tables[0].NewRow(); firstdr["ID"] = "0"; firstdr["Cname"] = "--添加顶级导航--"; dt.Rows.InsertAt(firstdr, 1); ddlcategorylist.DataSource = ds.Tables[0].DefaultView; ddlcategorylist.DataTextField = "Cname"; ddlcategorylist.DataValueField = "ID"; ddlcategorylist.DataBind(); #region 初始化界面 if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } #endregion } else { return; } } }
/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = categoryDal.GetSecHandCategoryList(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); }
void showdetailinfo() { ddlcategorylist.Items.Clear(); MSProductCategoryDAL selectcategoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = selectcategoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand=" + sch + " "); DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); DataRow firstdr = ds.Tables[0].NewRow(); firstdr["ID"] = "0"; firstdr["Cname"] = "顶级导航"; dt.Rows.InsertAt(firstdr, 0); ddlcategorylist.DataSource = ds.Tables[0].DefaultView; ddlcategorylist.DataTextField = "Cname"; ddlcategorylist.DataValueField = "ID"; ddlcategorylist.DataBind(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet categoryDs = categoryDal.GetCategoryDetail(strID); MSProductCategory categoryModel = DataConvert.DataRowToModel <MSProductCategory>(categoryDs.Tables[0].Rows[0]); cname.Text = categoryModel.Cname; string parm = string.Empty; if (categoryModel.UpID.Trim() != null && categoryModel.UpID.Trim() != "") { parm = categoryModel.UpID; } else { parm = "0"; } ddlcategorylist.SelectedIndex = ddlcategorylist.Items.IndexOf(ddlcategorylist.Items.FindByValue(parm)); sortin.Text = categoryModel.Sortin.ToString(); if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } }
/// <summary> /// 页面加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "") { if (Request["sch"] != null && Request["sch"] != "") { sechand = " and CsecHand=" + Request["sch"] + " "; } else { sechand = ""; } ddlcategorylist.Items.Clear(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetSecHandCategoryList(" and UpID='' " + sechand); DataTable dt = ds.Tables[0]; DataRow dr = ds.Tables[0].NewRow(); dr["ID"] = ""; dr["Cname"] = "--全部--"; dt.Rows.InsertAt(dr, 0); DataRow firstdr = ds.Tables[0].NewRow(); firstdr["ID"] = "0"; firstdr["Cname"] = "顶级导航"; dt.Rows.InsertAt(firstdr, 1); ddlcategorylist.DataSource = ds.Tables[0].DefaultView; ddlcategorylist.DataTextField = "Cname"; ddlcategorylist.DataValueField = "ID"; ddlcategorylist.DataBind(); AspNetPager1.CurrentPageIndex = 1; string s = " and UpID='' " + sechand; ViewState[vsKey] = s; LoadData(s); } else { return; } } }
void GetCategoryList() { #region -------------------获取类别--------------------- MSProductCategory CategoryModel = new MSProductCategory(); MSProductCategoryDAL CategoryDal = new MSProductCategoryDAL(); DataSet BigCategoryds = CategoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand=1 "); DataSet SmallCategoryds = null; if (BigCategoryds != null && BigCategoryds.Tables.Count > 0 && BigCategoryds.Tables[0].Rows.Count > 0) { categoryhtml = ""; for (int i = 0; i < BigCategoryds.Tables[0].Rows.Count; i++) { string bigcname = BigCategoryds.Tables[0].Rows[i]["cname"].ToString(); string bigID = BigCategoryds.Tables[0].Rows[i]["ID"].ToString(); categoryhtml += "<ul class=\"list-unstyled pro_list\">"; categoryhtml += "\r\n<h4 class=\"col-lg-12\">" + bigcname + "</h4>"; SmallCategoryds = CategoryDal.GetSecHandCategoryList(" and UpID='" + bigID + "' "); if (SmallCategoryds != null && SmallCategoryds.Tables.Count > 0 && SmallCategoryds.Tables[0].Rows.Count > 0) { for (int j = 0; j < SmallCategoryds.Tables[0].Rows.Count; j++) { string smallcname = SmallCategoryds.Tables[0].Rows[j]["cname"].ToString(); string smallID = SmallCategoryds.Tables[0].Rows[j]["ID"].ToString(); categoryhtml += "\r\n<li class=\"col-lg-4 col-md-4 col-sm-4 col-xs-4 text-center\">\r\n" + "<a href=\"SecHandList.aspx?scid=" + smallID + "\">" + smallcname + "</a>\r\n" + "</li>"; } categoryhtml += "</ul>"; } } } #endregion #region -----------------获取最新发布的产品列表------------- MSProductDAL productDal = new MSProductDAL(); DataSet productds = productDal.GetProductByTop(30, " and a.IsSecHand=1 "); if (productds != null && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0) { string newpubpid = string.Empty; string newpubpname = string.Empty; string newpubdate; newpublist = ""; for (int i = 0; i < productds.Tables[0].Rows.Count; i++) { newpubpid = newpubpname = newpubdate = ""; newpubpid = productds.Tables[0].Rows[i]["ID"].ToString(); newpubpname = productds.Tables[0].Rows[i]["Ptitle"].ToString(); newpubdate = productds.Tables[0].Rows[i]["AddTime"].ToString(); newpubdate = Convert.ToDateTime(newpubdate).ToString("yy-MM-dd mm:ss"); newpubpname = Common.Common.NoHtml(newpubpname); if (newpubpname.ToString().Length > 15) { newpubpname = newpubpname.ToString().Substring(0, 13) + "..."; } newpublist += "<li title=\"" + newpubpname + "\">\r\n<a href=\"Product_detail.aspx?pid=" + newpubpid + "\">" + newpubpname + "<span>" + newpubdate + "</span></a>\r\n</li>\r\n"; } } #endregion }
/// <summary> /// 获取类别 /// </summary> void getinfo() { #region -----------一级导航绑定----------- ddlbigcategorylist.Items.Clear(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand=" + ishand); ddlbigcategorylist.DataSource = ds.Tables[0].DefaultView; ddlbigcategorylist.DataTextField = "Cname"; ddlbigcategorylist.DataValueField = "ID"; ddlbigcategorylist.DataBind(); #endregion string cid = string.Empty; string bigcid = string.Empty; if (pid.Trim() != null && pid.Trim() != "") { MSProductDAL productDal = new MSProductDAL(); DataSet productds = productDal.GetProductDetail(pid); MSProduct productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]); cid = productModel.Cid; ptitle.Value = productModel.Ptitle; pdesc.Value = productModel.Pcontent; price.Value = productModel.Price.ToString(); Review = productModel.Review; #region -----------获取一级类别编号------------ if (cid != null && cid != "") { string upid = string.Empty; try { upid = categoryDal.GetMSPCategoryValueByID("UpID", cid).ToString(); } catch (Exception) { } if (upid != null && upid != "") { bigcid = upid; } else { bigcid = cid; } setpvalue.Value = cid; } #endregion ddlbigcategorylist.SelectedIndex = ddlbigcategorylist.Items.IndexOf(ddlbigcategorylist.Items.FindByValue(bigcid)); #region ------------二级导航绑定------------------ if (bigcid != null && bigcid != "") { ddlsmallcategorylist.Items.Clear(); ds = categoryDal.GetSecHandCategoryList(" and UpID='" + bigcid + "' "); ddlsmallcategorylist.DataSource = ds.Tables[0].DefaultView; ddlsmallcategorylist.DataTextField = "Cname"; ddlsmallcategorylist.DataValueField = "ID"; ddlsmallcategorylist.DataBind(); if (cid != null && cid != "") { ddlsmallcategorylist.SelectedIndex = ddlsmallcategorylist.Items.IndexOf(ddlsmallcategorylist.Items.FindByValue(cid)); } } #endregion #region -------------获取图集--------------- MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); DataSet atlasDs = atlasDal.GetProductAtlasByPID(pid); int rowcount = 0; atlaslist = ""; if (atlasDs != null && atlasDs.Tables.Count > 0 && atlasDs.Tables[0].Rows.Count > 0) { rowcount = atlasDs.Tables[0].Rows.Count; for (int i = 0; i < rowcount; i++) { string imgurl = atlasDs.Tables[0].Rows[i]["PimgUrl"].ToString(); string imgid = atlasDs.Tables[0].Rows[i]["ID"].ToString(); string datarow = string.Empty; atlaslist += "\r\n<dd type=\"image\">\r\n" + "<input type=\"file\" accept=\"image/jpg, image/jpeg, image/png\" " + "onchange=\"form_pics.addImg(this);\" name=\"pics" + i + "\"><img dataid=\"" + imgid + "\" src=\"" + imgurl + "\">" + "\r\n<span onclick=\"form_pics.removeImg(this);\"> </span>\r\n" + "</dd>"; } } if (rowcount < 8) { atlaslist += "\r\n<dd datacount=\"" + rowcount + "\">\r\n" + "<input type=\"file\" accept=\"image/jpg, image/jpeg, image/png\" " + "onchange=\"form_pics.addImg(this);\" name=\"pics" + rowcount + "\"><img src=\"images/upload.png\">" + "\r\n<span onclick=\"form_pics.removeImg(this);\"> </span>\r\n" + "</dd>"; } altascount = rowcount; #endregion #region ----------------根据产品编号获取联系方式-------------------- MSShopContactsDAL contactDal = new MSShopContactsDAL(); DataSet contactDs = contactDal.GetContactDetailByPID(pid); if (contactDs != null && contactDs.Tables.Count > 0 && contactDs.Tables[0].Rows.Count > 0) { string uphone = string.Empty; string uname = string.Empty; uphone = contactDs.Tables[0].Rows[0]["Phone"].ToString(); uname = contactDs.Tables[0].Rows[0]["NickName"].ToString(); contactID = contactDs.Tables[0].Rows[0]["ID"].ToString(); UserPhone.Value = uphone; UserName.Value = uname; } #endregion } }