public List <recordCategary> GetrecordCategaryList() { try { string sql = "select * from recordCategary "; DataTable da = SQLiteHelper.ExecteDataTable(sql); List <recordCategary> list = null; if (da.Rows.Count > 0) { list = new List <recordCategary>(); recordCategary memberinfo = null; foreach (DataRow row in da.Rows) { memberinfo = new recordCategary(); LoadEntity(memberinfo, row); list.Add(memberinfo); } } return(list); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(null); } }
public bool updaterCategaryByID(recordCategary cat) { string sql = "update recordCategary set rCategary = @rcat where ID=@id"; SQLiteParameter[] pms = { new SQLiteParameter("@rcat", cat.rCategary), new SQLiteParameter("@id", cat.id) }; return(SQLiteHelper.ExecuteNonQuery(sql, pms) > 0); }
public int InsertrecordCategaryInfo(recordCategary categary) { try { string sql = "insert into recordCategary values(@id,@rCategary,@DelFlag)"; SQLiteParameter[] pms = { new SQLiteParameter("@id", categary.id), new SQLiteParameter("@rCategary", categary.rCategary), new SQLiteParameter("@DelFlag", categary.DelFlag) }; return(SQLiteHelper.ExecuteNonQuery(sql, pms)); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(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(); } } }
public bool updaterCategaryByID(recordCategary cat) { return(dal.updaterCategaryByID(cat)); }
public bool InsertrecordCategaryInfo(recordCategary categary) { return(dal.InsertrecordCategaryInfo(categary) > 0); }
private static void LoadEntity(recordCategary memberinfo, DataRow row) { memberinfo.id = Convert.ToInt32(row["id"]); memberinfo.rCategary = row["rCategary"].ToString(); memberinfo.DelFlag = Convert.ToBoolean(row["DelFlag"]); }