예제 #1
0
 private void Finish()
 {
     //vrati se na pocetnu stranicu
     RadSaBazom.IzmenaProjekta(_projekat.Id, ((EditProjectViewModel)previousVM).Naziv, ((EditProjectViewModel)previousVM).Opis, tmpDodati, tmpIzbrisani);
     //osvezava se lista projekata i prebacuje se na pocetan pogled
     ((StartViewModel)(((ApplicationViewModel)parentAppVM).PageViewModels[0])).OsveziListuProjekata();
     ((ApplicationViewModel)parentAppVM).CurrentPageViewModel = ((ApplicationViewModel)parentAppVM).PageViewModels[0];
 }
예제 #2
0
        //top bar list view
        private void ListView_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListView lv = sender as ListView;

            if (lv.SelectedIndex != -1)
            {
                ListViewItem li = lv.SelectedItem as ListViewItem;
                switch (li.Name)
                {
                case "RefreshTable":
                    //background worker
                    RadSaBazom.RefreshTabele.RunWorkerAsync();

                    //Projekat proj = ((ApplicationViewModel)this.DataContext).TrenutniProjekat;
                    ////prvo bi trebalo da pogleda logove i ako je bilo promena onda tek da uradi refresh
                    //proj.TabelaProjekta = new Tabela(proj.Ime, proj.Opis, proj.Id);
                    //Grid gr = TabelaCrtac.InvokeNacrtaj(((ApplicationViewModel)this.DataContext).TrenutniProjekat.TabelaProjekta, ((ApplicationViewModel)this.DataContext));
                    ////this.parentAppVM.AppView.ProjekatDugmiciManage(true, "create");
                    //((ApplicationViewModel)this.DataContext).AppView.SetContent(gr);
                    break;

                case "Notifications":
                    //List<String> Obavestenja = ((ApplicationViewModel)this.DataContext).TrenutniProjekat.UcitajIstorijuIzmena(frm.Tip, int.Parse(frm.BrojPromena.ToString()));
                    //Notifications ipv = new Notifications();
                    //ipv.DataContext = Obavestenja;
                    //ipv.ShowDialog();
                    break;

                case "SaveAsTemplate":
                    Projekat temp = ((ApplicationViewModel)this.DataContext).TrenutniProjekat;
                    if (temp.Id != 0)
                    {
                        try
                        {
                            PProjekat.SacuvajKaoTemplejt(temp.Id, temp.Ime, temp.Opis);
                            try
                            {
                                System.Windows.MessageBox.Show(PPoruka.VratiPrevod("TMP_S"));
                            }
                            catch (Oracle.ManagedDataAccess.Client.OracleException er)
                            {
                                System.Windows.MessageBox.Show("Templejt uspesno snimljen.");
                            }
                        }
                        catch (OracleException oraError)
                        {
                            try
                            {
                                System.Windows.MessageBox.Show(PPoruka.VratiPrevod(oraError.Number.ToString()));
                            }
                            catch (OracleException err)
                            {
                                System.Windows.MessageBox.Show("Greska");
                            }
                        }
                        catch (System.Exception error)
                        {
                            System.Windows.MessageBox.Show("Greska");
                        }
                    }
                    else
                    {
                        PProjekat.SacuvajKaoTemplejt(temp.Id, temp.Ime, temp.Opis);
                        try
                        {
                            System.Windows.MessageBox.Show(PPoruka.VratiPrevod("MUST_S_P"));
                        }
                        catch (Oracle.ManagedDataAccess.Client.OracleException er)
                        {
                            System.Windows.MessageBox.Show("Morate snimiti projekat.");
                        }
                    }
                    break;

                case "Done":
                    try
                    {
                        RadSaBazom.KreirajProjekat(((ApplicationViewModel)this.DataContext).TrenutniProjekat);
                        try
                        {
                            System.Windows.MessageBox.Show(PPoruka.VratiPrevod("P_SUC_C"));
                        }
                        catch (OracleException er)
                        {
                            System.Windows.MessageBox.Show("Projekat uspesno kreiran");
                        }
                    }
                    catch (OracleException oraError)
                    {
                        System.Windows.MessageBox.Show(PPoruka.VratiPrevod(oraError.Number.ToString()));
                    }

                    break;

                case "History":
                    IzborIstorijeIzmena frm = new IzborIstorijeIzmena();
                    if (frm.ShowDialog() == true)
                    {
                        // refreshuje se lista izmena
                        if (int.Parse(frm.BrojPromena.ToString()) != 0)
                        {
                            List <String>       Izmene = ((ApplicationViewModel)this.DataContext).TrenutniProjekat.UcitajIstorijuIzmena(frm.Tip, int.Parse(frm.BrojPromena.ToString()));
                            IstorijaPromenaView ipv    = new IstorijaPromenaView();
                            ipv.DataContext = Izmene;
                            ipv.ShowDialog();
                        }
                        else
                        {
                            try
                            {
                                MessageBox.Show(PPoruka.VratiPrevod("WR_INPUT"));
                            }
                            catch (Exception er)
                            {
                                MessageBox.Show("Neispravan unos.");
                            }
                        }
                    }

                    break;

                default:
                    MessageBox.Show("" + li.Name);
                    break;
                }
                lv.SelectedIndex = -1;
            }
        }