Pero Grubač

Store Management

Desktop app for a retail store, with admin and cashier roles.

Prodavnica.Core · class libraryvia Sessionparameterised SQLCALL procedures,JSON linesproject referenceintegration testsCompose initmysql clientAdmin, cashierrole: isAdminProdavnicaWinForms · 3 languagesServicescart, inventory, validatorsRepositoriesMySqlConnector · DataErrorsPasswordBCrypt, work factor 11MySQL 8prodavnica · 11 tablesDDL.sqltables, procedures, app userProdavnica.TestsxUnit · TestcontainersMySQL 8Testcontainers · throwaway
Administrators and cashiers sign in to one WinForms app, which does all its data work through a class library with no UI. Core reaches MySQL with parameterised SQL over MySqlConnector, and every sale or procurement is one stored procedure that locks the product rows, checks expiry and stock, and commits or rolls back. The app connects as prodavnica_app, which can't change the schema. The same DDL.sql builds the Docker Compose database and the throwaway database of the integration tests.
Store Management: admin dashboard with the sales chart, and the cashier till with a cart

What it does

Store Management is a Windows point-of-sale and inventory app for a small shop. I first built it for the Human–Computer Interaction course, and later rebuilt it with a modern interface, a tested data layer and CI.

Each role sees only what its job needs, and the sidebar lists just that role’s sections. Cashiers sell at the till, browse products, see bills and print receipts. Administrators can do everything a cashier can, and they also manage products, procurement, staff, manufacturers, suppliers and categories, and read a searchable activity log of sign-ins, sales, procurements and every change.

  • Dashboard: today’s sales, the stock value, low-stock and expiry counts, a 14-day sales chart, the latest bills and a Needs attention list.
  • Till: scan or type a bar code, or click product cards. Quantities take decimals for goods sold by weight, and a quantity above the stock turns red and disables Charge. Charging saves the bill, lowers the stock and opens the receipt, ready to print.
  • Products as picture cards or as a table, with live search, a category filter and paging. Fields are checked as you type and on save, and a product that has been sold cannot be deleted.
  • Procurement from a supplier at purchase prices, pre-filled with the last price paid, and bills and procurements for any date range, with details and printing.
  • Appearance per user: every account has its own picture, accent colour, font, text size and language (Serbian Latin, Serbian Cyrillic or English), applied at once.

Badges mark stock and expiry: fewer than 10 pieces shows Only N left, and a best-before date within 30 days shows Expires soon. An out-of-stock product is not offered at the till, and an expired one is refused by both the till and the database.

How it works

The WinForms app talks only to a class library that holds the data access and the rules and has no WinForms reference. All database calls are asynchronous, so the window never freezes while a query runs.

A sale goes like this. When the cashier scans a bar code or clicks a card, the inventory service checks that the product is in stock and not expired. On Charge, the sales repository calls a stored procedure with the user, the time and the bill lines as JSON. Inside one transaction, the procedure locks each product row, checks its expiry and stock, inserts the line at the current price and lowers the stock, then commits, or rolls back on any error, and returns the bill number. The app logs the activity, shows the receipt and reloads the products. A procurement works the same way through a second procedure, which raises the stock instead.

Errors raised in the procedures, such as insufficient stock or an expired product, and constraint violations, such as duplicates, products still in use or negative stock, reach the user as translated messages.

Decisions and why

  • A UI-free core. Data access and rules live in the class library, so they are tested without a screen, the forms stay thin, and the tests run on Linux in CI.
  • The database guards its own data. Transactions with row locks, a CHECK constraint that keeps stock at zero or above, and unique keys stop overselling and duplicates even if two tills sell at once.
  • Paging and search in SQL. Lists ask the database for one page at a time, so they stay fast with thousands of bills.
  • One look, built in code. A small set of custom-drawn controls replaces the designer forms, and the user’s colour is used only as an accent, so any choice stays readable.
  • Readable errors. MySQL error numbers and procedure signals become stable codes, such as IN_USE or INSUFFICIENT_STOCK, which the UI translates.

Security

  • Least privilege. The app signs in to MySQL with a restricted account that can read and write data and call the procedures but cannot change the schema. An integration test proves it cannot drop tables.
  • Passwords are hashed with BCrypt, and changing one requires the current password.
  • Nobody can delete their own account or the last administrator.

Testing and deployment

There are 90 unit tests and 30 integration tests. The unit tests cover the cart, the stock and expiry rules, product and staff validation in two cultures, paging and search patterns, and password hashing. The integration tests start MySQL 8 with Testcontainers and load the same schema script as Docker Compose. They cover, among other things, product CRUD, the unique and in-use protection, negative stock being rejected, sales at database prices with a rollback on insufficient stock or an expired product, procurement, sign-in, the staff rules, the dashboard and the restricted app account.

In CI, a job on Ubuntu runs the unit and integration tests and uploads the results and coverage, and a job on Windows builds the whole solution and fails on NuGet packages with known vulnerabilities. For version tags, a release job attaches a self-contained, single-file win-x64 build to a GitHub release, so the app runs without a .NET installation. Documentation-only changes don’t start CI, and a newer push cancels the older run.

HomepageAboutsectionSystemssectionIndex of projectssectionBrowser appspageContactsectionIncident Alertsystem · case studyeMobilityHubsystem · case studyChat Roomsystem · case studyOnline Library Systemsystem · case studyRepoHealthlive app · case studyOpen RepoHealth app (opens in a new tab)live appGitHub Discord Bottool · case studyBookstore APIweb project · case studyFitForgemobile app · case studyAssetManagermobile app · case studyStore Managementdesktop app · case studyETF Oglasimobile app · case studyDevKitlive app · case studyOpen DevKit app (opens in a new tab)live appDev Timelinelive app · case studyOpen Dev Timeline app (opens in a new tab)live appGitHub Dashboardlive app · case studyOpen GitHub Dashboard app (opens in a new tab)live appStore Chain Managementdesktop app · case studySecure Repositorytool · case studyMinimal Blogweb project · case studyCatan Map Generatorlive app · case studyOpen Catan Map Generator app (opens in a new tab)live appMonte Carlo π · Pythonlive app · case studyOpen Monte Carlo π · Python app (opens in a new tab)live appBrick Breakerlive app · case studyOpen Brick Breaker app (opens in a new tab)live appArcane Keeplive app · case studyOpen Arcane Keep app (opens in a new tab)live appe-Mobility Rentaldesktop app · case studyCountdownlive app · case studyOpen Countdown app (opens in a new tab)live appANOVAdesktop app · case studyEcho Playerdesktop app · case studyMonte Carlo πdesktop app · case studyexcuse.exelive app · case studyOpen excuse.exe app (opens in a new tab)live appYamb Tablelive app · case studyOpen Yamb Table app (opens in a new tab)live appSedmicalive app · case studyOpen Sedmica app (opens in a new tab)live appLora Score Tablelive app · case studyOpen Lora Score Table app (opens in a new tab)live appSnake (Blavor)desktop app · case study
Copy emailpero.grubac00@gmail.com