private void bindData() { BLL.wx_ucard_cardinfo cardBll = new BLL.wx_ucard_cardinfo(); Model.wx_ucard_cardinfo cardinfo = cardBll.GetModelBySid(sid); if (cardinfo != null) { imgTopPic.ImageUrl = cardinfo.noticePic; } BLL.wx_ucard_users userBll = new BLL.wx_ucard_users(); Model.wx_ucard_users user = userBll.GetStoreUserInfo(openid, sid); if (user == null) { return; } int degreeNum = 0; BLL.wx_ucard_fun.userDegree(sid, MyCommFun.Obj2Int(user.ttScore), "", out degreeNum); BLL.wx_ucard_notice nBll = new BLL.wx_ucard_notice(); IList <Model.wx_ucard_notice> nlist = nBll.GetModelList(" sid=" + sid + " and ( userDegree ='0' or userDegree like '%," + degreeNum + ",%' ) order by createDate desc"); StringBuilder noticeStr = new StringBuilder(); if (nlist != null && nlist.Count > 0) { Model.wx_ucard_notice notice = new Model.wx_ucard_notice(); for (int i = 0; i < nlist.Count; i++) { notice = nlist[i]; if (i == 0) { //第一条数据 noticeStr.Append("<div id=\"test0-header\" class=\"accordion_headings header_highlight \">"); noticeStr.Append(" <div class=\"tab new \">"); noticeStr.Append(" <span class=\"title\">" + notice.nName + "<p>" + notice.createDate.Value.ToString("yyyy年MM月dd日") + "</p>"); noticeStr.Append(" </span></div>"); noticeStr.Append(" <div id=\"test0-content\" style=\"display: block; overflow: hidden; opacity: 1;\"> "); noticeStr.Append("<div class=\"accordion_child\"><p class=\"xiangqing\">"); noticeStr.Append(notice.nContent); noticeStr.Append(" </p></div></div></div>"); } else { noticeStr.Append("<div id=\"test" + i + "-header\" class=\"accordion_headings \">"); noticeStr.Append("<div class=\"tab \">"); noticeStr.Append("<span class=\"title\">" + notice.nName + "<p>" + notice.createDate.Value.ToString("yyyy年MM月dd日") + "</p></span>"); noticeStr.Append("</div>"); noticeStr.Append(" <div id=\"test" + i + "-content\" style=\"display: none; overflow: hidden;\">"); noticeStr.Append("<div class=\"accordion_child\">"); noticeStr.Append("<p class=\"xiangqing\">" + notice.nContent + "</p>"); noticeStr.Append("</div> </div> </div>"); } } } litNoticeList.Text = noticeStr.ToString(); }
private void bindData() { BLL.wx_ucard_cardinfo cardBll = new BLL.wx_ucard_cardinfo(); Model.wx_ucard_cardinfo cardinfo = cardBll.GetModelBySid(sid); if (cardinfo != null) { imgTopPic.ImageUrl = cardinfo.noticePic; } BLL.wx_ucard_users userBll = new BLL.wx_ucard_users(); Model.wx_ucard_users user = userBll.GetStoreUserInfo(openid, sid); if (user == null) { return; } int degreeNum = 0; BLL.wx_ucard_fun.userDegree(sid, MyCommFun.Obj2Int(user.ttScore), "", out degreeNum); BLL.wx_ucard_notice nBll = new BLL.wx_ucard_notice(); IList<Model.wx_ucard_notice> nlist = nBll.GetModelList(" sid=" + sid + " and ( userDegree ='0' or userDegree like '%," + degreeNum + ",%' ) order by createDate desc"); StringBuilder noticeStr = new StringBuilder(); if (nlist != null && nlist.Count > 0) { Model.wx_ucard_notice notice=new Model.wx_ucard_notice(); for (int i = 0; i < nlist.Count; i++) { notice=nlist[i]; if (i == 0) { //第一条数据 noticeStr.Append("<div id=\"test0-header\" class=\"accordion_headings header_highlight \">"); noticeStr.Append(" <div class=\"tab new \">"); noticeStr.Append(" <span class=\"title\">" + notice.nName+ "<p>"+notice.createDate.Value.ToString("yyyy年MM月dd日")+"</p>"); noticeStr.Append(" </span></div>"); noticeStr.Append(" <div id=\"test0-content\" style=\"display: block; overflow: hidden; opacity: 1;\"> "); noticeStr.Append("<div class=\"accordion_child\"><p class=\"xiangqing\">"); noticeStr.Append(notice.nContent); noticeStr.Append(" </p></div></div></div>"); } else { noticeStr.Append("<div id=\"test"+i+"-header\" class=\"accordion_headings \">"); noticeStr.Append("<div class=\"tab \">"); noticeStr.Append("<span class=\"title\">" + notice.nName + "<p>" + notice.createDate.Value.ToString("yyyy年MM月dd日") + "</p></span>"); noticeStr.Append("</div>"); noticeStr.Append(" <div id=\"test"+i+"-content\" style=\"display: none; overflow: hidden;\">"); noticeStr.Append("<div class=\"accordion_child\">"); noticeStr.Append("<p class=\"xiangqing\">"+notice.nContent+"</p>"); noticeStr.Append("</div> </div> </div>"); } } } litNoticeList.Text = noticeStr.ToString(); }
private void ShowInfo(int id) { hidid.Value = id.ToString(); Model.wx_ucard_notice notice = noticeBll.GetModel(id); txtnName.Text = notice.nName; txtnContent.Value = notice.nContent; //赋值操作权限类型 if (notice.userDegree != null && notice.userDegree.Trim() != "") { string[] actionTypeArr = notice.userDegree.Split(','); for (int i = 0; i < cbluserDegree.Items.Count; i++) { for (int n = 0; n < actionTypeArr.Length; n++) { if (actionTypeArr[n].ToLower() == cbluserDegree.Items[i].Value.ToLower()) { cbluserDegree.Items[i].Selected = true; } } } } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { Model.wx_userweixin weixin = GetWeiXinCode(); int id = MyCommFun.Str2Int(hidid.Value); #region //先判断 string strErr = ""; if (this.txtnName.Text.Trim().Length == 0) { strErr += "通知名称不能为空!"; } if (this.txtnContent.Value.Trim().Length == 0) { strErr += "通知的内容不能为空!"; } if (strErr != "") { JscriptMsg(strErr, "back", "Error"); return; } #endregion Model.wx_ucard_notice notice = new Model.wx_ucard_notice(); if (id > 0) { notice = noticeBll.GetModel(id); } notice.nName = txtnName.Text.Trim(); notice.nContent = txtnContent.Value.Trim(); notice.sId = sid; string action_type_str = string.Empty; if (cbluserDegree.Items[0].Selected) { notice.userDegree = cbluserDegree.Items[0].Value; } else { action_type_str = ","; for (int i = 0; i < cbluserDegree.Items.Count; i++) { if (cbluserDegree.Items[i].Selected) { action_type_str += cbluserDegree.Items[i].Value + ","; } } // notice.userDegree = Utils.DelLastComma(action_type_str); notice.userDegree = action_type_str; } if (id <= 0) { //新增 notice.createDate = DateTime.Now; //1新增主表 id = noticeBll.Add(notice); AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加会员通知,主键为" + id); //记录日志 JscriptMsg("添加会员通知成功!", "notice_list.aspx?id=" + sid, "Success"); } else { //修改 //1修改主表 noticeBll.Update(notice); AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改会员通知,主键为" + id); //记录日志 JscriptMsg("修改会员通知成功!", "notice_list.aspx?id=" + sid, "Success"); } }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { Model.wx_userweixin weixin = GetWeiXinCode(); int id = MyCommFun.Str2Int(hidid.Value); #region //先判断 string strErr = ""; if (this.txtnName.Text.Trim().Length == 0) { strErr += "通知名称不能为空!"; } if (this.txtnContent.Value.Trim().Length == 0) { strErr += "通知的内容不能为空!"; } if (strErr != "") { JscriptMsg(strErr, "back", "Error"); return; } #endregion Model.wx_ucard_notice notice = new Model.wx_ucard_notice(); if (id > 0) { notice = noticeBll.GetModel(id); } notice.nName = txtnName.Text.Trim(); notice.nContent = txtnContent.Value.Trim(); notice.sId = sid; string action_type_str = string.Empty; if (cbluserDegree.Items[0].Selected) { notice.userDegree = cbluserDegree.Items[0].Value; } else { action_type_str = ","; for (int i = 0; i < cbluserDegree.Items.Count; i++) { if (cbluserDegree.Items[i].Selected) { action_type_str += cbluserDegree.Items[i].Value + ","; } } // notice.userDegree = Utils.DelLastComma(action_type_str); notice.userDegree = action_type_str; } if (id <= 0) { ChkAdminLevel("ucard_info", MXEnums.ActionEnum.Add.ToString()); //检查权限 //新增 notice.createDate = DateTime.Now; //1新增主表 id = noticeBll.Add(notice); AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加会员通知,主键为" + id); //记录日志 JscriptMsg("添加会员通知成功!", "notice_list.aspx?id=" + sid, "Success"); } else { ChkAdminLevel("ucard_info", MXEnums.ActionEnum.Edit.ToString()); //检查权限 //修改 //1修改主表 noticeBll.Update(notice); AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改会员通知,主键为" + id); //记录日志 JscriptMsg("修改会员通知成功!", "notice_list.aspx?id=" + sid, "Success"); } }