Example #1
0
 public void Clear()
 {
     TextName.Clear();
     NumBag.Value     = 0;
     NumYellow.Value  = 0;
     NumEternal.Value = 0;
     NumMythic.Value  = 0;
 }
Example #2
0
 private void BtnUserAdd_Click(object sender, EventArgs e)
 {
     Person p = new Person(TextName.Text, TextVorname.Text, TextEmail.Text);
     TextName.Clear();
     TextVorname.Clear();
     TextVorname.Clear();
     TextEmail.Clear();
     xmldata.persons.Add(p);
     personBindingSource.Add(p);
 }
Example #3
0
 private void TextName_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     TextName.Clear();
 }
Example #4
0
 private void ButtonCancel_Click(object sender, EventArgs e)
 {
     TextName.Clear();
     TextPassword.Clear();
     TextName.Focus();
 }
Example #5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Book b = new Book();

            if (string.IsNullOrEmpty(TextDescription.Text) || string.IsNullOrEmpty(TextAuthor.Text) || string.IsNullOrEmpty(TextName.Text) || string.IsNullOrEmpty(ComboCategory.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "All field should be filled up.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                TextName.Focus();
                return;
            }
            else
            {
                if (TextName.Text.Length <= 50)
                {
                    b.name = TextName.Text;
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Book Name Too Big.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (TextAuthor.Text.Length <= 50)
                {
                    b.author = TextAuthor.Text;
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Author Name Too Big.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (TextDescription.Text.Length <= 500)
                {
                    b.description = TextDescription.Text;
                }
                else
                {
                    MetroFramework.MetroMessageBox.Show(this, "Description Too Big.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (pictureBox.Image != null)
                {
                    b.picture = imageToByteArray(pictureBox.Image);
                    //return;
                }

                if (!string.IsNullOrEmpty(TextLink.Text))
                {
                    b.link = TextLink.Text;
                }
                b.category = ComboCategory.Text;
                b.rating   = 0;

                BookServices.Insert(b);
                MetroFramework.MetroMessageBox.Show(this, "Added successfully.", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Refresh();
                TextDescription.Clear();
                TextAuthor.Clear();
                TextName.Clear();
                ComboCategory.SelectedIndex = 0;
                TextLink.Clear();
                pictureBox.Image = null;
            }
        }