private void bttOk_Click(object sender, EventArgs e)
 {
     if (services.OdstraniOseboIzPodjetjaByIndex(indexOseba, indexPodjetje) == 1)
     {
         MessageBox.Show("Usprešno odstranjena oseba iz podjetja.");
     }
 }
        private void bttPotrdi_Click(object sender, RoutedEventArgs e)
        {
            localhost.Oseba o = (localhost.Oseba)dataGridViewOseba.SelectedItem;
            //MessageBox.Show(o.OsebaId.ToString());
            int indexOseba = o.OsebaId;

            localhost.Podjetje p = (localhost.Podjetje)dataGridViewPod.SelectedItem;
            int indexPodjetje    = p.PodjetjeId;

            naziv = p.naziv;

            if (services.OdstraniOseboIzPodjetjaByIndex(indexOseba, indexPodjetje) == 1)
            {
                MessageBox.Show("Usprešno odstranjena oseba iz podjetja.");
            }

            this.DialogResult = true;
            this.Close();
        }
    protected void GridViewOseba_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {
        GridViewRow row = GridViewOseba.Rows[e.NewSelectedIndex];

        Label1.Text = row.Cells[2].Text;
        string ime = row.Cells[2].Text;

        if (Session["OsebaVPod"] != null)
        {
            if ((bool)Session["OsebaVPod"])
            {
                localhost.Podjetje[] osebaVPod2 = services.listaPodjetja(ime);
                GridView1.DataSource = osebaVPod2;
                GridView1.DataBind();
            }
        }

        if (Session["ImeOsebePodrobnosti"] != null)
        {
            if ((bool)Session["ImeOsebePodrobnosti"])
            {
                localhost.Oseba o2 = services.getOsebaIme(ime);
                Label1.Text = o2.ime + " " + o2.priimek + " " + o2.letoRojstva;
            }
        }
        if (Session["DodajOseboVPodjetje"] != null)
        {
            if ((bool)Session["DodajOseboVPodjetje"])
            {
                GridViewRow row2  = GridViewOseba.Rows[e.NewSelectedIndex];
                int         index = Convert.ToInt16(row2.Cells[1].Text);

                Session["IndexOsebe"] = index;

                if (Session["IndexPodjetja"] != null)
                {
                    services.AddOsebaVPodjetjeByIndex(Convert.ToInt16(Session["IndexOsebe"]), Convert.ToInt16(Session["IndexPodjetja"]), txtBDelovnoMesto.Text, Convert.ToInt16(txtBDatumDo.Text));

                    /*GridViewPodjetje.Enabled = true;
                     * GridViewPodjetje.Visible = true;
                     * // GridView2.DataSource =
                     * if (GridViewOseba.Enabled)
                     * {
                     *  GridViewOseba.Visible = false;
                     * }
                     *
                     *
                     * localhost.Podjetje[] podjetje = services.getPodjetjeAll();
                     *
                     * GridViewPodjetje.DataSource = podjetje;
                     * GridViewPodjetje.DataBind();*/
                }
            }
        }
        if (Session["OdstraniOseboIzPodjetja"] != null)
        {
            if ((bool)Session["OdstraniOseboIzPodjetja"])
            {
                GridViewRow row2  = GridViewOseba.Rows[e.NewSelectedIndex];
                int         index = Convert.ToInt16(row2.Cells[1].Text);

                Session["IndexOsebe"] = index;

                if (Session["IndexPodjetja"] != null)
                {
                    if (services.OdstraniOseboIzPodjetjaByIndex(Convert.ToInt16(Session["IndexOsebe"]), Convert.ToInt16(Session["IndexPodjetja"])) == 1)
                    {
                    }
                }
            }
        }
        if (Session["UrediOsebo"] != null)
        {
            if ((bool)Session["UrediOsebo"])
            {
                GridViewRow row2   = GridViewOseba.Rows[e.NewSelectedIndex];
                string      i      = row2.Cells[2].Text;
                string      pr     = row2.Cells[3].Text;
                string      letoDo = row2.Cells[4].Text;

                Session["UrediOseboIme"] = i;
                Session["UrediPriimek"]  = pr;
                Session["UredILetoDo"]   = letoDo;

                Server.Transfer("UrediOsebo.aspx", true);

                localhost.Oseba[] oseba = services.getOsebeAll();
                GridView1.DataSource = oseba;
                GridView1.DataBind();
            }
        }
    }