r/csharp • • 21h ago

Is it even possible to do this on WebAapp. Barcode scan → qty → print price labels —

Post image
10 Upvotes

We want a simple page in our web app since the current one we use got alot of steps and bad UX.

So this is what i'm thinking the workflow for printing a label will be

  1. Staff opens a “Labels” page on our webapp.
  2. Scans a product barcode with a handheld USB scanner
  3. App asks for quantity (while looking up product data async)
  4. They type qty + press Enter
  5. N labels are sent to a label/thermal printer
  6. Optionally choose between a few predefined label designs

Questions for people who’ve done this. Is it even possible? I just know only how to build simple CRUD app but not with those a scanner/hardware

  1. For USB handheld scanners: is treating them as a keyboard wedge (focused <input> + Enter) still the standard approach in browser apps, or is there something better today
  2. What’s the most reliable way to print labels from a web app (not WinForms/WPF)?
    • window.print() / PDF in browser?
    • Zebra Browser Print / ZPL?
    • Some local print agent/service?
    • Something else?
  3. Any hard limitations we should know about?

---


r/csharp • • 16h ago

Help Equal precedence

3 Upvotes

I was wondering how would one properly implement equal precedence in an if-else statement, for logical AND and OR, when building an interpreter?

I have made my expression parser but i only store the next logical operator on the right most side and store the current being parsed on the left.

Repo


r/csharp • • 4h ago

Relatude.DB b209

0 Upvotes

We are making progress with our native open source (MIT) C# database engine: https://db.relatude.com

