Esempio n. 1
0
        public OrderInfo(Service service)
        {
            InitializeComponent();
            this.service = service;
            String date = DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" +
                          DateTime.Now.Year.ToString();

            db      = new FamiliaContextClass();
            handler = new DBHandler();

            try
            {
                _table = handler.fillDataTable();
                _table.Columns[0].ColumnName = "Ime naručioca";
                _table.Columns[1].ColumnName = "Prezime naručioca";
                _table.Columns[2].ColumnName = "Broj telefona";
                _table.Columns[3].ColumnName = "Naziv firme";
                _table.Columns[4].ColumnName = "Adresa firme";
                narudzbaDataGrid.DataContext = _table.DefaultView;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                MessageBox.Show("Greška, server baze podataka nije u funkciji!");
                Page dash = new Dashboard(service);
                NavigationService.Navigate(dash);
            }

            addComboBoxValues(date);
        }
Esempio n. 2
0
        public NewDelivery(Service service)
        {
            InitializeComponent();

            this.service  = service;
            db            = new FamiliaContextClass();
            handler       = new DBHandler();
            isporukaTable = new DataTable();

            narudzbeTable = handler.fillDataTableNewOrders();
            narudzbeTable.Columns[0].ColumnName = "Ime naručioca";
            narudzbeTable.Columns[1].ColumnName = "Prezime naručioca";
            narudzbeTable.Columns[2].ColumnName = "Broj telefona";
            narudzbeTable.Columns[3].ColumnName = "Naziv firme";
            narudzbeTable.Columns[4].ColumnName = "Adresa firme";
            narudzbeTable.Columns[5].ColumnName = "Očekivano vrijeme isporuke";
            narudzbeTable.Columns[6].ColumnName = "Ukupna cijena";
            narudzbaDataGrid.DataContext        = narudzbeTable.DefaultView;

            isporukaTable.Columns.Add("Ime naručioca", typeof(string));
            isporukaTable.Columns.Add("Prezime naručioca", typeof(string));
            isporukaTable.Columns.Add("Broj telefona", typeof(string));
            isporukaTable.Columns.Add("Naziv firme", typeof(string));
            isporukaTable.Columns.Add("Adresa firme", typeof(string));
            isporukaTable.Columns.Add("Očekivano vrijeme isporuke", typeof(string));
            isporukaTable.Columns.Add("Ukupna cijena", typeof(string));
        }
