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);
        }
Exemple #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);
        }
Exemple #3
0
 private void detach_pets(pet entity)
 {
     this.SendPropertyChanging();
     entity.pet_type = null;
 }
Exemple #4
0
 private void attach_pets(pet entity)
 {
     this.SendPropertyChanging();
     entity.pet_type = this;
 }
Exemple #5
0
 partial void Deletepet(pet instance);
Exemple #6
0
 partial void Updatepet(pet instance);
Exemple #7
0
 partial void Insertpet(pet instance);