Esempio n. 1
0
        protected void dodaj_Click(object sender, EventArgs e)
        {
            if (izborVlasnika.Items.Count > 0)
            {
                if (name.Text == "" || age.Text == "")
                {
                    error.Text = "Insert values!";
                    return;
                }
                var a = from pe in db.pets
                        select pe.pet_id;
                pet p = new pet();
                p.name        = name.Text;
                p.age         = int.Parse(age.Text);
                p.description = desc.Text;
                p.owner_id    = int.Parse(izborVlasnika.SelectedValue);
                p.type_id     = 2;
                p.pet_id      = a.Max() + 1;
                db.pets.InsertOnSubmit(p);
                db.SubmitChanges();
            }
            else
            {
                error.Text = "Insert a owner first";
                Response.Redirect("Owner.aspx");
            }

            Response.Redirect(Request.RawUrl);
        }
Esempio n. 2
0
        protected void usvoji_Click(object sender, EventArgs e)
        {
            int idO = -1;
            int idP = -1;

            if (usvajanjeVlasnik.Items.Count > 0 && usvajanjeLjubimac.Items.Count > 0)
            {
                idO = int.Parse(usvajanjeVlasnik.SelectedValue);

                idP = int.Parse(usvajanjeLjubimac.SelectedValue);
                var pets = from p in db.pets
                           where p.pet_id == idP
                           select p;

                pet pet = pets.FirstOrDefault();
                pet.owner_id = idO;
                db.SubmitChanges();
            }
            Response.Redirect(Request.RawUrl);
        }
Esempio n. 3
0
 private void detach_pets(pet entity)
 {
     this.SendPropertyChanging();
     entity.pet_type = null;
 }
Esempio n. 4
0
 private void attach_pets(pet entity)
 {
     this.SendPropertyChanging();
     entity.pet_type = this;
 }
Esempio n. 5
0
 partial void Deletepet(pet instance);
Esempio n. 6
0
 partial void Updatepet(pet instance);
Esempio n. 7
0
 partial void Insertpet(pet instance);