示例#1
0
        private void registPetButton_Click(object sender, EventArgs e)
        {
            PetForm f = new PetForm();

            f.Show();
            this.Hide();
        }
示例#2
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            string nama   = textBoxSearch.Text;
            var    contex = new db_daycareContextEntities();
            var    pet    = (from a in contex.Pets where a.pet_name == nama select a).Single();

            contex.Pets.Remove(pet);
            contex.SaveChanges();

            MessageBox.Show("Data telah berhasil dihapus.");

            PetForm f = new PetForm();

            f.Show();
            this.Hide();
        }
示例#3
0
        private void buttonUpdate_Click(object sender, EventArgs e)
        {
            var context = new db_daycareContextEntities();
            var pet     = (from a in context.Pets
                           where a.pet_name == textBoxSearch.Text
                           select a).Single();

            pet.pet_name    = nameTextBox.Text;
            pet.customer_id = int.Parse(ownerComboBox.SelectedValue.ToString());
            pet.pet_type_id = int.Parse(typeComboBox.SelectedValue.ToString());

            context.SaveChanges();
            MessageBox.Show("Data telah berhasil diupdate.");

            PetForm f = new PetForm();

            f.Show();
            this.Hide();
        }
示例#4
0
        private void addPetButton_Click(object sender, EventArgs e)
        {
            db_daycareContextEntities context = new db_daycareContextEntities();

            var pet = new Pets();

            pet.pet_name = nameTextBox.Text;
            //pet.customer_id = (int)ownerComboBox.SelectedIndex;
            //pet.pet_type_id = (int)typeComboBox.SelectedIndex;
            pet.customer_id = int.Parse(ownerComboBox.SelectedValue.ToString());
            pet.pet_type_id = int.Parse(typeComboBox.SelectedValue.ToString());
            context.Pets.Add(pet);
            context.SaveChanges();

            MessageBox.Show("Peliharaan berhasil ditambah!");

            PetForm f = new PetForm();

            f.Show();
            this.Hide();
        }