public ObservableCollection <TehnPostupakOperacija> GetAllFromTehnPostupakOperacija()
        {
            ObservableCollection <TehnPostupakOperacija> tehnPostupakOperacijaList = new ObservableCollection <TehnPostupakOperacija>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_TEHN_POSTUPAK_OPERACIJA, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    TehnPostupakOperacija tehnPostupakOperacija = new TehnPostupakOperacija();
                    tehnPostupakOperacija.IDTehnPostupakOperacija = rdr.GetInt32(0);
                    tehnPostupakOperacija.TehnoloskiPostupak      = new TehnoloskiPostupak
                    {
                        IDTehPostupak  = rdr.GetInt32(1),
                        TipTehPostupak = rdr.GetString(5)
                    };
                    tehnPostupakOperacija.Operacija = new Operacija
                    {
                        IDOperacija    = rdr.GetInt32(2),
                        NazivOperacije = rdr.GetString(4)
                    };
                    tehnPostupakOperacija.RBrOperacije = rdr.GetInt32(3);
                    tehnPostupakOperacijaList.Add(tehnPostupakOperacija);
                }
            }

            return(tehnPostupakOperacijaList);
        }
        public bool CreateRadnaListaById(RadnaLista radnaListaNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(CREATE_RADNA_LISTA, sqlConnection);

                cmd.Parameters.AddWithValue("@Datum", NpgsqlDbType.Date, radnaListaNew.Datum);
                cmd.Parameters.AddWithValue("@Kolicina", NpgsqlDbType.Integer, radnaListaNew.Kolicina);
                if (radnaListaNew.Radnik != null)
                {
                    cmd.Parameters.AddWithValue("@IDRadnik", NpgsqlDbType.Integer, radnaListaNew.Radnik.IDRadnik);
                }
                else
                {
                    cmd.Parameters.AddWithValue("@IDRadnik", NpgsqlDbType.Integer, DBNull.Value);
                }
                cmd.Parameters.AddWithValue("@IDRadniNalog", NpgsqlDbType.Integer, radnaListaNew.RadniNalog.IDRadniNalog);
                cmd.Parameters.AddWithValue("@IDOperacija", NpgsqlDbType.Integer, radnaListaNew.Operacija.IDOperacija);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public ObservableCollection <RadniNalog> GetAllFromRadniNalog()
        {
            ObservableCollection <RadniNalog> radniNalogList = new ObservableCollection <RadniNalog>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_RADNI_NALOG, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    RadniNalog radniNalog = new RadniNalog();
                    radniNalog.IDRadniNalog               = rdr.GetInt32(0);
                    radniNalog.DatumUlaz                  = rdr.GetDateTime(1);
                    radniNalog.DatumIzlaz                 = rdr.GetDateTime(2);
                    radniNalog.KolicinaProizvoda          = rdr.GetInt32(3);
                    radniNalog.PredmetRada                = new PredmetRada();
                    radniNalog.PredmetRada.IDPredmetRada  = rdr.GetInt32(4);
                    radniNalog.PredmetRada.TipPredmetRada = rdr.GetString(5);
                    radniNalog.PredmetRada.NazivPR        = rdr.GetString(6);
                    radniNalogList.Add(radniNalog);
                }
            }

            return(radniNalogList);
        }
