Пример #1
0
        public FormEquipamentos(Setor setor)
        {
            InitializeComponent();

            _setor = setor;
            Shown += FormEquipamentos_Shown;
        }
Пример #2
0
        private void Grid_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow linha = grid.Rows[e.RowIndex];

            object cell = linha.Cells[0].Value;

            if (cell == null)
            {
                return;
            }

            Setor setor = Setores.Lista.Find(x => x.Id == e.RowIndex);

            if (setor != null)
            {
                Setores.Lista[e.RowIndex].Titulo = cell.ToString();
                RaiseEditar(Setores.Lista[e.RowIndex], e.RowIndex);
            }
            else
            {
                Setor novosetor = new Setor
                {
                    Id     = e.RowIndex,
                    Titulo = cell.ToString()
                };

                RaiseAdicionar(novosetor);
                Setores.Lista.Add(novosetor);
            }
        }
        public FormPainelSetor(Setor Setor)
        {
            InitializeComponent();

            _setor = Setor;
            CarregaEquipamentos();
            Shown += FormPainelSetor_Shown;
        }
Пример #4
0
        private void AdicionarSetor(Setor setor)
        {
            FormPainelSetor painelsetor = new FormPainelSetor(setor);

            painelsetor.MdiParent         = this;
            painelsetor.Text              = setor.Titulo;
            painelsetor.Tag               = setor.Id;
            painelsetor.AoReceberComando += Painelsetor_AoReceberComando;
            painelsetor.Show();
        }
Пример #5
0
 private void Setoresform_AoEditar(Setor setor, int Index)
 {
     foreach (Form item in MdiChildren)
     {
         if ((int)item.Tag == setor.Id)
         {
             item.Text = setor.Titulo;
         }
     }
 }
Пример #6
0
 private void Setoresform_AoRemover(Setor setor, int Index)
 {
     foreach (Form item in MdiChildren)
     {
         if ((int)item.Tag == Index)
         {
             item.Close();
         }
     }
 }
Пример #7
0
        private void Grid_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
        {
            DialogResult dialog = MessageBox.Show("Atenção: A Exclusão deste setor irá excluir também os equipamentos e controles associados a ele! \nVocê confirma este procedimentos?", "Smart Monitor", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dialog == DialogResult.Yes)
            {
                Setor setor = Setores.Lista[e.RowIndex];
                if (setor != null)
                {
                    RaiseRemover(setor, e.RowIndex);
                    Setores.Lista.Remove(setor);
                }
            }
        }
Пример #8
0
 protected virtual void RaiseRemover(Setor setor, int Index)
 {
     AoRemover(setor, Index);
 }
Пример #9
0
 protected virtual void RaiseEditar(Setor setor, int Index)
 {
     AoEditar(setor, Index);
 }
Пример #10
0
 protected virtual void RaiseAdicionar(Setor setor)
 {
     AoAdicionar(setor);
 }
Пример #11
0
 public FormAdicionarEquipamento(Setor Setor)
 {
     InitializeComponent();
     _setor              = Setor;
     buttonSalvar.Click += ButtonSalvar_Click;
 }