private void BtCC1_Click(object sender, EventArgs e) { if (lstMain.SelectedItem == null) { MessageBox.Show("Selecione um assunto.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem; bool bAtivo = Convert.ToBoolean(selectedData._ativo); if (bAtivo) { if (lstCC1.SelectedItem == null) { MessageBox.Show("Selecione o local que deseja incluir na tramitação.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { GtiTypes.CustomListBoxItem selectedItem = (GtiTypes.CustomListBoxItem)lstCC1.SelectedItem; lstCC2.Items.Add(new GtiTypes.CustomListBoxItem(selectedItem._name, selectedItem._value)); Atualizar_Local(); } } else { MessageBox.Show("Apenas assuntos ativos podem ser alterados.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
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); } } }
private void LstMain_SelectedIndexChanged(object sender, EventArgs e) { if (lstMain.SelectedItems.Count > 0) { GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem; Carrega_Assunto_Local(Convert.ToInt16(selectedData._value)); Carrega_Assunto_Documento(Convert.ToInt16(selectedData._value)); } }
private void FillList(List <GtiTypes.CustomListBoxItem2> Lista) { LstMain.DisplayMember = "_name"; LstMain.ValueMember = "_value"; LstMain.DataSource = Lista; for (int i = 0; i < LstMain.Items.Count; i++) { GtiTypes.CustomListBoxItem2 item = (GtiTypes.CustomListBoxItem2)LstMain.Items[i]; LstMain.SetItemChecked(i, item._ativo); } }
private void BtSair_Click(object sender, EventArgs e) { Lista_Retorno = new List <GtiTypes.CustomListBoxItem2>(); for (int i = 0; i < LstMain.Items.Count; i++) { GtiTypes.CustomListBoxItem2 item = (GtiTypes.CustomListBoxItem2)LstMain.Items[i]; GtiTypes.CustomListBoxItem2 item2 = new GtiTypes.CustomListBoxItem2(item._name, item._value, LstMain.GetItemChecked(i)); Lista_Retorno.Add(item2); } Close(); }
private void BtDoc1_Click(object sender, EventArgs e) { if (lstMain.SelectedItem == null) { MessageBox.Show("Selecione um assunto.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem; bool bAtivo = Convert.ToBoolean(selectedData._ativo); if (bAtivo) { if (lstDoc1.SelectedItem == null) { MessageBox.Show("Selecione o documento que deseja incluir na tramitação.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { bool bFind = false; GtiTypes.CustomListBoxItem selectedItem = (GtiTypes.CustomListBoxItem)lstDoc1.SelectedItem; foreach (GtiTypes.CustomListBoxItem item in lstDoc2.Items) { if (item._value == selectedItem._value) { bFind = true; break; } } if (bFind) { MessageBox.Show("Documento já incluso no assunto.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { lstDoc2.Items.Add(new GtiTypes.CustomListBoxItem(selectedItem._name, selectedItem._value)); Atualizar_Documento(); } } } else { MessageBox.Show("Apenas assuntos ativos podem ser alterados.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void Atualizar_Documento() { GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem; short CodAssunto = Convert.ToInt16(selectedData._value); List <Assuntodoc> Lista = new List <Assuntodoc>(); foreach (GtiTypes.CustomListBoxItem item in lstDoc2.Items) { Assuntodoc reg = new Assuntodoc { Codassunto = CodAssunto, Coddoc = Convert.ToInt16(item._value) }; Lista.Add(reg); } Processo_bll clsProcesso = new Processo_bll(_connection); Exception ex = clsProcesso.Incluir_Assunto_Documento(Lista); }
private void Atualizar_Local() { GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem; int CodAssunto = Convert.ToInt16(selectedData._value); List <Assuntocc> Lista = new List <Assuntocc>(); int x = 1; foreach (GtiTypes.CustomListBoxItem item in lstCC2.Items) { Assuntocc reg = new Assuntocc { Codassunto = Convert.ToInt16(CodAssunto), Codcc = Convert.ToInt16(item._value), Seq = Convert.ToInt16(x) }; Lista.Add(reg); x++; } Processo_bll clsProcesso = new Processo_bll(_connection); Exception ex = clsProcesso.Incluir_Assunto_Local(Lista); }
private void BtDoc2_Click(object sender, EventArgs e) { GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem; bool bAtivo = Convert.ToBoolean(selectedData._ativo); if (bAtivo) { if (lstDoc2.SelectedItem == null) { MessageBox.Show("Selecione o documento que deseja excluir da tramitação.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { _oldIndex = lstDoc2.SelectedIndex; lstDoc2.Items.RemoveAt(_oldIndex); Atualizar_Documento(); } } else { MessageBox.Show("Apenas assuntos ativos podem ser alterados.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LstCC2_DragDrop(object sender, DragEventArgs e) { GtiTypes.CustomListBoxItem2 selectedData = (GtiTypes.CustomListBoxItem2)lstMain.SelectedItem; bool bAtivo = Convert.ToBoolean(selectedData._ativo); if (bAtivo) { Point point = lstCC2.PointToClient(new Point(e.X, e.Y)); int index = lstCC2.IndexFromPoint(point); if (index < 0) { index = lstCC2.Items.Count - 1; } object data = e.Data.GetData(typeof(GtiTypes.CustomListBoxItem)); lstCC2.Items.RemoveAt(_oldIndex); lstCC2.Items.Insert(index, data); Atualizar_Local(); } else { MessageBox.Show("Apenas assuntos ativos podem ser alterados.", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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(); } }
private void BtDel_Click(object sender, EventArgs e) { if (lstMain.SelectedItem == null) { return; } if (MessageBox.Show("Excluir este assunto?", "Confirmação", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { 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); Exception ex = processo_class.Excluir_Assunto(reg); if (ex != null) { ErrorBox eBox = new ErrorBox("Atenção", ex.Message, ex); eBox.ShowDialog(); } else { Carrega_Lista(bSoAtivo, bSoNAtivo); } } }