private void CreatChanOKbutton_Click(object sender, EventArgs e) { Topic newtopic = new Topic(); string topicname = nameTextBox.Text; string topicdesc = DesptextBox.Text; string topicurl = URLtextBox.Text; if (topicname != null && topicname.Trim().Length > 0) { newtopic.TopicName = topicname; newtopic.TopicDesc = topicdesc; newtopic.Url = topicurl; newtopic.CreateTime = DateTime.Now; newtopic.UnreadCount = 0; newtopic.TopType = 0; newtopic.AccountId = InfoSource.curuser.UserId; DataOperation InsertNewTopic = new DataOperation(); if(InsertNewTopic.InsertNewTopic(newtopic)) { MessageBox.Show("新的栏目添加成功.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); InfoSource.AddTopic(newtopic); } else { MessageBox.Show("新的栏目添加失败!囧…….", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("组名不能为空格或空字符.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button1_Click(object sender, EventArgs e) { string tagNameString = textBox1.Text.ToString(); if (tagNameString != null && tagNameString.Trim().Length > 0) { Tags tags = new Tags(); tags.tagName = tagNameString; tags.tagItemCount = 0; tags.tagFatherId = 0; tags.tagCreateTime = DateTime.Now; tags.UserId = InfoSource.curuser.UserId; InfoSource.AddTags(tags); //更新tag标签分类的TreeView; DataOperation insertTag = new DataOperation(); int flag = insertTag.InsertNewTags(tags); if(flag == 0) MessageBox.Show("该标签已经存在!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); else if(flag == -1) MessageBox.Show("插入标签失败!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); else { tags.tagId = flag; MessageBox.Show("创建标签成功!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); InfoSource.AddTags(tags); } } else { MessageBox.Show("标签不能为空格或空字符.", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// ͬ������ /// </summary> /// <param name="htmlId"></param> public HtmlBuilder(int htmlId) { rssId = htmlId; LoadHtmlTemplate("html"); Op_InsertItems = new DataOperation(); rssUrl = InfoSource.GetRssLinkById(rssId); rsstitle = InfoSource.GetRssTitleById(rssId); GetItems(rssUrl); BuildeHtml(); }
private void button2_Click(object sender, EventArgs e) { string tagText = comboBox1.Text; int tagid = InfoSource.GetTagIdByName(tagText); if(tagid != -1) { ArrayList tagidlist = new ArrayList(); tagidlist.Add(tagid); DataOperation InsertTagToItem = new DataOperation(); InsertTagToItem.InsertTagsIdlistByItemstrId(tagidlist, str_itemid); InfoSource.AddTagToItem(tagid, str_itemid); } else { MessageBox.Show("No This Tag!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void ListView1_Click(object sender, EventArgs e) { string str_itemid = string.Empty; if (this.ListView1.SelectedItems != null) //判断ListView控件是否有项目选中 { str_itemid = this.ListView1.SelectedItems[0].SubItems[7].Text; } DataOperation GetHtml = new DataOperation(); string html = GetHtml.GetItemHtmlById(str_itemid); htmlTextBox1.DocumentText = html; }
private void EditNewWinMenuItem_Click(object sender, EventArgs e) { string str_itemid = string.Empty; if (this.ListView1.SelectedItems != null) //判断ListView控件是否有项目选中 { str_itemid = this.ListView1.SelectedItems[0].SubItems[7].Text; } DataOperation GetHtml = new DataOperation(); string html = GetHtml.GetItemHtmlById(str_itemid); Form EditDia = new HTMLEdit(html); EditDia.Show(); }
private void DeletItemToolStripMenuItem_Click(object sender, EventArgs e) { string str_itemid = string.Empty; if (this.ListView1.SelectedItems != null) //判断ListView控件是否有项目选中 { str_itemid = this.ListView1.SelectedItems[0].SubItems[7].Text; this.ListView1.Items.Remove(this.ListView1.SelectedItems[0]); DataOperation DeleteItem = new DataOperation(); DeleteItem.DeleteItemByItemId(str_itemid); } }
private void DeleteChanbutton_Click(object sender, EventArgs e) { int chanId=0; string chanName = ""; if (this.treeView1.Nodes.Count != 0) { if (this.treeView1.SelectedNode.Parent != null) { chanName = this.treeView1.SelectedNode.Text; this.treeView1.SelectedNode.Remove(); chanId = InfoSource.GetRssIdByName(chanName); InfoSource.DeleteRssbyname(chanName); DataOperation DeleteRsss = new DataOperation(); DeleteRsss.DeleteRssById(chanId); //数据库中 MessageBox.Show("删除成功!"); } else { MessageBox.Show("不能删除频道组", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("请选择要删除的频道!", "", MessageBoxButtons.OK, MessageBoxIcon.Information); } //string delName; //delName=treeView1.SelectedNode.Name; //treeView1.SelectedNode.Remove(); //delete(del); //修改数据库; }
public InfoSource() { dataop = new DataOperation(); //_TopicList.Clear(); }