Esempio n. 3
0
 private void dodajButton_Click(object sender, RoutedEventArgs e)
 {
     if (!(String.IsNullOrEmpty(nazivJelaTextBox.Text) ||
           String.IsNullOrEmpty(opisJelaTextBox.Text) ||
           String.IsNullOrEmpty(tipJelaTextBox.Text) ||
           String.IsNullOrEmpty(cijenaJelaTextBox.Text)))
     {
         Double cijena = 0.0;
         if (Double.TryParse(cijenaJelaTextBox.Text, out cijena))
         {
             String nazivJela = nazivJelaTextBox.Text;
             if (handler.checkIfEntryExists("jelo", 0, nazivJela) == 1)
             {
                 MessageBox.Show("Postoji jelo sa datim nazivom!");
                 nazivJelaTextBox.Clear();
             }
             else
             {
                 if (path == null)
                 {
                     MessageBox.Show("Odaberite sliku jela!");
                 }
                 else
                 {
                     jelo j = new jelo(nazivJela, opisJelaTextBox.Text, tipJelaTextBox.Text, cijena);
                     using (FamiliaContextClass db = new FamiliaContextClass())
                     {
                         db.jelo.Add(j);
                         try
                         {
                             db.SaveChanges();
                         }
                         catch (Exception ex)
                         {
                             Console.Write(ex.StackTrace);
                             Console.WriteLine(ex.InnerException);
                         }
                     }
                     handler.updateEntry("jelo", path, j.jeloID, -1);
                     path = null;
                     Page dash = new Dashboard(service);
                     NavigationService.Navigate(dash);
                 }
             }
         }
         else
         {
             MessageBox.Show("Neodgovarajuća cijena!");
             cijenaJelaTextBox.Clear();
         }
     }
     else
     {
         MessageBox.Show("Unesite sve potrebne parametre!");
     }
 }
 private void dodajButton_Click(object sender, RoutedEventArgs e)
 {
     if (!String.IsNullOrEmpty(imeTextBox.Text) ||
         !String.IsNullOrEmpty(prezimeTextBox.Text) ||
         !String.IsNullOrEmpty(idTextBox.Text) ||
         !String.IsNullOrEmpty(passwordTextBox.Password))
     {
         int id;
         if (Int32.TryParse(idTextBox.Text, out id))
         {
             if (passwordTextBox.Password.Equals(passwordTextBox_Copy.Password))
             {
                 vozac v = new vozac(imeTextBox.Text, prezimeTextBox.Text, id, passwordTextBox.Password);
                 using (FamiliaContextClass db = new FamiliaContextClass())
                 {
                     db.vozac.Add(v);
                     try
                     {
                         db.SaveChanges();
                     }
                     catch (Exception ex)
                     {
                         Console.Write(ex.StackTrace);
                         Console.WriteLine(ex.InnerException);
                     }
                     Page dash = new Dashboard(service);
                     NavigationService.Navigate(dash);
                 }
             }
             else
             {
                 MessageBox.Show("Unijete lozinke se ne poklapaju!");
                 passwordTextBox.Clear();
                 passwordTextBox_Copy.Clear();
             }
         }
         else
         {
             MessageBox.Show("Nekorektan tip identifikacijske oznake vozača!");
             idTextBox.Clear();
         }
     }
     else
     {
         MessageBox.Show("Unesite sve potrebne parametre!");
     }
 }
        public FoodPick(int nID, Service service)
        {
            InitializeComponent();

            this.service = service;
            narudzbaID   = nID;
            //inicijalizacija resursa
            jela      = new List <jelo>();
            db        = new FamiliaContextClass();
            dbHandler = new DBHandler();
            tr        = new TextRange(opisJela.Document.ContentStart, opisJela.Document.ContentEnd);
            //ucitavanje jela iz baze
            jela = dbHandler.loadJela();
            urls = dbHandler.loadJelaUrls();
            //scroll view jela
            createScroll();
            //scroll view kolicine jela
            createScrollForDishes();
        }
 private void dodajButton_Click(object sender, RoutedEventArgs e)
 {
     if (!(String.IsNullOrEmpty(idTextBox.Text) ||
           String.IsNullOrEmpty(tipTextBox.Text) ||
           String.IsNullOrEmpty(nosivostTextBox.Text)))
     {
         int id;
         if (Int32.TryParse(idTextBox.Text, out id))
         {
             if (handler.checkIfEntryExists("vozilo", id, null) == 1)
             {
                 MessageBox.Show("Vozilo sa unesenom identifikacijskom oznakom već postoji!");
                 idTextBox.Clear();
             }
             else
             {
                 int nosivost;
                 if (Int32.TryParse(nosivostTextBox.Text, out nosivost))
                 {
                     if (path == null)
                     {
                         MessageBox.Show("Unesite sliku vozila!");
                     }
                     else
                     {
                         vozilo v = new vozilo(id, tipTextBox.Text, nosivost);
                         using (FamiliaContextClass db = new FamiliaContextClass())
                         {
                             db.vozilo.Add(v);
                             try
                             {
                                 db.SaveChanges();
                             }
                             catch (Exception ex)
                             {
                                 Console.Write(ex.StackTrace);
                                 Console.WriteLine(ex.InnerException);
                             }
                         }
                         handler.updateEntry("vozilo", path, id, -1);
                         path = null;
                         Page dash = new Dashboard(service);
                         NavigationService.Navigate(dash);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Nevalidna nosivost vozila!");
                     nosivostTextBox.Clear();
                 }
             }
         }
         else
         {
             MessageBox.Show("Nevalidna identifikacijska oznaka vozila!");
             idTextBox.Clear();
         }
     }
     else
     {
         MessageBox.Show("Unesite sve potrebne parametre!");
     }
 }