/// <summary> /// 绑定活动类别的方法 /// </summary> public void BindTypeData() { BLL.wx_product_type sbll = new BLL.wx_product_type(); IList<Model.wx_product_type> typelist = sbll.GetModelList("wid=" + wid + " and store_id="+pid+" order by sort_id asc"); if (typelist != null && typelist.Count > 0) { StringBuilder sb = new StringBuilder(""); for (int i = 0; i < typelist.Count; i++) { string url = ""; if (typelist[i].tUrl != null && typelist[i].tUrl.Trim().Length > 0) { url = MyCommFun.urlAddOpenid(typelist[i].tUrl, openid); } else { url = MyCommFun.urlAddOpenid("index.aspx?tid=" + typelist[i].id + "&wid=" + wid + "&pid=" + pid,openid); } sb.Append(" <li>"); sb.Append("<a href=\"" + url + "\">" + typelist[i].tName); sb.Append("</a></li>"); } litTypeInfo.Text = sb.ToString(); } }
protected void Page_Load(object sender, EventArgs e) { openid = MyCommFun.RequestOpenid(); if (!IsPostBack) { if (MyCommFun.RequestInt("tid") == 0) { return; } BLL.wx_product_type sbll = new BLL.wx_product_type(); Model.wx_product_type type = sbll.GetModel(tid); if (type != null) { imgBanner.ImageUrl = type.icoPic; this.Title = type.tName; } else { imgBanner.Style.Add("display", "none"); } BindData(); BindRepeater(MyCommFun.RequestInt("page", 1)); } }
protected void Page_Load(object sender, EventArgs e) { openid = MyCommFun.RequestOpenid(); if (!IsPostBack) { if (MyCommFun.RequestInt("tid")==0) { return; } BLL.wx_product_type sbll = new BLL.wx_product_type(); Model.wx_product_type type = sbll.GetModel(tid); if (type != null ) { imgBanner.ImageUrl = type.icoPic; this.Title =type.tName; } else { imgBanner.Style.Add("display", "none"); } BindData(); BindRepeater(MyCommFun.RequestInt("page", 1)); } }
//删除类别 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("productsys", MXEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.wx_product_type bll = new BLL.wx_product_type(); int errNum = 0; int succNum = 0; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { succNum++; } else { errNum++; } } } if (errNum > 0) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除产品库数据"); //记录日志 JscriptMsg("有" + errNum + "失败,该产品库被占用,则无法删掉!", "product_Sys.aspx", "Success"); } else { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除产品库数据"); //记录日志 JscriptMsg("删除数据成功!", "product_Sys.aspx", "Success"); } }
/// <summary> /// 绑定活动类别的方法 /// </summary> public void BindTypeData() { BLL.wx_product_type sbll = new BLL.wx_product_type(); IList <Model.wx_product_type> typelist = sbll.GetModelList("wid=" + wid + " and store_id=" + pid + " order by sort_id asc"); if (typelist != null && typelist.Count > 0) { StringBuilder sb = new StringBuilder(""); for (int i = 0; i < typelist.Count; i++) { string url = ""; if (typelist[i].tUrl != null && typelist[i].tUrl.Trim().Length > 0) { url = MyCommFun.urlAddOpenid(typelist[i].tUrl, openid); } else { url = MyCommFun.urlAddOpenid("index.aspx?tid=" + typelist[i].id + "&wid=" + wid + "&pid=" + pid, openid); } sb.Append(" <li>"); sb.Append("<a href=\"" + url + "\">" + typelist[i].tName); sb.Append("</a></li>"); } litTypeInfo.Text = sb.ToString(); } }
//删除类别 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("weixin_sq", MXEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.wx_product_type bll = new BLL.wx_product_type(); int errNum = 0; int succNum = 0; for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { if (bll.Delete(id)) { succNum++; } else { errNum++; } } } if (errNum > 0) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除活动数据"); //记录日志 JscriptMsg("有" + errNum + "失败,该活动被占用,则无法删掉!", "baseinfo.aspx", "Success"); } else { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "删除活动数据"); //记录日志 JscriptMsg("删除数据成功!", "baseinfo.aspx", "Success"); } }
private void TreeBind() { Model.wx_userweixin weixin = GetWeiXinCode(); BLL.wx_product_type bll = new BLL.wx_product_type(); DataTable dt = bll.GetWCodeList(weixin.id, 0); this.ddlCategoryId.Items.Clear(); this.ddlCategoryId.Items.Add(new ListItem("所有类别", "")); foreach (DataRow dr in dt.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["tName"].ToString().Trim(); if (ClassLayer == 1) { this.ddlCategoryId.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlCategoryId.Items.Add(new ListItem(Title, Id)); } } }
private void TreeBind() { Model.wx_userweixin weixin = GetWeiXinCode(); BLL.wx_product_type bll = new BLL.wx_product_type(); DataTable dt = bll.GetWCodeList(weixin.id,0); this.ddlCategoryId.Items.Clear(); this.ddlCategoryId.Items.Add(new ListItem("所有类别", "")); foreach (DataRow dr in dt.Rows) { string Id = dr["id"].ToString(); int ClassLayer = int.Parse(dr["class_layer"].ToString()); string Title = dr["tName"].ToString().Trim(); if (ClassLayer == 1) { this.ddlCategoryId.Items.Add(new ListItem(Title, Id)); } else { Title = "├ " + Title; Title = Utils.StringOfChar(ClassLayer - 1, " ") + Title; this.ddlCategoryId.Items.Add(new ListItem(Title, Id)); } } }
//数据绑定 private void RptBind() { BLL.wx_product_type bll = new BLL.wx_product_type(); Model.wx_userweixin weixin = GetWeiXinCode(); string keywords = MyCommFun.QueryString("keywords"); int pid = MyCommFun.RequestInt("pid"); string whereStr = "wid=" + weixin.id; if (keywords.Trim().Length > 0) { whereStr += " and tName like '%" + keywords.Trim() + "%'"; } if (pid > 0) { whereStr += " and store_id=" + pid; } DataSet ds = bll.GetList(whereStr); if (ds == null || ds.Tables.Count <= 0) { return; } DataTable dt = ds.Tables[0]; if (dt != null) { DataRow dr; for (int i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; if (dr["icoPic"] != null && dr["icoPic"].ToString().Trim() != "") { if (dr["icoPic"].ToString().Contains(".")) { dr["icoPic"] = "<img src=\"" + dr["icoPic"].ToString() + "\" class=\"imgico\" />"; } else { dr["icoPic"] = "<span class=\"" + dr["icoPic"].ToString() + "\" />"; } } //链接处理,待做 if (dr["tUrl"] != null && dr["tUrl"].ToString().Trim() != "") { dr["tUrl"] = "<span class=\"lianjie_wai\">[外]</span>" + " <a href=\"javascript:;\">" + dr["tUrl"] + "</a>"; } else { dr["tUrl"] = "<span class=\"lianjie_ben\">[本]</span>" + " <a href=\"javascript:;\">" + MyCommFun.getWebSite() + "/weixin/product/index.aspx?wid=" + MyCommFun.ObjToStr(dr["wid"]) + "&tid=" + dr["id"] + "</a>"; } } } this.rptList.DataSource = dt; this.rptList.DataBind(); }
//数据绑定 private void RptBind() { BLL.wx_product_type bll = new BLL.wx_product_type(); Model.wx_userweixin weixin = GetWeiXinCode(); string keywords = MyCommFun.QueryString("keywords"); int pid = MyCommFun.RequestInt("pid"); string whereStr = "wid="+weixin.id; if (keywords.Trim().Length > 0) { whereStr += " and tName like '%" + keywords.Trim()+ "%'"; } if (pid > 0) { whereStr += " and store_id="+pid; } DataSet ds = bll.GetList(whereStr); if (ds == null || ds.Tables.Count<=0) { return; } DataTable dt = ds.Tables[0]; if (dt != null) { DataRow dr; for (int i = 0; i < dt.Rows.Count; i++) { dr = dt.Rows[i]; if (dr["icoPic"] != null && dr["icoPic"].ToString().Trim() != "") { if (dr["icoPic"].ToString().Contains(".")) { dr["icoPic"] = "<img src=\"" + dr["icoPic"].ToString() + "\" class=\"imgico\" />"; } else { dr["icoPic"] = "<span class=\"" + dr["icoPic"].ToString() + "\" />"; } } //链接处理,待做 if (dr["tUrl"] != null && dr["tUrl"].ToString().Trim() != "") { dr["tUrl"] = "<span class=\"lianjie_wai\">[外]</span>" + " <a href=\"javascript:;\">" + dr["tUrl"] + "</a>"; } else { dr["tUrl"] = "<span class=\"lianjie_ben\">[本]</span>" + " <a href=\"javascript:;\">" + MyCommFun.getWebSite() + "/weixin/product/index.aspx?wid=" + MyCommFun.ObjToStr(dr["wid"]) + "&tid=" + dr["id"] + "</a>"; } } } this.rptList.DataSource = dt; this.rptList.DataBind(); }
//保存排序 protected void btnSave_Click(object sender, EventArgs e) { ChkAdminLevel("producttype", MXEnums.ActionEnum.Edit.ToString()); //检查权限 BLL.wx_product_type bll = new BLL.wx_product_type(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); int sortId; if (!int.TryParse(((TextBox)rptList.Items[i].FindControl("txtSortId")).Text.Trim(), out sortId)) { sortId = 99; } bll.UpdateField(id, "sort_id=" + sortId.ToString()); } AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "保存产品库分类排序"); //记录日志 JscriptMsg("保存排序成功!", "prouductType_list.aspx", "Success"); }
private bool DoAdd() { try { Model.wx_product_type model = new Model.wx_product_type(); BLL.wx_product_type bll = new BLL.wx_product_type(); model.tName = txtTitle.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.tUrl = txtLinkUrl.Text.Trim(); int parentid = int.Parse(ddlParentId.SelectedValue); model.parentId = parentid; if (parentid > 0) { Model.wx_product_type parentModel = bll.GetModel(parentid); model.class_layer = parentModel.class_layer + 1; } else { model.class_layer = 1; } model.store_id = int.Parse(ddlPStore.SelectedValue); model.remark = txtContent.Value; model.icoPic = Request.Form["txtImgICO"].Trim();// txtImgICO.Text; Model.wx_userweixin weixin = GetWeiXinCode(); model.wid = weixin.id; model.creatDate = DateTime.Now; model.tel = txttel.Text; model.daohangurl = txtdaohangurl.Text; model.showDefault = rblshowDefault.SelectedItem.Value == "1"?true:false; if (bll.Add(model) > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加产品库分类:" + model.tName); //记录日志 return(true); } } catch { return(false); } return(false); }
private void ShowInfo(int _id) { BLL.wx_product_type bll = new BLL.wx_product_type(); Model.wx_product_type model = bll.GetModel(_id); txtTitle.Text = model.tName; txtSortId.Text = model.sort_id.ToString(); txtLinkUrl.Text = model.tUrl; txtContent.Value = model.remark; txtImgICO.Text = model.icoPic; if (model.icoPic != null && model.icoPic.Trim() != "") { if (model.icoPic.Contains("/")) { imgIco.ImageUrl = model.icoPic; } else { imgIco.Style.Add("display", "none"); litImgIco.Text = "<span class=\"" + model.icoPic + "\"></span>"; } } //父级分类 ddlParentId.SelectedValue = model.parentId.ToString(); if (model.store_id != null) { ddlPStore.SelectedValue = model.store_id.Value.ToString(); } txttel.Text = model.tel; txtdaohangurl.Text = model.daohangurl; rblshowDefault.SelectedValue = model.showDefault == null ? "0" : (model.showDefault ? "1" : "0"); }
private bool DoAdd() { try { Model.wx_product_type model = new Model.wx_product_type(); BLL.wx_product_type bll = new BLL.wx_product_type(); model.tName = txtTitle.Text.Trim(); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.tUrl = txtLinkUrl.Text.Trim(); int parentid=int.Parse(ddlParentId.SelectedValue); model.parentId = parentid; if (parentid > 0) { Model.wx_product_type parentModel = bll.GetModel(parentid); model.class_layer = parentModel.class_layer + 1; } else { model.class_layer = 1; } model.store_id = int.Parse(ddlPStore.SelectedValue) ; model.remark = txtContent.Value; model.icoPic = Request.Form["txtImgICO"].Trim();// txtImgICO.Text; Model.wx_userweixin weixin = GetWeiXinCode(); model.wid = weixin.id; model.creatDate = DateTime.Now; model.tel = txttel.Text; model.daohangurl = txtdaohangurl.Text; model.showDefault = rblshowDefault.SelectedItem.Value=="1"?true:false; if (bll.Add(model) > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加产品库分类:" + model.tName); //记录日志 return true; } } catch { return false; } return false; }
public void BindData(int id) { BLL.wx_product hdBll = new BLL.wx_product(); Model.wx_product huodong = hdBll.GetModel(id); Page.Title = huodong.hdName; litTheme.Text = huodong.pSubject; litCreateDate.Text = huodong.createDate == null ? "" : huodong.createDate.Value.ToString("yyyy-MM-dd"); if (huodong.extStr2 == null || huodong.extStr2.ToString().Trim() == "") { imgPic.Style.Add("display", "none"); } else { imgPic.ImageUrl = huodong.extStr2; } StringBuilder detailSB = new StringBuilder(); if (isNotNullFun(huodong.beginDate)) { detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); detailSB.Append("时间 :" + huodong.beginDate.Value.ToShortDateString() + " ~ "); if (isNotNullFun(huodong.endDate)) { detailSB.Append(huodong.endDate.Value.ToShortDateString()); } detailSB.Append(" </div></li>\r\n"); } if (isNotNullFun(huodong.addr)) { detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); detailSB.Append("地点 :" + huodong.addr); detailSB.Append(" </div></li>\r\n"); } if (isNotNullFun(huodong.pContent)) { //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); //detailSB.Append("活动内容 :"); //detailSB.Append(" </div></li>\r\n"); //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); //detailSB.Append(" " + huodong.hdContent); //detailSB.Append(" </div></li>\r\n"); litContent.Text = huodong.pContent; } litDetail.Text = detailSB.ToString(); //底部菜单设置 int wid = MyCommFun.RequestInt("wid"); string openid = MyCommFun.RequestOpenid(); BLL.wx_product_type hdtypeBll = new BLL.wx_product_type(); Model.wx_product_type type = hdtypeBll.GetModel(huodong.typeId.Value); StringBuilder bottomMenu = new StringBuilder(""); int num_dh = 0; if (isNotNullFun(type.tel)) { num_dh++; bottomMenu.Append(" <li> <a href=\"tel:" + type.tel + "\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/181.png\"><label>联系电话</label></a></li>"); } if (isNotNullFun(type.daohangurl)) { num_dh++; bottomMenu.Append(" <li> <a href=\"" + type.daohangurl + "\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/131.png\"><label>一键导航</label></a> </li>"); } if (isNotNullFun(type.showDefault) && type.showDefault) { bottomMenu.Append(" <li class=\"home\"><a href=\"/index.aspx?wid=" + wid + "&openid=" + openid + "\"></a></li>"); } num_dh++; if (isNotNullFun(huodong.url)) { num_dh++; string yudingName = "在线预定"; if (isNotNullFun(huodong.btnName)) { yudingName = huodong.btnName; } bottomMenu.Append(" <li> <a href=\"" + huodong.url + "\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/127.png\"><label>" + yudingName + "</label></a> </li>"); } if (num_dh == 4) { bottomMenu.Append("<li> <a href=\"http://m.baidu.com\">"); bottomMenu.Append("<img src=\"/images/templates/bottommenu/43.png\"><label>百度搜索</label></a> </li>"); } litdaohang.Text = bottomMenu.ToString(); }
public void BindData(int id) { BLL.wx_product hdBll = new BLL.wx_product(); Model.wx_product huodong = hdBll.GetModel(id); Page.Title = huodong.hdName; litTheme.Text = huodong.pSubject; litCreateDate.Text = huodong.createDate == null ? "" : huodong.createDate.Value.ToString("yyyy-MM-dd"); if (huodong.extStr2 == null || huodong.extStr2.ToString().Trim() == "") { imgPic.Style.Add("display", "none"); } else { imgPic.ImageUrl = huodong.extStr2; } StringBuilder detailSB = new StringBuilder(); if (isNotNullFun(huodong.beginDate)) { detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); detailSB.Append("时间 :" + huodong.beginDate.Value.ToShortDateString() + " ~ "); if (isNotNullFun(huodong.endDate)) { detailSB.Append(huodong.endDate.Value.ToShortDateString()); } detailSB.Append(" </div></li>\r\n"); } if (isNotNullFun(huodong.addr)) { detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); detailSB.Append("地点 :" + huodong.addr); detailSB.Append(" </div></li>\r\n"); } if (isNotNullFun(huodong.pContent)) { //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); //detailSB.Append("活动内容 :"); //detailSB.Append(" </div></li>\r\n"); //detailSB.Append(" <li class=\"newsmore\"><div class=\"olditem\">"); //detailSB.Append(" " + huodong.hdContent); //detailSB.Append(" </div></li>\r\n"); litContent.Text = huodong.pContent; } litDetail.Text = detailSB.ToString(); //底部菜单设置 int wid = MyCommFun.RequestInt("wid"); string openid = MyCommFun.RequestOpenid(); BLL.wx_product_type hdtypeBll = new BLL.wx_product_type(); Model.wx_product_type type = hdtypeBll.GetModel(huodong.typeId.Value); StringBuilder bottomMenu = new StringBuilder(""); int num_dh = 0; if (isNotNullFun(type.tel)) { num_dh++; bottomMenu.Append(" <li> <a href=\"tel:"+type.tel+"\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/181.png\"><label>联系电话</label></a></li>"); } if (isNotNullFun(type.daohangurl)) { num_dh++; bottomMenu.Append(" <li> <a href=\""+type.daohangurl+"\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/131.png\"><label>一键导航</label></a> </li>"); } if (isNotNullFun(type.showDefault) && type.showDefault) { bottomMenu.Append(" <li class=\"home\"><a href=\"/index.aspx?wid=" + wid + "&openid=" + openid + "\"></a></li>"); } num_dh++; if (isNotNullFun(huodong.url)) { num_dh++; string yudingName = "在线预定"; if (isNotNullFun(huodong.btnName)) { yudingName = huodong.btnName; } bottomMenu.Append(" <li> <a href=\"" + huodong.url+ "\">"); bottomMenu.Append(" <img src=\"/images/templates/bottommenu/127.png\"><label>" + yudingName + "</label></a> </li>"); } if (num_dh == 4) { bottomMenu.Append("<li> <a href=\"http://m.baidu.com\">"); bottomMenu.Append("<img src=\"/images/templates/bottommenu/43.png\"><label>百度搜索</label></a> </li>"); } litdaohang.Text = bottomMenu.ToString(); }