protected void Page_Load(object sender, EventArgs e)
 {
     int noveltyID =Convert.ToInt32(Request.QueryString["noveltyID"]);
     BLL.noveltyTb bllNovelty = new BLL.noveltyTb();
     Model.noveltyTb novelty = bllNovelty.GetModel(noveltyID);
     this.labelcommentNum.Text = novelty.commentNum.ToString();
     this.labelContent.Text = novelty.contents;
     this.labelID.Text = novelty.noveltyID.ToString();
     this.labelpublishTime.Text = novelty.publishtime.ToString();
     this.labelreportNum.Text = novelty.reportNum.ToString();
     BLL.userTb bllUser=new BLL.userTb();
     Model.userTb user=bllUser.GetModel(novelty.senderID);
     this.labelSenderName.Text = user.userName;
     this.labelsupportNum.Text = novelty.supportNum.ToString();
     this.labeltransmitNum.Text = novelty.transmitNum.ToString();
     BLL.noveltyGroupTb bllnoveltyGroup = new BLL.noveltyGroupTb();
     Model.noveltyGroupTb noveltyGroup = bllnoveltyGroup.GetModel(Convert.ToInt32(novelty.typeID));
     this.labelType.Text = noveltyGroup.noveltyGroupName;
     if (novelty.hasImgs == 1)
     {
         BLL.noveltyImagesTb bllNoveltyImages = new BLL.noveltyImagesTb();
         List<Model.noveltyImagesTb> noveltyImgs = bllNoveltyImages.GetModelList("noveltyID=" + novelty.noveltyID);
         StringBuilder html = new StringBuilder("");
         this.noveltyImgs.InnerHtml = "";
         foreach (var noveltyImg in noveltyImgs)
         {
             html.Append("<img src='" + noveltyImg.smallImgUrl + "' />");
         }
         this.noveltyImgs.InnerHtml = html.ToString();
     }
     else
     {
         this.noveltyImgs.InnerHtml = "无图片";
     }
 }
        public string AddNews(int sendID, string state, string txtcomment, string paths)
        {
            string[] s = paths.Split(';');

            //添加文字
            BLL.noveltyTb bll_notb = new BLL.noveltyTb();
            Model.noveltyTb mod_notb = new Model.noveltyTb();
            mod_notb.senderID = sendID;
            mod_notb.contents = txtcomment;

            mod_notb.state = state;
            if (s.Length == 1)
            {
                mod_notb.hasImgs = 0;
            }
            else
            {
                mod_notb.hasImgs = 1;
            }

            mod_notb.commentNum = 0;
            mod_notb.supportNum = 0;
            mod_notb.reportNum = 0;
            mod_notb.transmitNum = 0;
            mod_notb.publishtime = DateTime.Now;

            bll_notb.Add(mod_notb);

            int maxID = bll_notb.GetMaxId() - 1;

            BLL.noveltyImagesTb bll_noImg = new BLL.noveltyImagesTb();
            Model.noveltyImagesTb mod_Img = new Model.noveltyImagesTb();
            for (int i = 0; i < s.Length - 1; i++)
            {

                mod_Img.noveltyID = maxID;
                mod_Img.imgUrl = s[i];
                mod_Img.smallImgUrl = s[i];
                bll_noImg.Add(mod_Img);
            }

            return "添加成功";
        }
示例#3
0
        public string AddNews(int sendID,string state,string txtcomment,string paths)
        {
            string[] s = paths.Split(';');
            BLL.userTb bll_user = new BLL.userTb();
            Model.userTb me = new Model.userTb();
            me = bll_user.GetModel(sendID);

            //添加文字
            BLL.noveltyTb bll_notb = new BLL.noveltyTb();
            Model.noveltyTb mod_notb = new Model.noveltyTb();
            mod_notb.senderID = sendID;
            mod_notb.contents = txtcomment;

            mod_notb.state = state;
            if (s.Length == 1)
            {
                mod_notb.hasImgs = 0;
            }
            else {
                mod_notb.hasImgs = 1;
            }
            mod_notb.typeID = 1;
            mod_notb.commentNum = 0;
            mod_notb.supportNum = 0;
            mod_notb.reportNum = 0;
            mod_notb.transmitNum = 0;
            mod_notb.publishtime = DateTime.Now;

            bll_notb.Add(mod_notb);

            int maxID=bll_notb.GetMaxId()-1;

            BLL.noveltyImagesTb bll_noImg = new BLL.noveltyImagesTb();
            Model.noveltyImagesTb mod_Img = new Model.noveltyImagesTb();
            for (int i = 0; i < s.Length - 1; i++)
            {

                mod_Img.noveltyID = maxID;
                mod_Img.imgUrl = s[i];
                mod_Img.smallImgUrl = s[i];
                bll_noImg.Add(mod_Img);
            }
            string new_novelty = "";
            new_novelty += me.userName.ToString() + ";" + mod_notb.contents + ";" + mod_notb.publishtime.ToString() + ";" + mod_notb.supportNum.ToString() + ";" + mod_notb.transmitNum.ToString() + ";" + mod_notb.commentNum.ToString() + ";" + me.headImgUrl + ";" + maxID + ";";

            return new_novelty;
        }