예제 #4
0
        public ObservableCollection <TehnoloskiPostupak> GetAllFromTehnoloskiPostupak()
        {
            ObservableCollection <TehnoloskiPostupak> tehnoloskiPostupakList = new ObservableCollection <TehnoloskiPostupak>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_TEHNOLOSKI_POSTUPAK, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    TehnoloskiPostupak tehnoloskiPostupak = new TehnoloskiPostupak();
                    tehnoloskiPostupak.IDTehPostupak  = rdr.GetInt32(0);
                    tehnoloskiPostupak.TipTehPostupak = rdr.GetString(1);
                    tehnoloskiPostupak.VremeIzrade    = rdr.GetInt32(2);
                    tehnoloskiPostupak.SerijaKom      = rdr.GetInt32(3);
                    tehnoloskiPostupak.BrKomada       = rdr.GetInt32(4);
                    tehnoloskiPostupakList.Add(tehnoloskiPostupak);
                }
            }

            return(tehnoloskiPostupakList);
        }
        public ObservableCollection <PredmetRada> GetAllFromPredmetRada()
        {
            ObservableCollection <PredmetRada> predmetRadaList = new ObservableCollection <PredmetRada>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_PREDMET_RADA, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    PredmetRada predmetRada = new PredmetRada();
                    predmetRada.IDPredmetRada  = rdr.GetInt32(0);
                    predmetRada.TipPredmetRada = rdr.GetString(1);
                    predmetRada.NazivPR        = rdr.GetString(2);
                    predmetRada.JedMerePR      = rdr.GetString(3);
                    predmetRada.Cena           = rdr.GetInt32(4);
                    predmetRadaList.Add(predmetRada);
                }
            }

            return(predmetRadaList);
        }
예제 #6
0
        public ObservableCollection <RadnikProizvodnja> GetAllFromRadnikProizvodnja()
        {
            ObservableCollection <RadnikProizvodnja> radnikProizvodnjaList = new ObservableCollection <RadnikProizvodnja>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_RADNIK_PROIZVODNJA, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    RadnikProizvodnja radnikProizvodnja = new RadnikProizvodnja();
                    radnikProizvodnja.IDRadnik                   = rdr.GetInt32(0);
                    radnikProizvodnja.ImeRadnika                 = rdr.GetString(1);
                    radnikProizvodnja.PrezimeRadnika             = rdr.GetString(2);
                    radnikProizvodnja.Pol                        = rdr.GetString(3);
                    radnikProizvodnja.RadnoMesto                 = new RadnoMesto();
                    radnikProizvodnja.RadnoMesto.IDRadnoMesto    = rdr.GetInt32(4);
                    radnikProizvodnja.RadnoMesto.NazivRadnoMesto = rdr.GetString(5);
                    radnikProizvodnjaList.Add(radnikProizvodnja);
                }
            }

            return(radnikProizvodnjaList);
        }
        public ObservableCollection <Operacija> GetAllFromOperacija()
        {
            ObservableCollection <Operacija> operacijaList = new ObservableCollection <Operacija>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_OPERACIJA, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Operacija operacija = new Operacija();
                    operacija.IDOperacija    = rdr.GetInt32(0);
                    operacija.NazivOperacije = rdr.GetString(1);
                    operacija.OsnovnoVreme   = rdr.GetInt32(2);
                    operacija.PomocnoVreme   = rdr.GetInt32(3);
                    operacija.DodatnoVreme   = rdr.GetInt32(4);
                    operacija.OznakaMasine   = rdr.GetString(5);
                    operacijaList.Add(operacija);
                }
            }

            return(operacijaList);
        }
        public User FindUserByEmailAndPassword(string email, string password)
        {
            User result = null;

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_USER_BY_EMAIL_AND_PASSWORD, sqlConnection);

                cmd.Parameters.AddWithValue("@Email", NpgsqlDbType.Varchar, email);
                cmd.Parameters.AddWithValue("@Password", NpgsqlDbType.Varchar, password);

                NpgsqlDataReader reader = cmd.ExecuteReader();

                if (reader.Read())
                {
                    result           = new User();
                    result.Ime       = reader[0].ToString();
                    result.Prezime   = reader[1].ToString();
                    result.Password  = reader[2].ToString();
                    result.Username  = reader[3].ToString();
                    result.Email     = reader[4].ToString();
                    result.ImagePath = reader[5].ToString();
                }

                return(result);
            }
        }
        public ObservableCollection <Trebovanje> GetAllFromTrebovanje()
        {
            ObservableCollection <Trebovanje> trebovanjeList = new ObservableCollection <Trebovanje>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_TREBOVANJE, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    Trebovanje trebovanje = new Trebovanje();
                    trebovanje.IDTrebovanje            = rdr.GetInt32(0);
                    trebovanje.TipTrebovanja           = rdr.GetString(1);
                    trebovanje.JedMere                 = rdr.GetString(2);
                    trebovanje.KolicinaRobe            = rdr.GetInt32(3);
                    trebovanje.RadniNalog              = new RadniNalog();
                    trebovanje.RadniNalog.IDRadniNalog = rdr.GetInt32(4);
                    trebovanjeList.Add(trebovanje);
                }
            }

            return(trebovanjeList);
        }
        public bool DeleteFromTrebovanjeById(int iDTrebovanje)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(DELETE_FROM_TREBOVANJE_BY_ID, sqlConnection);

                cmd.Parameters.AddWithValue("@Id", NpgsqlDbType.Integer, iDTrebovanje);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool DeleteFromRadniNalogById(int iDRadniNalog)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(DELETE_FROM_RADNI_NALOG_BY_ID, sqlConnection);

                cmd.Parameters.AddWithValue("@Id", NpgsqlDbType.Integer, iDRadniNalog);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool FindIfUserExistsByEmail(string email)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_USER_BY_EMAIL, sqlConnection);

                cmd.Parameters.AddWithValue("@Email", NpgsqlDbType.Varchar, email);

                NpgsqlDataReader reader = cmd.ExecuteReader();

                return(reader.HasRows);
            }
        }
