Example #1
0
        private void IUServico_FormClosing(object sender, FormClosingEventArgs e)
        {
            if (!salvo)
            {
                DialogResult dr = MessageBox.Show("Tem Certeza que deseja sair ?", "RTPark", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dr == DialogResult.Yes)
                {
                    if (lista != null)
                    {
                        lista.Show();
                    }

                    if (contr != null && obj.Idservico != 0)
                    {
                        contr.CarregaServico(obj.Idservico);
                    }

                    if (config != null && obj.Idservico != 0)
                    {
                        config.CarregaServico(obj.Idservico);
                    }
                }
                else
                {
                    e.Cancel = true;
                }
            }
            else
            {
                if (lista != null)
                {
                    lista.Show();
                }

                if (contr != null && obj.Idservico != 0)
                {
                    contr.CarregaServico(obj.Idservico);
                }

                if (config != null && obj.Idservico != 0)
                {
                    config.CarregaServico(obj.Idservico);
                }
            }
        }
Example #2
0
        private void btnSeleciona_Click(object sender, EventArgs e)
        {
            if (dgvDados.SelectedRows.Count == 1)
            {
                int id = Convert.ToInt32(dgvDados.CurrentRow.Cells[0].Value.ToString());

                if (contr != null)
                {
                    contr.CarregaServico(id);
                }

                if (config != null)
                {
                    config.CarregaServico(id);
                }

                this.Close();
            }
            else
            {
                MessageBox.Show("Selecione apenas um Registro!!!");
            }
        }