예제 #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            uc = new UzrasaiController(usr, uzrasaiRichTextBox.Text, Convert.ToInt32(ID));
            DB db = new DB(uzr, naud);

            uzrasaiPanel.Controls.Clear();
            uzr.Clear();
            loginNameLabel.Text = "Prisijungęs kaip: " + usr + "";
            db.controller       = uc;
            db.ReadUzrasai();
            int i = 0;

            foreach (Uzrasai u in uzr)
            {
                Button uzButton = new Button();
                uzButton.Text     = u.GetPavadinimas();
                uzButton.Location = new Point(0, 50 * i);
                uzButton.Size     = new Size(120, 50);
                uzButton.Tag      = u;
                uzButton.Click   += UzButton_Click;
                uzrasaiPanel.Controls.Add(uzButton);
                i++;
            }
            i = 0;
        }
예제 #2
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            uc = new UzrasaiController(usr, uzrasaiRichTextBox.Text, Convert.ToInt32(ID));
            DB db = new DB(uzr, naud);

            db.controller = uc;
            db.Update();
            Form1_Load(sender, e);
        }
예제 #3
0
 private void DeleteButton_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Ar tikrai norite ištrinti šį įrašą?", "Patvirtinimas", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         uc = new UzrasaiController(usr, uzrasaiRichTextBox.Text, Convert.ToInt32(ID));
         DB db = new DB(uzr, naud);
         db.controller = uc;
         db.Delete();
         uzrasaiRichTextBox.Text = "";
         Form1_Load(sender, e);
     }
 }
예제 #4
0
 private void addButton_Click(object sender, EventArgs e)
 {
     if (uzrasaiTextBox.Text.TrimEnd() == "")
     {
         MessageBox.Show("Įveskite pavadinimą!");
         uzrasaiTextBox.Select();
     }
     else
     {
         uc = new UzrasaiController(usr, uzrasaiTextBox.Text.TrimEnd().TrimStart(), Convert.ToInt32(ID));
         DB db = new DB(uzr, naud);
         db.controller = uc;
         db.Insert();
         uzrasaiTextBox.Text = "";
     }
     Form1_Load(sender, e);
 }