public bool Insert(invertarKlasa c)
        {
            //Create a boolean var and set its default value to false
            bool isSuccess = false;
            //Create an object of SqlConnection to connect DB
            SqlConnection conn = new SqlConnection(myconnstrng);

            if (c.sprava != "" && c.kolicina != 0)
            {
                try
                {
                    //Create a string var to store the insert query
                    String sql = "INSERT INTO tblInvertar(sprava,kolicina) VALUES (@sprava,@kolicina)";

                    //Create an SQL command to pass the value in our query
                    SqlCommand cmd = new SqlCommand(sql, conn);

                    //Create the paramater to get value from UI and pass it to SQL query above
                    cmd.Parameters.AddWithValue("@sprava", c.sprava);
                    cmd.Parameters.AddWithValue("@kolicina", c.kolicina);

                    //Open DB connection
                    conn.Open();

                    //INT value to hold the value after query is executed
                    int rows = cmd.ExecuteNonQuery();

                    if (rows > 0)
                    {
                        //Query executed successfully
                        isSuccess = true;
                    }
                    else
                    {
                        //Failed to execute query
                        isSuccess = false;
                    }
                }
                catch (Exception ex)
                {
                    //Display error mssg if there is any exceptional errors
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    //Close DB connection
                    conn.Close();
                }
                return(isSuccess);
            }
            else
            {
                MessageBox.Show("Niste unijeli ili naziv opreme ili količinu", "Upozorenje!");
                return(false);
            }
        }
        public bool Update(invertarKlasa c)
        {
            //Create a boolean var and set its default value to false
            bool isSuccess = false;
            //Create an object of SqlConnection to connect DB
            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                //Create a string var to store the insert query
                String sql = "UPDATE tblInvertar SET kolicina=@kolicina WHERE sprava=@sprava";


                //Create an SQL command to pass the value in our query
                SqlCommand cmd = new SqlCommand(sql, conn);

                //Create the paramater to get value from UI and pass it to SQL query above
                cmd.Parameters.AddWithValue("@sprava", c.sprava);
                cmd.Parameters.AddWithValue("@kolicina", c.kolicina);


                //Open DB connection
                conn.Open();

                //INT value to hold the value after query is executed
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    //Query executed successfully
                    isSuccess = true;
                }
                else
                {
                    //Failed to execute query
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                //Display error mssg if there is any exceptional errors
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //Close DB connection
                conn.Close();
            }
            return(isSuccess);
        }
        public bool Delete(invertarKlasa c)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                String     sql = "DELETE FROM tblInvertar WHERE sprava=@sprava AND kolicina=@kolicina";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@sprava", c.sprava);
                cmd.Parameters.AddWithValue("@kolicina", c.kolicina);
                conn.Open();
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    //Query executed successfully
                    isSuccess = true;
                }
                else
                {
                    //Failed to execute query
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
                //Display error mssg if there is any exceptional errors
                MessageBox.Show(ex.Message);
            }
            finally
            {
                //Close DB connection
                conn.Close();
            }
            return(isSuccess);
        }