Auger
Auger
CC#
Created by Pastafartian on 4/21/2025 in #help
Struggling with Securing Environment Variables in Deployed Desktop Apps
Yeah, this sounds like a scenario where you would want authentication of some sort. If you're working in a company, you might be able to onboard to their authentic provider, ex. Microsoft Entra and just having a verified work email is good enough. By being authenticated, you end up with some sort of token (like JWT) that you can configure to work with your backend, which would validate it when it receives a request from your desktop app and has your backend generate the PDF and email it (if I read what your app does correctly).
18 replies
CC#
Created by Potato Penguin on 4/22/2025 in #help
SQL overwrites instead off adds
Idk if it can even update data in the same row if the primary key is the same, but that's all I can think of with what I've been given.
30 replies
CC#
Created by Potato Penguin on 4/22/2025 in #help
SQL overwrites instead off adds
I guess I need more of the implementation and table schema. Do you have a non-incrementing primary key? If so, is CTitle the primary key?
30 replies
CC#
Created by Potato Penguin on 4/22/2025 in #help
SQL overwrites instead off adds
Oh private method
30 replies
CC#
Created by Potato Penguin on 4/22/2025 in #help
SQL overwrites instead off adds
Yeah I thought that returned an int
30 replies
CC#
Created by Potato Penguin on 4/22/2025 in #help
SQL overwrites instead off adds
That SqlConnection piece being the actual part that connects to a database, which would run your SqlCommand
30 replies
CC#
Created by Potato Penguin on 4/22/2025 in #help
SQL overwrites instead off adds
I don't see anywhere in your code where you actually connect to a data source that would actually house this information. Usually you do something like:
public bool AddNewCustomer(CustomerClass customer)
{
// Generally you don't want connection strings in your code
string connectionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=Username;Password=Password;";

using (SqlConnection connection = new SqlConnection(connectionString))
{
string query = "INSERT INTO tblCustomer VALUES(@CTitle, @CForename, @CSurname, @CEmail, @CContactNum1, @CContactNum2)";

using (SqlCommand command = new SqlCommand(query, connection))
{
// Add parameters for the CustomerClass properties
command.Parameters.AddWithValue("@CTitle", customer.CTitle);
command.Parameters.AddWithValue("@CForename", customer.CForename);
command.Parameters.AddWithValue("@CSurname", customer.CSurname);
command.Parameters.AddWithValue("@CEmail", customer.CEmail);
command.Parameters.AddWithValue("@CContactNum1", customer.CContactNum1);
command.Parameters.AddWithValue("@CContactNum2", customer.CContactNum2);

// Open the connection
connection.Open();

// Execute the command and get rows affected
int rowsAffected = command.ExecuteNonQuery();

return rowsAffected > 0;
}
}
}
public bool AddNewCustomer(CustomerClass customer)
{
// Generally you don't want connection strings in your code
string connectionString = "Data Source=ServerName;Initial Catalog=DatabaseName;User ID=Username;Password=Password;";

using (SqlConnection connection = new SqlConnection(connectionString))
{
string query = "INSERT INTO tblCustomer VALUES(@CTitle, @CForename, @CSurname, @CEmail, @CContactNum1, @CContactNum2)";

using (SqlCommand command = new SqlCommand(query, connection))
{
// Add parameters for the CustomerClass properties
command.Parameters.AddWithValue("@CTitle", customer.CTitle);
command.Parameters.AddWithValue("@CForename", customer.CForename);
command.Parameters.AddWithValue("@CSurname", customer.CSurname);
command.Parameters.AddWithValue("@CEmail", customer.CEmail);
command.Parameters.AddWithValue("@CContactNum1", customer.CContactNum1);
command.Parameters.AddWithValue("@CContactNum2", customer.CContactNum2);

// Open the connection
connection.Open();

// Execute the command and get rows affected
int rowsAffected = command.ExecuteNonQuery();

return rowsAffected > 0;
}
}
}
30 replies
CC#
Created by Auger on 2/12/2025 in #help
Azure Data API Builder - Partial Match
Yeah that's what I read about odata, but the data Api builder doesn't seem to strictly implement all the facets of odata
12 replies
CC#
Created by Auger on 2/12/2025 in #help
Azure Data API Builder - Partial Match
No description
12 replies
CC#
Created by Auger on 2/12/2025 in #help
Azure Data API Builder - Partial Match
From everything I've researched, Data API Builder might just not support it
12 replies
CC#
Created by Auger on 2/12/2025 in #help
Azure Data API Builder - Partial Match
No description
12 replies
CC#
Created by Auger on 2/12/2025 in #help
Azure Data API Builder - Partial Match
For example, I do a filter query param like the following, but this of course does not support a partial match
$"$filter={nameof(User.FirstName)} eq '{name}' or {nameof(User.LastName)} eq '{name}'"
$"$filter={nameof(User.FirstName)} eq '{name}' or {nameof(User.LastName)} eq '{name}'"
12 replies
CC#
Created by uffen on 6/20/2024 in #help
learning moq framework
Didn't they revert that though?
13 replies
CC#
Created by Ale on 6/15/2024 in #help
✅ Dependency injection
had no idea that ```diff was an option 😮
16 replies
CC#
Created by CG Seb on 4/29/2024 in #help
MAUI Popup at first start
Since OnAppearing is kind of an Event Handler of sorts, you can probably get away with making it an async void method. Generally, you wouldn't want to do that unless it is an event handler method. In this context you probably could to navigate.
protected override void void OnAppearing()
{
base.OnAppearing();

bool GCUAccepted = Preferences.Get(Constants.GCU_ACCEPTED_KEY, false);
if (!GCUAccepted)
{
GCUPopupPage page = new();
await popupNavigation.PushAsync(page);
}

// ....
}
protected override void void OnAppearing()
{
base.OnAppearing();

bool GCUAccepted = Preferences.Get(Constants.GCU_ACCEPTED_KEY, false);
if (!GCUAccepted)
{
GCUPopupPage page = new();
await popupNavigation.PushAsync(page);
}

// ....
}
2 replies
CC#
Created by glacinefrox on 5/21/2024 in #help
Brotli compression with all cores
This is a harder problem than it probably first appears... In order to have multithread compression, you'd have to break the file into chunks (Look into the Partitioner class for that), and then use a Parallel.ForEach to compress each chunk. And while that would work... you'd have to decompress each chunk and re-combine the exact same way. The order of chunk has to be persisted as metadata in order to decompress later.
5 replies
CC#
Created by stigzler on 5/19/2024 in #help
✅ How to use IRelayCommand in CommunityToolkit.Mvvm with parameters?
There is also a dialog window in VS that is "XAML Binding Failures" I think. That's a good one to keep your eye on while running the app
77 replies
CC#
Created by stigzler on 5/19/2024 in #help
✅ How to use IRelayCommand in CommunityToolkit.Mvvm with parameters?
Specifically the Mode=TwoWay part may help if you plan to set that value from code and from the UI toggle
77 replies
CC#
Created by علي زيدان on 5/18/2024 in #help
A problem while making a request for API in maui .net
I'd recommend leowest's suggestions. The cleartext one anyway, as that can cause requests to fail. My assumption of the issue here is that your android emulator is probably not serving HTTP content locally on port 5117 like your PC is. If you inspect the request object, I'd be interested to see why it failed. If you get a HTTP status code, then you know at least it is hitting the HTTP server
14 replies
CC#
Created by stigzler on 5/19/2024 in #help
✅ How to use IRelayCommand in CommunityToolkit.Mvvm with parameters?
Although, the CanExecute becoming false will no longer allow you to execute that command to turn it back to true, so instead you could try
[ObservableProperty]
private bool _isCodeOutliningVisible;

[RelayCommand]
private void TestRC()
{
// Implementation using IsCodeOutliningVisible

if (IsCodeOutliningVisible)
{
// ...
}
}
[ObservableProperty]
private bool _isCodeOutliningVisible;

[RelayCommand]
private void TestRC()
{
// Implementation using IsCodeOutliningVisible

if (IsCodeOutliningVisible)
{
// ...
}
}
<ToggleButton x:Name = "CodeOutliningVisibleBT"
Content="Dave"
ToolTip="Toggle Code Outlining"
IsChecked="{Binding IsCodeOutliningVisible, Mode=TwoWay}"
Command="{Binding TestRCCommand}">
</ToggleButton>
<ToggleButton x:Name = "CodeOutliningVisibleBT"
Content="Dave"
ToolTip="Toggle Code Outlining"
IsChecked="{Binding IsCodeOutliningVisible, Mode=TwoWay}"
Command="{Binding TestRCCommand}">
</ToggleButton>
77 replies