public bool Update(Area area) { string sql = "update " + this.TableName; sql += " set Name = @p0"; //+ area.Name + "'"; sql += " where Id = @p1"; //+ area.Id + "'"; return ((long) this.DoNonQuery(sql, area.Name, area.Id)) > 0; }
public bool ExistsExcept(Area a) { string sub_query = "(select * from " + this.TableName; sub_query += " where " + this.IdName + " != @p0) a"; //+ a.Id + "') a"; string sql = "select count(*) from " + sub_query + " where a.Name = @p1"; //+ a.Name + "'"; return ((long) this.DoScalar(sql, a.Id, a.Name)) > 0; }
private void Fill() { ListStore store = new ListStore(typeof(bool), typeof(string), typeof(long)); AreaModel m = new AreaModel(); IDataReader reader = m.GetAll(); Area area = null; while(reader.Read()) { area = new Area(); area.Id = (long) reader["Id"]; area.Name = (string) reader["Name"]; bool selected = this.SelectedIds.Contains(area.Id); store.AppendValues(selected, area.Name, area.Id); } this.AreasTreeView.Model = store; this.AreasTreeView.ShowAll(); }
private void SelectCurrent(object sender, EventArgs args) { this.CurrentArea = (Area) this.AreasNodeView.NodeSelection.SelectedNode; this.DeleteButton.Sensitive = true; this.EditButton.Sensitive = true; this.AreaEntry.Text = this.CurrentArea.Name; }
private Area GetAreaFromUI() { Area a = new Area(); a.Name = this.AreaEntry.Text.Trim(); return a; }
private void FillNodeView() { NodeStore store = new NodeStore(typeof (Area)); AreaModel m = new AreaModel(); IDataReader reader = m.GetAll(); Area a = null; while(reader.Read()) { a = new Area(); a.Id = (long) reader["Id"]; a.Name = (string) reader["Name"]; store.AddNode(a); } this.AreasNodeView.NodeStore = store; this.AreasNodeView.ShowAll(); }