예제 #13
0
        public bool DeleteFromTehnoloskiPostupakById(int iDTehPostupak)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(DELETE_FROM_TEHNOLOSKI_POSTUPAK_BY_ID, sqlConnection);

                cmd.Parameters.AddWithValue("@Id", NpgsqlDbType.Integer, iDTehPostupak);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool DeleteFromOperacijaById(int iDOperacija)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(DELETE_FROM_OPERACIJA_BY_ID, sqlConnection);

                cmd.Parameters.AddWithValue("@Id", NpgsqlDbType.Integer, iDOperacija);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool CreateRadnoMestoById(RadnoMesto radnoMestoNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(CREATE_RADNO_MESTO, sqlConnection);

                cmd.Parameters.AddWithValue("@NazivRadnogMesta", NpgsqlDbType.Varchar, radnoMestoNew.NazivRadnoMesto);
                cmd.Parameters.AddWithValue("@StrucnaSprema", NpgsqlDbType.Varchar, radnoMestoNew.StrucnaSprema);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool UpdateRBrOperacijaFromTehnPostupakOperacija(TehnPostupakOperacija tehnPostupakOperacija)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(UPDATE_RBROPERACIJE_FROM_TEHN_POSTUPAK_OPERACIJA_BY_ID, sqlConnection);

                cmd.Parameters.AddWithValue("@Id", NpgsqlDbType.Integer, tehnPostupakOperacija.IDTehnPostupakOperacija);
                cmd.Parameters.AddWithValue("@RBrOperacije", NpgsqlDbType.Integer, tehnPostupakOperacija.RBrOperacije);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool CreateTehnPostupakOperacijaById(TehnPostupakOperacija tehnPostupakOperacijaNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(CREATE_TEHN_POSTUPAK_OPERACIJA, sqlConnection);

                cmd.Parameters.AddWithValue("@IDTehPostupak", NpgsqlDbType.Integer, tehnPostupakOperacijaNew.TehnoloskiPostupak.IDTehPostupak);
                cmd.Parameters.AddWithValue("@IDOperacija", NpgsqlDbType.Integer, tehnPostupakOperacijaNew.Operacija.IDOperacija);
                cmd.Parameters.AddWithValue("@RbrOperacije", NpgsqlDbType.Integer, tehnPostupakOperacijaNew.RBrOperacije);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool CreatePredmetRadaById(PredmetRada predmetRadaNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(CREATE_PREDMET_RADA, sqlConnection);

                cmd.Parameters.AddWithValue("@TipPredmetRada", NpgsqlDbType.Varchar, predmetRadaNew.TipPredmetRada);
                cmd.Parameters.AddWithValue("@NazivPR", NpgsqlDbType.Varchar, predmetRadaNew.NazivPR);
                cmd.Parameters.AddWithValue("@JedMerePR", NpgsqlDbType.Varchar, predmetRadaNew.JedMerePR);
                cmd.Parameters.AddWithValue("@Cena", NpgsqlDbType.Integer, predmetRadaNew.Cena);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
예제 #19
0
        public bool CreateTehnoloskiPostupakById(TehnoloskiPostupak tehnoloskiPostupakNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(CREATE_TEHNOLOSKI_POSTUPAK, sqlConnection);

                cmd.Parameters.AddWithValue("@TipTehPostupak", NpgsqlDbType.Varchar, tehnoloskiPostupakNew.TipTehPostupak);
                cmd.Parameters.AddWithValue("@VremeIzrade", NpgsqlDbType.Integer, tehnoloskiPostupakNew.VremeIzrade);
                cmd.Parameters.AddWithValue("@SerijaKom", NpgsqlDbType.Integer, tehnoloskiPostupakNew.SerijaKom);
                cmd.Parameters.AddWithValue("@BrKomada", NpgsqlDbType.Integer, tehnoloskiPostupakNew.BrKomada);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
예제 #20
0
        public bool UpdateRadnikProizvodnjaById(RadnikProizvodnja radnikProizvodnjaNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(UPDATE_RADNIK_PROIZVODNJA_BY_ID, sqlConnection);

                cmd.Parameters.AddWithValue("@Id", NpgsqlDbType.Integer, radnikProizvodnjaNew.IDRadnik);
                cmd.Parameters.AddWithValue("@ImeRadnika", NpgsqlDbType.Varchar, radnikProizvodnjaNew.ImeRadnika);
                cmd.Parameters.AddWithValue("@PrezimeRadnika", NpgsqlDbType.Varchar, radnikProizvodnjaNew.PrezimeRadnika);
                cmd.Parameters.AddWithValue("@Pol", NpgsqlDbType.Varchar, radnikProizvodnjaNew.Pol);
                cmd.Parameters.AddWithValue("@IDRadnoMesto", NpgsqlDbType.Integer, radnikProizvodnjaNew.RadnoMesto.IDRadnoMesto);
                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool CreateRadniNalogById(RadniNalog radniNalogNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(CREATE_RADNI_NALOG, sqlConnection);

                cmd.Parameters.AddWithValue("@DatumUlaz", NpgsqlDbType.Date, radniNalogNew.DatumUlaz);
                cmd.Parameters.AddWithValue("@DatumIzlaz", NpgsqlDbType.Date, radniNalogNew.DatumIzlaz);
                cmd.Parameters.AddWithValue("@KolicinaProizvoda", NpgsqlDbType.Integer, radniNalogNew.KolicinaProizvoda);
                cmd.Parameters.AddWithValue("@IDPredmetRada", NpgsqlDbType.Integer, radniNalogNew.PredmetRada.IDPredmetRada);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool CreateTrebovanjeById(Trebovanje trebovanjeNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(CREATE_TEHNOLOSKI_POSTUPAK, sqlConnection);

                cmd.Parameters.AddWithValue("@TipTrebovanja", NpgsqlDbType.Varchar, trebovanjeNew.TipTrebovanja);
                cmd.Parameters.AddWithValue("@JedMere", NpgsqlDbType.Varchar, trebovanjeNew.JedMere);
                cmd.Parameters.AddWithValue("@KolicinaRobe", NpgsqlDbType.Integer, trebovanjeNew.KolicinaRobe);
                cmd.Parameters.AddWithValue("@IDRadniNalog", NpgsqlDbType.Integer, trebovanjeNew.RadniNalog.IDRadniNalog);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool CreateOperacijaById(Operacija operacijaNew)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(CREATE_OPERACIJA, sqlConnection);

                cmd.Parameters.AddWithValue("@NazivOperacije", NpgsqlDbType.Varchar, operacijaNew.NazivOperacije);
                cmd.Parameters.AddWithValue("@OsnovnoVreme", NpgsqlDbType.Integer, operacijaNew.OsnovnoVreme);
                cmd.Parameters.AddWithValue("@PomocnoVreme", NpgsqlDbType.Integer, operacijaNew.PomocnoVreme);
                cmd.Parameters.AddWithValue("@DodatnoVreme", NpgsqlDbType.Integer, operacijaNew.DodatnoVreme);
                cmd.Parameters.AddWithValue("@OznakaMasine", NpgsqlDbType.Varchar, operacijaNew.OznakaMasine);

                int rowsAffected = cmd.ExecuteNonQuery();

                return(rowsAffected == 1);
            }
        }
        public bool CreateUser(User user)
        {
            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(INSERT_USER, sqlConnection);

                cmd.Parameters.AddWithValue("@Email", NpgsqlDbType.Varchar, user.Email);
                cmd.Parameters.AddWithValue("@Password", NpgsqlDbType.Varchar, user.Password);
                cmd.Parameters.AddWithValue("@Ime", NpgsqlDbType.Varchar, user.Ime);
                cmd.Parameters.AddWithValue("@Prezime", NpgsqlDbType.Varchar, user.Prezime);
                cmd.Parameters.AddWithValue("@Username", NpgsqlDbType.Varchar, user.Username);
                cmd.Parameters.AddWithValue("@ImagePath", NpgsqlDbType.Varchar, user.ImagePath ?? " ");

                int insertedRows = cmd.ExecuteNonQuery();

                return(insertedRows == 1);
            }
        }
        public ObservableCollection <RadnaLista> GetAllFromRadnaLista()
        {
            ObservableCollection <RadnaLista> radnaListaList = new ObservableCollection <RadnaLista>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_RADNA_LISTA, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    RadnaLista radnaLista = new RadnaLista();
                    radnaLista.IDRadnaLista             = rdr.GetInt32(0);
                    radnaLista.Datum                    = rdr.GetDateTime(1);
                    radnaLista.Kolicina                 = rdr.GetInt32(2);
                    radnaLista.RadniNalog               = new RadniNalog();
                    radnaLista.RadniNalog.IDRadniNalog  = rdr.GetInt32(4);
                    radnaLista.Operacija                = new Operacija();
                    radnaLista.Operacija.IDOperacija    = rdr.GetInt32(5);
                    radnaLista.Operacija.NazivOperacije = rdr.GetString(6);
                    if (!rdr.IsDBNull(3))
                    {
                        radnaLista.Radnik                = new RadnikProizvodnja();
                        radnaLista.Radnik.IDRadnik       = rdr.GetInt32(3);
                        radnaLista.Radnik.ImeRadnika     = rdr.GetString(7);
                        radnaLista.Radnik.PrezimeRadnika = rdr.GetString(8);
                    }
                    radnaListaList.Add(radnaLista);
                }
            }

            return(radnaListaList);
        }
        public ObservableCollection <RadnoMesto> GetAllFromRadnoMesto()
        {
            ObservableCollection <RadnoMesto> radnoMestoList = new ObservableCollection <RadnoMesto>();

            using (NpgsqlConnection sqlConnection = ConnectionCreator.createConnection())
            {
                sqlConnection.Open();

                NpgsqlCommand cmd = new NpgsqlCommand(GET_ALL_RECORDS_FROM_RADNO_MESTO, sqlConnection);

                NpgsqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    RadnoMesto radnoMesto = new RadnoMesto();
                    radnoMesto.IDRadnoMesto    = rdr.GetInt32(0);
                    radnoMesto.NazivRadnoMesto = rdr.GetString(1);
                    radnoMesto.StrucnaSprema   = rdr.GetString(2);
                    radnoMestoList.Add(radnoMesto);
                }
            }

            return(radnoMestoList);
        }