public static ReqMsgBase GetReqMsgEntity(XDocument doc) { ReqMsgBase reqMsg = null; string msgType = doc.Root.Element(CommonEnum.MSG_TYPE).Value; switch (msgType) { case MsgTypeEnum.TEXT: reqMsg = new ReqMsgText(); break; case MsgTypeEnum.EVENT: string eventType = doc.Root.Element(CommonEnum.EVENT_TYPE).Value; switch (eventType) { case "subscribe": reqMsg = new ReqEventSubscribe(); break; case "CLICK": reqMsg = new ReqEventClick(); break; } break; } EntityXmlHelper.FillEntityWithXml(reqMsg, doc); return(reqMsg); }
public virtual string ToXml() { this.CreateTime = DateTimeHelper.GetNowTime(); return(EntityXmlHelper.ConvertEntityToXml(this)); }