private void dodajOseboVPodjetjeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int    letoDo, indexO, indexP;
            string delovnoM, naziv;

            DodajOseboVPodjetjeForm dodajOseboVPodjetjeForm = new DodajOseboVPodjetjeForm();
            DialogResult            dr = dodajOseboVPodjetjeForm.ShowDialog(this);

            if (dr == DialogResult.Cancel)
            {
                dodajOseboVPodjetjeForm.Close();
            }
            else if (dr == DialogResult.OK)
            {
                //isOk = dodajPodjetje.getIsOK();
                dodajOseboVPodjetjeForm.Close();
                letoDo   = dodajOseboVPodjetjeForm.getLetoDo();
                indexO   = dodajOseboVPodjetjeForm.getIndexOseba();
                indexP   = dodajOseboVPodjetjeForm.getIndexPodjetje();
                delovnoM = dodajOseboVPodjetjeForm.getDelovnoMesto();
                naziv    = dodajOseboVPodjetjeForm.getNaziv();

                if (services.AddOsebaVPodjetjeByIndex(indexO, indexP, delovnoM, letoDo) == 1)
                {
                    MessageBox.Show("Oseba dodana v podjetje.");
                }
                localhost.Oseba[] osebaVPod = services.listaOseb(naziv);
                dataGridView1.DataSource = osebaVPod;
            }
        }
        private void MenuItem_Click_4(object sender, RoutedEventArgs e)
        {
            //dodaj osebo v podjetje
            int    letoDo, indexO, indexP;
            string delovnoM, naziv;
            DodajOseboVPodjetje dodajOseboVPodjetje = new DodajOseboVPodjetje();

            if ((bool)dodajOseboVPodjetje.ShowDialog())
            {
                dodajOseboVPodjetje.Close();
                letoDo   = dodajOseboVPodjetje.getLetoDo();
                indexO   = dodajOseboVPodjetje.getIndexOseba();
                indexP   = dodajOseboVPodjetje.getIndexPodjetje();
                delovnoM = dodajOseboVPodjetje.getDelovnoMesto();
                naziv    = dodajOseboVPodjetje.getNaziv();

                if (services.AddOsebaVPodjetjeByIndex(indexO, indexP, delovnoM, letoDo) == 1)
                {
                    MessageBox.Show("Oseba dodana v podjetje.");
                }
                localhost.Oseba[] osebaVPod = services.listaOseb(naziv);
                dataGridView1.ItemsSource = osebaVPod;
            }
        }
    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();
            }
        }
    }