コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            CodEroare valid = Validare(txtTitlu.Text, txtAutor.Text);

            if (valid != CodEroare.CORECT)
            {
                MarcheazaIncorect(valid);
            }

            else
            {
                Carte current = new Carte(txtTitlu.Text, txtAutor.Text, (int)nrExemp.Value, checkBoxes);

                if (Librarie.CheckDublura(current) == true)
                {
                    MessageError.Visible = true;
                }
                else
                {
                    Lists.Lib.Add(current);
                    Librarie.AppendFile(current, true);
                    Reset();
                }
            }
        }
コード例 #2
0
        private void bttnUpdate_Click(object sender, EventArgs e)
        {
            if (this.id == -1)
            {
                return;
            }
            Carte     current = new Carte(txtTitlu.Text, txtAutor.Text, (int)nrExemp.Value);
            CodEroare valid   = Validare(txtTitlu.Text, txtAutor.Text);
            bool      value   = Librarie.CheckDublura(current, id);

            if (valid != CodEroare.CORECT)
            {
                MarcheazaIncorect(valid);
            }
            if (value == true)
            {
                MessageError.Visible = true;
            }

            else
            {
                Lists.Lib[id].Autor     = txtAutor.Text;
                Lists.Lib[id].Titlu     = txtTitlu.Text;
                Lists.Lib[id].Exemplare = (int)nrExemp.Value;
                Lists.Lib[id].Optiuni(ReturnCheckBoxes());
                Lists.Lib[id].GetDataM = DateTime.Now;

                Reset();
                this.Hide();
            }
        }