Beispiel #1
0
        private void Salvar_Click(object sender, EventArgs e)
        {
            var       id = Pagamentos.lista.Count > 0 ? Pagamentos.lista.Last().Id + 1 : 1;
            Pagamento pg = new Pagamento(id,
                                         textBox1.Text,
                                         decimal.Parse(textBox2.Text),
                                         (int)comboBox1.SelectedIndex + 1);
            Pagamentos pgFrm = new Pagamentos();
            var        isNew = (
                from item in Pagamentos.lista
                where item.Id == int.Parse(textBox3.Text)
                select item).ToList();

            if (isNew.Count > 0)
            {
                pg.Id = isNew[0].Id;
                Pagamentos.lista.Remove(isNew[0]);
            }
            Pagamentos.lista.Add(pg);
            this.Close();
        }
        private void pagamentosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Pagamentos pg = new Pagamentos();

            pg.ShowDialog();
        }