コード例 #1
0
        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 "添加成功";
        }
コード例 #2
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;
        }