Пример #1
0
 private int findIndex(Hashtable[] ids, int page)
 {
     for (int i = 0; i < ids.Count(); i++)
     {
         if (page.ToString() == ids[i]["id"].ToString()) { return i; }
     }
     return 0;
 }
Пример #2
0
 /// <summary>
 /// 返回消息内容生成
 /// </summary>
 /// <param name="userMsg">用户消息</param>
 /// <param name="imgMsgs">图文消息们</param>
 /// <param name="isMark">是否添加星标</param>
 /// <returns>返回消息内容</returns>
 private string getMsgTpl(Hashtable userMsg, Hashtable[] imgMsgs, int isMark)
 {
     string strTp = @"<xml>
                     <ToUserName><![CDATA[" + userMsg["@FromUserName"] + @"]]></ToUserName>
                     <FromUserName><![CDATA[ZuoLinSpeaker]]></FromUserName>
                     <CreateTime>" + converttotimestamp ()+ @"</CreateTime>
                     <MsgType><![CDATA[news]]></MsgType>
                     <Content><![CDATA[]]></Content>
                     <ArticleCount>" + imgMsgs.Count() + @"</ArticleCount>
                     <Articles>";
     int index = 1;
     foreach (Hashtable imgMsg in imgMsgs)
     {
         strTp += @"<item>
          <Title><![CDATA[" + imgMsg["title"] + @"]]></Title>
          <Discription><![CDATA[" + imgMsg["body"] + @"]]></Discription>
          <PicUrl><![CDATA[" + (index == 1 ? imgMsg["picBig"].ToString() : imgMsg["picSmall"].ToString()) + @"]]></PicUrl>
          <Url><![CDATA[" + getUserUrl(userMsg, imgMsg["url"].ToString()) + @"]]></Url>
          </item>";
         index++;
     }
     strTp += @" </Articles>
                  <FuncFlag>"+isMark+@"</FuncFlag>
                 </xml>";
     return strTp;
 }