void repcomment() { string commentdesc = string.Empty; StreamReader rd = new StreamReader(Server.MapPath("emotion/key.txt")); string keyword = rd.ReadLine(); try { commentdesc = HttpContext.Current.Request.Form.Get("commentdesc").ToString(); } catch (Exception) { commentdesc = ""; } if (commentdesc.Trim() != null && commentdesc.Trim() != "") { commentdesc = JQDialog.FilterKeyWord(commentdesc, keyword); commentdesc = JQDialog.GetTextFromHTML(commentdesc); MSForumComment commentModel = new MSForumComment(); MSForumCommentDAL commentDal = new MSForumCommentDAL(); commentModel.ID = Guid.NewGuid().ToString("N").ToUpper(); commentModel.Ctext = commentdesc; commentModel.Review = 1; commentModel.TID = strTid; commentModel.UID = strUid; commentModel.UpID = strupid; commentModel.Cstate = 0; if (commentDal.AddComment(commentModel)) { errorscript = JQDialog.alertOKMsgBox(3, "回复成功", "MyCommentList.aspx?fid=" + strfid, "error"); } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请核对后再操作!", true); } } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请重新再操作!", true); } }
/// <summary> /// 获取店铺商品信息 /// </summary> void GetInfo() { #region 获取店铺详细 MSShopDAL shopdal = new MSShopDAL(); DataSet shopds = shopdal.GetMSShopDetail(shopid); MSShop shopmodel = new MSShop(); string pagetitle = string.Empty; if (null != shopds && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0) { shopmodel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]); pagetitle = shopmodel.ShopName; } #endregion List <MSProduct> ProductModel = new List <MSProduct>(); MSProductDAL productdal = new MSProductDAL(); MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); List <MSProductAtlas> AtlasModel = new List <MSProductAtlas>(); List <ProductPara> ParaListModel = new List <ProductPara>(); MSProductParaDAL paraDal = new MSProductParaDAL(); string thpid = string.Empty; #region 获取产品列表 DataSet productds = null; string cid = string.Empty; string like = string.Empty; if (Request["cid"] != null && Request["cid"] != "") { cid = Common.Common.NoHtml(Request["cid"]); } if (cid.Trim() != null && cid.Trim() != "") { cid = " and a.[CID]='" + cid + "' "; } if (Request["like"] != null && Request["like"] != "") { like = Common.Common.NoHtml(Request["like"]); } if (like.Trim() != null && like.Trim() != "") { like = " and a.Ptitle like '%" + like + "%' "; } productds = productdal.GetProductList(" and a.[SID]='" + shopid + "' " + cid + like); DataSet atlasDs = null; foreach (DataRow row in productds.Tables[0].Rows) { MSProduct model = DataConvert.DataRowToModel <MSProduct>(row); string pdesc = model.Pcontent; pdesc = JQDialog.GetTextFromHTML(pdesc); if (pdesc.Length > 50) { pdesc = pdesc.ToString().Substring(0, 50) + "..."; } model.Pcontent = pdesc; ProductModel.Add(model); thpid = model.ID; #region 获取产品默认展示图 atlasDs = atlasDal.GetDefaultAtlasByPid(thpid); foreach (DataRow atlasrow in atlasDs.Tables[0].Rows) { MSProductAtlas atlasdetailmodel = DataConvert.DataRowToModel <MSProductAtlas>(atlasrow); AtlasModel.Add(atlasdetailmodel); } #endregion #region -------获取产品型号及价格------------ DataSet parads = paraDal.GetMaxMinPrice(thpid); if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0) { foreach (DataRow pararow in parads.Tables[0].Rows) { ProductPara paramodel = DataConvert.DataRowToModel <ProductPara>(pararow); ParaListModel.Add(paramodel); } } #endregion } #endregion #region 获取产品类别 List <MSProductCategory> CategoryModel = new List <MSProductCategory>(); MSProductCategoryDAL categorydal = new MSProductCategoryDAL(); DataSet categoryds = categorydal.GetMSPCList(" and a.[SID]='" + shopid + "' "); foreach (DataRow row in categoryds.Tables[0].Rows) { MSProductCategory model = DataConvert.DataRowToModel <MSProductCategory>(row); CategoryModel.Add(model); } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/MyShop.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = pagetitle; context.TempData["ShopDetail"] = shopmodel; context.TempData["shopid"] = shopid; context.TempData["productlist"] = ProductModel; context.TempData["defaultatlas"] = AtlasModel; context.TempData["categorylist"] = CategoryModel; context.TempData["paralist"] = ParaListModel; context.TempData["errormsg"] = errormsg; context.TempData["customerid"] = customerid; if (Session["customerID"] != null && Session["customerID"].ToString() != "") { context.TempData["uid"] = Session["customerID"].ToString(); } context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
void GetTopicList() { #region ---------------论坛详细---------------------- MSForumSetDAL ForumDal = new MSForumSetDAL(); MSForumTopicDAL topicDal = new MSForumTopicDAL(); MSForumSet ForumModel = new MSForumSet(); string pagetitle = string.Empty; int topicCount = 0; int forumvisit = 0; DataSet ForumDs = ForumDal.GetMSForumSetDetail(strfid); if (ForumDs != null && ForumDs.Tables.Count > 0 && ForumDs.Tables[0].Rows.Count > 0) { ForumModel = DataConvert.DataRowToModel <MSForumSet>(ForumDs.Tables[0].Rows[0]); pagetitle = ForumModel.FTitle; forumvisit = ForumModel.Visit; } try { topicCount = Convert.ToInt32(topicDal.GetMSForumTopicCount(strfid)); } catch (Exception) { topicCount = 0; } forumvisit = forumvisit + 1; if (strUID != null && strUID != "") { ForumDal.UpdateForumVist(forumvisit, strfid); } #endregion #region --------------获取帖子列表------------------ List <TopicModelList> topicModellist = new List <TopicModelList>(); DataSet topiclistds = topicDal.GetMSForumTopicList(" and a.fid='" + strfid + "' ", 0); if (topiclistds != null && topiclistds.Tables.Count > 0 && topiclistds.Tables[0].Rows.Count > 0) { foreach (DataRow row in topiclistds.Tables[0].Rows) { TopicModelList topicmodel = DataConvert.DataRowToModel <TopicModelList>(row); if (topicmodel.NickName == null || topicmodel.NickName == "" || topicmodel.NickName.Length < 1) { topicmodel.NickName = "游客"; } if (topicmodel.HeadImg == null || topicmodel.HeadImg == "") { topicmodel.HeadImg = "images/2.png"; } string msg = topicmodel.TopicDesc; msg = JQDialog.GetTextFromHTML(msg); if (msg.Length > 250) { msg = msg.ToString().Substring(0, 100) + "..."; } topicmodel.TopicDesc = msg; topicModellist.Add(topicmodel); } } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/index.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); context.TempData["errorscript"] = errorscript; context.TempData["uid"] = strUID; context.TempData["title"] = pagetitle; context.TempData["ForumDetail"] = ForumModel; context.TempData["topicCount"] = topicCount; context.TempData["topiclist"] = topicModellist; context.TempData["forumvisit"] = forumvisit; context.TempData["footer"] = "奥琦微商易"; t.Render(Response.Output); }
void getTemplate() { #region -----------获取客户信息--------- MSCustomers CustomerModel = new MSCustomers(); MSCustomersDAL CustomerDal = new MSCustomersDAL(); DataSet CustomerDs; if (strUid != null && strUid != "") { CustomerDs = CustomerDal.GetCustomerDetail(strUid); if (null != CustomerDs && CustomerDs.Tables.Count > 0 && CustomerDs.Tables[0].Rows.Count > 0) { CustomerModel = DataConvert.DataRowToModel <MSCustomers>(CustomerDs.Tables[0].Rows[0]); if (CustomerModel.NickName == null || CustomerModel.NickName == "" || CustomerModel.NickName.ToLower() == "null") { CustomerModel.NickName = "游客"; } } } #endregion #region ----------获取帖子列表---------------- MSForumTopicDAL topicDal = new MSForumTopicDAL(); List <TopicModelList> topicModellist = new List <TopicModelList>(); int topicCount = 0; DataSet topiclistds = topicDal.GetMSForumTopicList(" and a.[UID]='" + strUid + "' ", 0); if (topiclistds != null && topiclistds.Tables.Count > 0 && topiclistds.Tables[0].Rows.Count > 0) { topicCount = topiclistds.Tables[0].Rows.Count; foreach (DataRow row in topiclistds.Tables[0].Rows) { TopicModelList topicmodel = DataConvert.DataRowToModel <TopicModelList>(row); if (topicmodel.NickName == null || topicmodel.NickName == "" || topicmodel.NickName.Length < 1) { topicmodel.NickName = "游客"; } if (topicmodel.HeadImg == null || topicmodel.HeadImg == "") { topicmodel.HeadImg = "images/2.png"; } string msg = topicmodel.TopicDesc; msg = JQDialog.GetTextFromHTML(msg); if (msg.Length > 250) { msg = msg.ToString().Substring(0, 100) + "..."; } topicmodel.TopicDesc = msg; topicModellist.Add(topicmodel); } } #endregion #region --------------获取喜欢 总数------------------ int likecount = 0; MSForumTopicLoveDAL likeDal = new MSForumTopicLoveDAL(); try { likecount = likeDal.GetLoveOrLikeCountByUID(strUid, "tlike"); } catch (Exception) { likecount = 0; } #endregion #region ------------获取消息总数--------------- int msgcount = 0; MSForumCommentDAL commentDal = new MSForumCommentDAL(); try { msgcount = commentDal.GetCommentCountByUID(strUid); } catch (Exception) { msgcount = 0; } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/othertopiclist.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); context.TempData["mytopiclist"] = topicModellist; context.TempData["topiccount"] = topicCount; context.TempData["customer"] = CustomerModel; context.TempData["fid"] = strfid; context.TempData["likecount"] = likecount; context.TempData["msgcount"] = msgcount; context.TempData["errorscript"] = errorscript; context.TempData["uid"] = strUid; context.TempData["myuid"] = strMyUid; context.TempData["footer"] = "奥琦微商易"; t.Render(Response.Output); }
void topicpublish() { string topicdesc = string.Empty; #region --------获取标题和内容--------------- try { topictitle = HttpContext.Current.Request.Form.Get("topictitle").ToString(); } catch (Exception) { topictitle = ""; } try { topicdesc = HttpContext.Current.Request.Form.Get("topicdeschidden").ToString(); } catch (Exception) { topicdesc = ""; } #endregion MSForumTopicDAL forumtopicDal = new MSForumTopicDAL(); MSForumTopic forumtopicModel = new MSForumTopic(); StreamReader rd = new StreamReader(Server.MapPath("emotion/key.txt")); string keyword = rd.ReadLine(); if (topictitle != null && topictitle != "") { topictitle = JQDialog.FilterKeyWord(topictitle, keyword); topictitle = JQDialog.GetTextFromHTML(topictitle); forumtopicModel.TopicTitle = topictitle; } if (topicdesc != null && topicdesc != "") { topicdesc = JQDialog.FilterKeyWord(topicdesc, keyword); topicdesc = JQDialog.GetTextFromHTML(topicdesc); forumtopicModel.TopicDesc = topicdesc; } if (!forumtopicDal.ExistMSForumTopic(topictitle, strfid, strUid)) { strTid = Guid.NewGuid().ToString("N").ToUpper(); forumtopicModel.ID = strTid; forumtopicModel.TopicState = 0; forumtopicModel.FID = strfid; forumtopicModel.Treview = 1; forumtopicModel.UID = strUid; SaveImages(); if (forumtopicDal.AddMSForumTopic(forumtopicModel)) { errorscript = JQDialog.alertOKMsgBox(5, "操作成功", "MyTopicList.aspx?fid=" + strfid, "succeed"); } else { errorscript = JQDialog.alertOKMsgBoxGoBack(5, "操作失败<br/>请核对后再操作!", true); } } else { errorscript = JQDialog.alertOKMsgBoxGoBack(5, "操作失败<br/>请核对后再操作!", true); } }