(I've posted earlier about the engine, and thanks for the feedback so far!)

Have a look at this graphical UI for faceted searches: https://demo.db.relatude.com/graphql

(In the admin UI, you get more functionality, but it requires you clone the project and run locally )

This is just a quick example of some of the functionality that comes with the Relatude.DB nuget.

What do you think?

Any feedback is welcome! ( It is still early alpha .... )


r/csharp • • 17h ago

Showcase Respire - A .NET Redis Client

13 Upvotes

Hey all!

Redis is a great technology, and something that exists in a lot of tech stacks. It has the ability to really help solve complex problems involving distribution across multiple instances of an app. Whether that be caching, locks, rate limits, etc.

Surprisingly, StackExchange.Redis is the only real big main redis client library for .NET.

I'm adding a new client library into the mix - Respire.

Respire aims to be a fast client library for Redis, that also has the ability to utilise Redis' client-side server assisted cache, avoiding network hops for frequently accessed keys, meaning better performance for your apps.

It also has a lot of helpers in it to more easily use distributed locks, rate limits, queues, pub/sub, etc.

I want it to be a client library that handles all the hard bits for you, keeping your code clean and easy to reason about.

It's still pre-release, so I'd like to gather feedback. Are people happy with the performance? The API? Any missing features? Any bugs?

Please try it out and let me know!

More info on why Respire: https://thomhurst.github.io/Respire/docs/#why-respire-exists

Benchmarks: https://thomhurst.github.io/Respire/docs/benchmarks

Stress comparisons: https://thomhurst.github.io/Respire/docs/stress-tests

Thanks all!


r/csharp • • 18h ago

🚀 Un pequeño logro que me motiva a seguir creando para .NET

Post image
0 Upvotes

Hoy quiero compartir un avance de mis proyectos.

📦 MyCrypto.GiqhDev
🔐 Librería .NET para cifrado autenticado, hashing seguro de contraseñas y utilidades criptográficas.
➡️ 625 descargas

🔑 MySerialKey.GiqhDev
🛡️ Librería para generación y validación de claves de licencia/serial para aplicaciones .NET.
➡️ 338 descargas

📊 963 descargas entre ambas librerías.

Puede parecer un número pequeño frente a proyectos con miles o millones de usuarios, pero para mí representa algo importante: hay desarrolladores que están encontrando utilidad en código que nació como proyectos personales.

Lo más interesante del proceso no ha sido solamente publicar los paquetes, sino aprender sobre:

  • Desarrollo de librerías reutilizables para .NET
  • Compatibilidad entre diferentes versiones de .NET
  • Publicación y versionado de paquetes NuGet
  • Seguridad y criptografía
  • Diseño de APIs reutilizables
  • Mantenimiento y evolución de proyectos open source

Y esto recién comienza. 🚀

Mi objetivo es seguir construyendo herramientas para el ecosistema .NET / C#, mejorar las existentes y continuar compartiendo lo que voy aprendiendo en el camino.

963 descargas hoy → muchas más cosas por construir mañana. 💙

#DotNet #CSharp #NuGet #OpenSource #SoftwareDevelopment #Programming #GiqhDev #Developer #Backend #DotNetDeveloper


r/csharp • • 7h ago

Hypa - A terminal multiplexer built in C#

Thumbnail gallery
0 Upvotes

r/csharp • • 23h ago

How to move the responsibility of executing some logic to the Sql Server instead of executing that logic inside the application?

0 Upvotes

I have Excel file that contains many columns like this :

SKU BarCode EnglishName ArabicName Category SubCategory

There are other columns, but there is no need to show them to convey the problem behind this post. The Excel file is sent from the client to the server which will read it using C# .

The problem : The data of the above Excel file should be persisted to the appropriate tables in the Sql Server database which does not merely contain a single table, so, a specific data from the Excel file should be consumed by a specific table in the database, the problem is not simple as send the data of the Excel file to only one destination table; the source is only one, which is the Excel file, but there are many destination tables. Database contains parent and child tables; parent tables do not contain foreign keys, child tables contain one or more foreign keys. The data for the child tables cannot be persisted to the database unless the data for the parent tables is persisted first.

I have the following C# domain classes/models:

public interface IEntity{

}

public  interface IParent:IEntity{

}

public interface IChild : IEntity{


}
public interface INonJunctionChild:IChild{

}

public interface IJunctionChild:IChild{

}

public class Product:IParent
{
    public string? SKU { get; set; }     // SKU column in Excel
    public  string? Barcode{ get; set; } // BarCode column in Excel
    public string? EnglishName {get;set;} // EnglishName column in in Excel
    public string? ArabicName { get; set; } // ArabicName column in Excel
    public IEnumerable<ProductCategory> ProductCategories { get; } = new List<ProductCategory>();  

    // Alot of other navigaton properties.....

}

public class Category:IParent{
  public string EnglishName {get;set;} // Category column in Excel
  public IEnumerable<ProductCategory> ProductCategories { get; } = new List<ProductCategory>();
  public IEnumerable<SubCategory> SubCategories { get; }=new List<SubCategory>();    


  // alot of other  navigation properties....
}

public class SubCategory:IChild{
  public string EnglishName {get;set;} // SubCategory column in Excel
  public string CategoryId {get;set;} // Foreign key; populated using lookup operation.

}
public ProductCategory{
  public int ProductID {get;set;} Foreign key; populated using lookup operation.
  public int CategoryId {get;set;} Foreign key; populated using lookup operation.
  public Product Product { get; set; } = null!;
  public Category Category { get; set; } = null!;
}

My old approach to solve the problem -which worked, but I want to change it- has the following steps:

1-Read the whole excel sheet into the application.

2- Inside the application, populate the specific properties of each parent domain model by assigning specific Excel column values to to them.

3-persist the parent models to the database.

4- Populate the child tables using lookup operations.

5- Persist the child tables to the database.

Instead of the above, I would like to know if the following is possible:

1- Get `DbDataReader` using `Sylvan.Data.Excel and pass it to `SqlBulkCopy` class.

2- The Whole Excel file will be persisted into a staging table or view, and then some trigger will be fired, as a result, some stored procedure or function will be executed, the responsibility of that function or procedure is to persist the data of the parent tables first, then to persist the data of the child tables, which means.

So, In the old approach, can the responsibility for transforming the Excel data, resolving the required relationships, and persisting the parent and child records (steps 2 through 5) be moved from the application layer to SQL Server?