private Sessao CriaSessaoPelosCampos() { List <ContingenciaColateral> CCs = new List <ContingenciaColateral>(); foreach (ListViewItem item in listViewCCSessao.Items) { long CCid = long.Parse(item.SubItems[1].Text); CCs.Add(ContingenciaColateralService.GetById(CCid)); } Instrucao instrucao = null; if (!string.IsNullOrWhiteSpace(textInstrucao.Text)) { instrucao = new Instrucao { Texto = textInstrucao.Text }; InstrucaoService.Salvar(instrucao); } Sessao sessao = new Sessao { Nome = textBoxNomeSessao.Text, CCs = CCs, OrdemAleatoria = checkBoxTentativasRand.Checked, CriterioAcertosConcecutivos = Convert.ToInt32(numericAcertosConsec.Value), CriterioNumeroTentativas = Convert.ToInt32(numericNTentativas.Value), CriterioDuracaoSegundos = Convert.ToInt32(numericDuracao.Value), Instrucao = instrucao }; return(sessao); }
private ContingenciaColateral GetCCSelecionada() { if (listViewCC.SelectedItems.Count == 0) { return(null); } long id = ViewUtils.GetIdSelecionadoInListView(listViewCC); ContingenciaColateral CC = ContingenciaColateralService.GetById(id); return(CC); }
private void ButtonCadastrarCC_Click(object sender, EventArgs e) { ContingenciaColateral CC = CriaCCPelosCampos(); ContingenciaColateralService.Salvar(CC); ListViewItem itemCC = new ListViewItem(CC.Nome); itemCC.SubItems.Add(CC.Id.ToString()); listViewCC.Items.Add(itemCC); comboBoxCC.Items.Add(CC); }
private ContingenciaColateral GetCCSelecionada() { if (listViewCC.SelectedItems.Count == 0) { return(null); } long id = long.Parse(listViewCC.SelectedItems[0].SubItems[1].Text); ContingenciaColateral CC = ContingenciaColateralService.GetById(id); return(CC); }
public MenuInicial() { InitializeComponent(); List <ContingenciaInstrucional> CIs = ContingenciaInstrucionalService.GetAll(); List <ContingenciaColateral> CCs = ContingenciaColateralService.GetAll(); List <Sessao> sessoes = SessaoService.GetAll(); comboBoxSexo.Items.AddRange(ESexo.Values()); comboBoxEscolaridade.Items.AddRange(EEscolaridade.Values()); comboBoxCI.Items.AddRange(CIs.Cast <object>().ToArray()); comboBoxCI.DisplayMember = "Nome"; comboBoxCC.Items.AddRange(CCs.Cast <object>().ToArray()); comboBoxCC.DisplayMember = "Nome"; listViewCI.Items.AddRange(CIs.Select(it => { var item = new ListViewItem(it.Nome); item.SubItems.Add(it.Id.ToString()); return(item); }).Cast <ListViewItem>().ToArray()); listViewCC.Items.AddRange(CCs.Select(it => { var item = new ListViewItem(it.Nome); item.SubItems.Add(it.Id.ToString()); return(item); }).Cast <ListViewItem>().ToArray()); listViewSessoes.Items.AddRange(sessoes.Select(it => { var item = new ListViewItem(it.Nome); item.SubItems.Add(it.Id.ToString()); return(item); }).Cast <ListViewItem>().ToArray()); Image pactolo = new Bitmap(Pactolo.Properties.Resources.Pactolo); picturePactolo.Image = ImageUtils.Resize(pactolo, picturePactolo.Width, picturePactolo.Height); if (this.Width > width) { this.Width = width; } if (this.Height + 70 > height) { this.Height = height - 70; } }
private void ButtonApagarCC_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Ao deletar essa MTS ela será deletada também das sessoes onde estiver cadastrada, deseja continuar?", "Confirmação necessária", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.No) { return; } ContingenciaColateral CC = GetCCSelecionada(); if (CC == null) { return; } RemoverDeComboBox <ContingenciaColateral>(comboBoxCC, CC.Id); CCPorSessaoService.DeletarAllByCCId(CC.Id); ContingenciaColateralService.Deletar(CC); listViewCC.Items.Remove(listViewCC.SelectedItems[0]); }