コード例 #1
0
ファイル: Helper.cs プロジェクト: ZanubKH/c-APP
        public string ItemToString(Item item)  ///This is for converting the Item into string ///
        {
            if (item is SingleLineItem)
            {
                SingleLineItem s = (SingleLineItem)item;

                string S = "<h2>" + s.Title + "</h2>";
                S += "\n<p> " + s.Text + " </p> ";
                S += "\n<h5>Posted by:   " + s.PersonName + "  ,  " + s.DatePosted + "</h5><hr>";
                return(S);
            }
            if (item is MultiLineItem)
            {
                MultiLineItem s = (MultiLineItem)item;
                string        S = "<h2>" + s.Title + "</h2>";
                S += "\n<p><ul>";
                foreach (string p in s.lines)
                {
                    S += "\n<li>   " + p + "  </li>";
                }
                S += "</ul></p>";
                S += "\n<h5>Posted by:   " + s.PersonName + "  ,  " + s.DatePosted + "</h5><hr>";
                return(S);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: ZanubKH/c-APP
        private void btnAddALineToAMultilineItem_Click(object sender, EventArgs e)
        {
            int    i = Convert.ToInt32(tbId.Text);
            string s = tbLineOfText.Text;

            foreach (Item im in myWebPart.GetAllItem())
            {
                if (im.Idnr == i)
                {
                    if (im is MultiLineItem)
                    {
                        MultiLineItem m = (MultiLineItem)im;
                        m.AddLine(s);
                        MessageBox.Show("Added ");
                    }
                }
            }
            MessageBox.Show("Not Exists");
        }