public List <RecContent> GetRecContentList() { try { string sql = "select * from RecContent"; DataTable da = SQLiteHelper.ExecteDataTable(sql); List <RecContent> list = null; if (da.Rows.Count > 0) { list = new List <RecContent>(); RecContent memberinfo = null; foreach (DataRow row in da.Rows) { memberinfo = new RecContent(); LoadEntity(memberinfo, row); list.Add(memberinfo); } } return(list); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(null); } }
private static void LoadEntity(RecContent memberinfo, DataRow row) { memberinfo.ID = Convert.ToInt32(row["ID"]); memberinfo.recName = row["recName"].ToString(); memberinfo.record = row["record"].ToString(); memberinfo.FID = Convert.ToInt32(row["FID"]); memberinfo.DelFlag = Convert.ToBoolean(row["DelFlag"]); }
public bool updaterRecNameByID(RecContent content) { string sql = "update RecContent set recName=@name where ID=@id"; SQLiteParameter[] pms = { new SQLiteParameter("@name", content.recName), new SQLiteParameter("@id", content.ID) }; return(SQLiteHelper.ExecuteNonQuery(sql, pms) > 0); }
public int InsertMemberInfo(RecContent reccontent) { try { string sql = "insert into RecContent values(@id,@recname,@record ,@FID,@delflag)"; SQLiteParameter[] pms = { new SQLiteParameter("@id", reccontent.ID), new SQLiteParameter("@recname", reccontent.recName), new SQLiteParameter("@record", reccontent.record), new SQLiteParameter("@FID", reccontent.FID), new SQLiteParameter("@delflag", reccontent.DelFlag), }; return(SQLiteHelper.ExecuteNonQuery(sql, pms)); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(0); } }
public bool updaterRecNameByID(RecContent content) { return(dal.updaterRecNameByID(content)); }
public bool InsertMemberInfo(RecContent reccontent) { return(dal.InsertMemberInfo(reccontent) > 0); }
private void treeView1_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { if (e.Label != null) { if (e.Label.Length > 0) { if (e.Label.IndexOfAny(new char[] { '@', '.', ',', '!' }) == -1) { // Stop editing without canceling the label change. e.Node.EndEdit(true); if (e.Node.Parent != null) { RecContent content = new RecContent(); content.ID = Convert.ToInt32(e.Node.Tag); //子节点, content.FID = Convert.ToInt32(e.Node.Parent.Tag); content.recName = e.Label.ToString(); content.record = ""; if (addSnodeflag) { //添加新节点 reccontentbll.InsertMemberInfo(content); } else { //修改节点名字 content.ID = Convert.ToInt32(e.Node.Tag); reccontentbll.updaterRecNameByID(content); } } else { //父节点 recordCategary cat = new recordCategary(); cat.DelFlag = false; cat.rCategary = e.Label.ToString(); cat.id = Convert.ToInt32(e.Node.Tag); if (addPnodeflag) { //添加节点 cat.id = rootNodeNo; recordcategarybll.InsertrecordCategaryInfo(cat); addPnodeflag = false; } else { //修改节点名字 recordcategarybll.updaterCategaryByID(cat); } } } else { /* Cancel the label edit action, inform the user, and * place the node in edit mode again. */ e.CancelEdit = true; MessageBox.Show("Invalid tree node label.\n" + "The invalid characters are: '@','.', ',', '!'", "Node Label Edit"); e.Node.BeginEdit(); } } else { /* Cancel the label edit action, inform the user, and * place the node in edit mode again. */ e.CancelEdit = true; MessageBox.Show("Invalid tree node label.\nThe label cannot be blank", "Node Label Edit"); e.Node.BeginEdit(); } } }