コード例 #1
0
ファイル: WXRequest.cs プロジェクト: Jackjet/cucentOA
        /// <summary>
        /// 根据微信请求的类型
        /// </summary>
        public WXRequest(string msgType)
        {
            this.msgType = msgType;
            switch (msgType)
            {
            case "text":
                _textmodel = new TextWXRequest_Model();
                break;

            case "image":
                _imagemodel = new ImageWXRequest_Model();
                break;

            case "location":
                _locationmodel = new LocationWXRequest_Model();
                break;

            case "link":
                _linkmodel = new LinkWXRequest_Model();
                break;

            case "event":
                _eventmodel = new EventWXRequest_Model();
                break;
            }
        }
コード例 #2
0
ファイル: WXRequest.cs プロジェクト: Jackjet/cucentOA
        /// <summary>
        /// 根据微信请求的类型
        /// </summary>
        public WXRequest(XmlDocument xmlObj)
        {
            XmlElement postElement = xmlObj.DocumentElement;

            ToUserName   = postElement.SelectSingleNode("ToUserName").InnerText;
            FromUserName = postElement.SelectSingleNode("FromUserName").InnerText;
            CreateTime   = postElement.SelectSingleNode("CreateTime").InnerText;
            MsgType      = postElement.SelectSingleNode("MsgType").InnerText;

            switch (MsgType)//信息类型 文本消息:text,消息类型:image,地理位置:location,链接消息:link,事件推送:event
            {
            case "text":
                textModel         = new TextWXRequest_Model();
                textModel.Content = postElement.SelectSingleNode("Content").InnerText;
                textModel.MsgId   = Convert.ToInt64(postElement.SelectSingleNode("MsgId").InnerText);
                break;

            case "image":
                imageModel        = new ImageWXRequest_Model();
                imageModel.PicUrl = postElement.SelectSingleNode("PicUrl").InnerText;
                imageModel.MsgId  = Convert.ToInt64(postElement.SelectSingleNode("MsgId").InnerText);
                break;

            case "location":
                locationModel            = new LocationWXRequest_Model();
                locationModel.Location_X = postElement.SelectSingleNode("Location_X").InnerText;
                locationModel.Location_Y = postElement.SelectSingleNode("Location_Y").InnerText;
                locationModel.Scale      = Convert.ToInt32(postElement.SelectSingleNode("Scale").InnerText);
                locationModel.Label      = postElement.SelectSingleNode("Label").InnerText;
                locationModel.MsgId      = Convert.ToInt64(postElement.SelectSingleNode("MsgId").InnerText);
                break;

            case "link":
                linkModel             = new LinkWXRequest_Model();
                linkModel.Title       = postElement.SelectSingleNode("Title").InnerText;
                linkModel.Description = postElement.SelectSingleNode("Description").InnerText;
                linkModel.Url         = postElement.SelectSingleNode("Url").InnerText;
                linkModel.MsgId       = Convert.ToInt64(postElement.SelectSingleNode("MsgId").InnerText);
                break;

            case "event":
                eventModel          = new EventWXRequest_Model();
                eventModel.Event    = postElement.SelectSingleNode("Event").InnerText;
                eventModel.EventKey = postElement.SelectSingleNode("EventKey").InnerText;
                break;
            }
        }
コード例 #3
0
ファイル: WXRequest.cs プロジェクト: a707937337/cucentOA
        /// <summary>
        /// 根据微信请求的类型
        /// </summary>
        public WXRequest(XmlDocument xmlObj)
        {
            XmlElement postElement = xmlObj.DocumentElement;
            ToUserName = postElement.SelectSingleNode("ToUserName").InnerText;
            FromUserName = postElement.SelectSingleNode("FromUserName").InnerText;
            CreateTime = postElement.SelectSingleNode("CreateTime").InnerText;
            MsgType = postElement.SelectSingleNode("MsgType").InnerText;

            switch (MsgType)//信息类型 文本消息:text,消息类型:image,地理位置:location,链接消息:link,事件推送:event
            {
                case "text":
                    textModel = new TextWXRequest_Model();
                    textModel.Content = postElement.SelectSingleNode("Content").InnerText;
                    textModel.MsgId = Convert.ToInt64(postElement.SelectSingleNode("MsgId").InnerText);
                    break;
                case "image":
                    imageModel = new ImageWXRequest_Model();
                    imageModel.PicUrl = postElement.SelectSingleNode("PicUrl").InnerText;
                    imageModel.MsgId = Convert.ToInt64(postElement.SelectSingleNode("MsgId").InnerText);
                    break;
                case "location":
                    locationModel = new LocationWXRequest_Model();
                    locationModel.Location_X = postElement.SelectSingleNode("Location_X").InnerText;
                    locationModel.Location_Y = postElement.SelectSingleNode("Location_Y").InnerText;
                    locationModel.Scale = Convert.ToInt32(postElement.SelectSingleNode("Scale").InnerText);
                    locationModel.Label = postElement.SelectSingleNode("Label").InnerText;
                    locationModel.MsgId = Convert.ToInt64(postElement.SelectSingleNode("MsgId").InnerText);
                    break;
                case "link":
                    linkModel = new LinkWXRequest_Model();
                    linkModel.Title = postElement.SelectSingleNode("Title").InnerText;
                    linkModel.Description = postElement.SelectSingleNode("Description").InnerText;
                    linkModel.Url = postElement.SelectSingleNode("Url").InnerText;
                    linkModel.MsgId = Convert.ToInt64(postElement.SelectSingleNode("MsgId").InnerText);
                    break;
                case "event":
                    eventModel = new EventWXRequest_Model();
                    eventModel.Event = postElement.SelectSingleNode("Event").InnerText;
                    eventModel.EventKey = postElement.SelectSingleNode("EventKey").InnerText;
                    break;
            }
        }
コード例 #4
0
ファイル: WXRequest.cs プロジェクト: a707937337/cucentOA
 /// <summary>
 /// 根据微信请求的类型
 /// </summary>
 public WXRequest(string msgType)
 {
     this.msgType = msgType;
     switch (msgType)
     {
         case "text":
             _textmodel = new TextWXRequest_Model();
             break;
         case "image":
             _imagemodel = new ImageWXRequest_Model();
             break;
         case "location":
             _locationmodel = new LocationWXRequest_Model();
             break;
         case "link":
             _linkmodel = new LinkWXRequest_Model();
             break;
         case "event":
             _eventmodel = new EventWXRequest_Model();
             break;
     }
 }