Esempio n. 1
0
 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);
 }
 public 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 ---------评论列表以及信息回复------------
     List <CommentListGetSet> commentModelList = new List <CommentListGetSet>();
     MSForumCommentDAL        commentDal       = new MSForumCommentDAL();
     DataSet commentDs = commentDal.GetCommentList(" and a.[uid]='" + strUid + "' ");
     DataSet repcommentds;
     List <CommentListGetSet> repcommentModelList = new List <CommentListGetSet>();
     int commentcount = 0;
     if (commentDs != null && commentDs.Tables.Count > 0 && commentDs.Tables[0].Rows.Count > 0)
     {
         foreach (DataRow row in commentDs.Tables[0].Rows)
         {
             CommentListGetSet commentModel = DataConvert.DataRowToModel <CommentListGetSet>(row);
             if (commentModel.NickName == null || commentModel.NickName == "")
             {
                 commentModel.NickName = "游客";
             }
             #region ----------------获取回复信息-----------------------
             string repid = commentModel.ID;
             repcommentds = commentDal.GetRepCommentList(" and a.[uid]='" + strUid + "' and a.UpID='" + repid + "' ");
             if (repcommentds != null && repcommentds.Tables.Count > 0 && repcommentds.Tables[0].Rows.Count > 0)
             {
                 foreach (DataRow reprow in repcommentds.Tables[0].Rows)
                 {
                     CommentListGetSet repcommentModel = DataConvert.DataRowToModel <CommentListGetSet>(reprow);
                     if (repcommentModel.NickName == null || repcommentModel.NickName == "")
                     {
                         repcommentModel.NickName = "游客";
                     }
                     repcommentModelList.Add(repcommentModel);
                 }
             }
             #endregion
             commentModelList.Add(commentModel);
         }
     }
     try
     {
         commentcount = commentDs.Tables[0].Rows.Count;
     }
     catch (Exception)
     {
         commentcount = 0;
     }
     #endregion
     #region --------------获取喜欢 总数------------------
     int likecount = 0;
     MSForumTopicLoveDAL likeDal = new MSForumTopicLoveDAL();
     try
     {
         likecount = likeDal.GetLoveOrLikeCountByUID(strUid, "tlike");
     }
     catch (Exception)
     {
         likecount = 0;
     }
     #endregion
     #region ------------获取消息总数---------------
     int msgcount = 0;
     try
     {
         msgcount = commentDal.GetCommentCountByUID(strUid);
     }
     catch (Exception)
     {
         msgcount = 0;
     }
     #endregion
     #region ---------帖子总数-------------
     int             topiccount = 0;
     MSForumTopicDAL topicdal   = new MSForumTopicDAL();
     try
     {
         topiccount = topicdal.GetTopicCountByUID(strUid);
     }
     catch (Exception)
     {
         topiccount = 0;
     }
     #endregion
     string text = System.IO.File.ReadAllText(Server.MapPath("HtmlPage/Mycommentlist.html"));
     JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
     JinianNet.JNTemplate.Template        t       = new JinianNet.JNTemplate.Template(context, text);
     context.TempData["customer"]       = CustomerModel;
     context.TempData["commentlist"]    = commentModelList;
     context.TempData["repcommentlist"] = repcommentModelList;
     context.TempData["fid"]            = strfid;
     context.TempData["likecount"]      = likecount;
     context.TempData["msgcount"]       = msgcount;
     context.TempData["topiccount"]     = topiccount;
     context.TempData["errorscript"]    = errorscript;
     context.TempData["uid"]            = strUid;
     context.TempData["footer"]         = "奥琦微商易";
     t.Render(Response.Output);
 }