예제 #1
0
        protected string GetTuwenResponse(TextMessage tm)
        {
            TuwenMessage twMsg = new TuwenMessage();
            twMsg.FromUserName = tm.ToUserName;
            twMsg.ToUserName = tm.FromUserName;
            twMsg.CreateTime = WeiXinHelper.GetNowTime();

            TuwenArticleMessage article1 = new TuwenArticleMessage()
            {
                Title = "交大红娘团队",
                Description = "交大红娘团队成员有吴斯一, 陈楠,石皓,刘崇宵",
                PicUrl = "http://img.taopic.com/uploads/allimg/130716/318769-130G60Q62985.jpg",
                Url = "http://img.taopic.com/uploads/allimg/130716/318769-130G60Q62985.jpg"
            };

            TuwenArticleMessage article2 = new TuwenArticleMessage()
            {
                Title = "吴斯一,CEO",
                Description = "吴斯一,CEO",
                PicUrl = "http://e.hiphotos.baidu.com/image/h%3D200/sign=9e12075d6e224f4a4899741339f69044/d1a20cf431adcbef5ae00f7dafaf2edda2cc9ff0.jpg",
                Url = "http://e.hiphotos.baidu.com/image/h%3D200/sign=9e12075d6e224f4a4899741339f69044/d1a20cf431adcbef5ae00f7dafaf2edda2cc9ff0.jpg"
            };

            TuwenArticleMessage article3 = new TuwenArticleMessage()
            {
                Title = "陈楠,CTO",
                Description = "陈楠,CTO",
                PicUrl = "http://g.hiphotos.baidu.com/image/pic/item/9345d688d43f879412576a35d11b0ef41bd53a04.jpg",
                Url = "http://g.hiphotos.baidu.com/image/pic/item/9345d688d43f879412576a35d11b0ef41bd53a04.jpg"
            };

            TuwenArticleMessage article4 = new TuwenArticleMessage()
            {
                Title = "石皓,CFO",
                Description = "石皓,CFO",
                PicUrl = "http://g.hiphotos.baidu.com/image/pic/item/9345d688d43f879412576a35d11b0ef41bd53a04.jpg",
                Url = "http://g.hiphotos.baidu.com/image/pic/item/9345d688d43f879412576a35d11b0ef41bd53a04.jpg"
            };

            TuwenArticleMessage article5 = new TuwenArticleMessage()
            {
                Title = "刘崇宵,COO",
                Description = "刘崇宵,COO",
                PicUrl = "http://g.hiphotos.baidu.com/image/pic/item/9345d688d43f879412576a35d11b0ef41bd53a04.jpg",
                Url = "http://g.hiphotos.baidu.com/image/pic/item/9345d688d43f879412576a35d11b0ef41bd53a04.jpg"
            };

            twMsg.AddArticle(article1);
            twMsg.AddArticle(article2);
            twMsg.AddArticle(article3);
            twMsg.AddArticle(article4);
            twMsg.AddArticle(article5);

            return twMsg.GetResponseString();
        }
예제 #2
0
        public override void FromXML(XElement xmlObj)
        {
            ToUserName = xmlObj.Element(WeiXinConstants.TO_USERNAME).Value;
            FromUserName = xmlObj.Element(WeiXinConstants.FROM_USERNAME).Value;
            CreateTime = xmlObj.Element(WeiXinConstants.CREATE_TIME).Value;
            MsgType = xmlObj.Element(WeiXinConstants.MSG_TYPE).Value;
            ArticleCount = xmlObj.Element(WeiXinConstants.ARTICAL_COUNT).Value;

            XElement articlesElement = xmlObj.Element(WeiXinConstants.ARTICALS);
            articlesElement.Elements().ToList().ForEach(delegate(XElement ele)
            {
                TuwenArticleMessage articleDto = new TuwenArticleMessage() { TuwenMessage = this };
                articleDto.FromXML(ele);
                AddArticle(articleDto);
            });
        }
예제 #3
0
        public override void FromXML(XElement xmlObj)
        {
            ToUserName   = xmlObj.Element(WeiXinConstants.TO_USERNAME).Value;
            FromUserName = xmlObj.Element(WeiXinConstants.FROM_USERNAME).Value;
            CreateTime   = xmlObj.Element(WeiXinConstants.CREATE_TIME).Value;
            MsgType      = xmlObj.Element(WeiXinConstants.MSG_TYPE).Value;
            ArticleCount = xmlObj.Element(WeiXinConstants.ARTICAL_COUNT).Value;

            XElement articlesElement = xmlObj.Element(WeiXinConstants.ARTICALS);

            articlesElement.Elements().ToList().ForEach(delegate(XElement ele)
            {
                TuwenArticleMessage articleDto = new TuwenArticleMessage()
                {
                    TuwenMessage = this
                };
                articleDto.FromXML(ele);
                AddArticle(articleDto);
            });
        }
예제 #4
0
 public void AddArticle(TuwenArticleMessage value)
 {
     ArticleList.Add(value);
     ArticleCount = ArticleList.Count.ToString();
 }
예제 #5
0
 public void AddArticle(TuwenArticleMessage value)
 {
     ArticleList.Add(value);
     ArticleCount = ArticleList.Count.ToString();
 }