Beispiel #1
0
 private void DoDelete(object sender, EventArgs args)
 {
     //we have to check if the area is used in a pack
     //before deleting... pending
     AreaModel m = new AreaModel();
     if(m.DeleteById(this.CurrentArea.Id))
         this.InitState();
     else
         GuiHelper.ShowUnexpectedError(this);
 }
Beispiel #2
0
        private void AddArea(string area)
        {
            AreaModel m = new AreaModel();
            if(m.Exists(area))
            {
                GuiHelper.ShowError(this, "Ya existe el área que desea agregar");
                this.EditMode();
                return;
            }

            bool success = m.Insert(area);
            if(success)
                this.InitState();

            else
                GuiHelper.ShowUnexpectedError(this);
        }
Beispiel #3
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();
        }
Beispiel #4
0
        private void UpdateArea()
        {
            Area a = this.GetAreaFromUI();
            a.Id = this.CurrentArea.Id;
            AreaModel m = new AreaModel();

            if(m.Update(a))
                this.InitState();
            else if(m.ExistsExcept(a))
                GuiHelper.ShowError(this, "Ya existe un área del gimnasio con el mismo nombre");
            else
                GuiHelper.ShowUnexpectedError(this);
        }
Beispiel #5
0
        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();
        }