예제 #1
0
        public string InsertRobu(Magacin roba)
        {
            using (OracleConnection connection = new OracleConnection(ConnectionString.GetString()))
            {
                connection.Open();
                string sql = "insert into magacin values(" + roba.Id_robe +
                             ",\'" + roba.Naziv + "\'" +
                             "," + roba.Kolicina +
                             "," + roba.GetJM().Id_jm + ")";

                OracleCommand command = new OracleCommand(sql, connection);

                try
                {
                    command.ExecuteNonQuery();
                    return("Uspesno uneta roba!");
                }
                catch
                {
                    return("Doslo je do greske prilikom unosenja robe!");
                }
            }
        }
예제 #2
0
        public string UpdateMagacin(Magacin roba)
        {
            using (OracleConnection connection = new OracleConnection(ConnectionString.GetString()))
            {
                connection.Open();
                string sql = "update magacin set" +
                             " naziv = \'" + roba.Naziv + "\'" +
                             ", kolicina = " + roba.Kolicina +
                             ", id_jm = " + roba.GetJM().Id_jm +
                             "where id_robe = " + roba.Id_robe;
                OracleCommand command = new OracleCommand(sql, connection);

                try
                {
                    command.ExecuteNonQuery();
                    return("Uspesno ste azurirali stanje u magacinu!");
                }
                catch
                {
                    return("Doslo je do greske prilikom azuriranja stanja u magacinu!");
                }
            }
        }