Esempio n. 1
0
        private void AddPack()
        {
            Pack p = GetPackFromUI();
            p.Areas = this.CurrentPack.Areas;
            PackModel m = new PackModel();
            if(m.Exists(p))
                GuiHelper.ShowError(this, "Ya existe un paquete con el mismo nombre");

            else if(m.Insert(p))
            {
                p.Id = m.LastInsertId;
                m.InsertAreas(p);
                this.InitState();
            }

            else
                GuiHelper.ShowError(this, "error en la inserción");
        }
Esempio n. 2
0
        //pendiente por áreas
        private void EditPack()
        {
            Pack p = GetPackFromUI();
            p.Id = this.CurrentPack.Id;
            p.Areas = this.CurrentPack.Areas;

            PackModel m = new PackModel();
            if(m.Update(p))
            {
                m.DeleteAreas(p);
                m.InsertAreas(p);
                this.InitState();
            }
            else if(m.ExistsExcept(p))
                GuiHelper.ShowError(this, "Ya existe otro paquete con el mismo nombre");
            else
                GuiHelper.ShowUnexpectedError(this);
        }