Exemplo n.º 1
0
        private void BtEdit_Click(object sender, EventArgs e)
        {
            if (lstMain.SelectedItem == null)
            {
                return;
            }
            inputBox iBox = new inputBox();
            String   sCod = iBox.Show(lstMain.Text, "Informação", "Digite o nome do assunto.", 40);

            if (!string.IsNullOrEmpty(sCod))
            {
                Processo_bll processo_class = new Processo_bll(_connection);
                Assunto      reg            = new Assunto();
                GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem;
                reg.Codigo = Convert.ToInt16(selectedData._value);
                reg.Nome   = sCod.ToUpper();
                reg.Ativo  = Convert.ToBoolean(selectedData._ativo);
                Exception ex = processo_class.Alterar_Assunto(reg);
                if (ex != null)
                {
                    ErrorBox eBox = new ErrorBox("Atenção", "Assunto já cadastrado.", ex);
                    eBox.ShowDialog();
                }
                else
                {
                    Carrega_Lista(bSoAtivo, bSoNAtivo);
                }
            }
        }
Exemplo n.º 2
0
        private void BtAtivar_Click(object sender, EventArgs e)
        {
            if (lstMain.SelectedItem == null)
            {
                return;
            }
            bCheck = true;
            lstMain.SetItemChecked(lstMain.SelectedIndex, !lstMain.GetItemChecked(lstMain.SelectedIndex));

            Assunto reg = new Assunto();

            GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem;
            reg.Codigo = Convert.ToInt16(selectedData._value);
            reg.Nome   = selectedData._name;
            reg.Ativo  = selectedData._ativo;
            Processo_bll clsProcesso = new Processo_bll(_connection);
            Exception    ex          = clsProcesso.Alterar_Assunto(reg);

            if (ex != null)
            {
                ErrorBox eBox = new ErrorBox("Atenção", "Erro desconhecido.", ex);
                eBox.ShowDialog();
            }
        }