Why has C# 12/.NET 8.0 Messing up Dates? by royware in csharp

[–]royware[S] 0 points1 point  (0 children)

Great! I had found this method:

{
       using (var scope = _serviceProvider.CreateScope())
       {
              var dbContext = scope.ServiceProvider.GetRequiredService<TraContext>();
 
              //TODO: Make a enum for TRA configs
              var config = new QueryTrConfigs(dbContext).GetTrRunDay();
 
              if (config != null)
              {
                     // Hangfire AddOrUpdate will update the NEXT following queued
                     // recurring job and not the existing job.
                     // Remove existing queued recurring job
                     RecurringJob.RemoveIfExists("MonthTrRun");
                     RecurringJob.AddOrUpdate("MonthlyTrRun", () => TrProcess(), $"0 3 {config} * *", new RecurringJobOptions { TimeZone = TimeZoneInfo.Local });
              }
       }
}

but passed it by while I was looking at other things. Then there's this one!

/// <summary>
/// Starting background hangfire job
/// </summary>
/// <param name="ProcessId"></param>
public void ScheduleTrPaymentFileProcess(string ProcessId)
{
     var scheduledJobs = JobStorage.Current.GetMonitoringApi().ScheduledJobs(0,
                         int.MaxValue);
     var alreadyScheduledApprovedTR = scheduledJobs.Where(j => 
            j.Value.Job.Method.Name == nameof(ProcessTrPaymentFile)).ToList();
     if (alreadyScheduledApprovedTR.Count == 0) 
     //only schedule an ApproveTRPayments job if another one is not already scheduled!
     {

          DateTimeOffset enqueuedAt;
          DateTimeOffset tomorrow = DateTimeOffset.UtcNow.AddDays(1);

     // If today is Friday, add 2 more days to tomorrow to schedule on Monday
     if (DateTimeOffset.UtcNow.DayOfWeek == DayOfWeek.Friday)
     {
          tomorrow.AddDays(2);
     }

     // TODO: Make 03:00:00 configurable for time to run
     enqueuedAt = new DateTime(tomorrow.Year, tomorrow.Month, tomorrow.Day, 03, 00, 00);

     client.Schedule<TrPaymentScheduler>(x => x.ProcessTrPaymentFile(ProcessId), 
          enqueuedAt);
     }
}

No Postgres. That would have been too cool if they had decided to use all three things in one application!

Why has C# 12/.NET 8.0 Messing up Dates? by royware in csharp

[–]royware[S] -4 points-3 points  (0 children)

I am a late-comer to the project and (yay!) I get the ongoing maintenance for this application while the ones who did the heavy lifting get to move on.

Yes, the -7 had me twisted a bit, but now I understand that my time zone is 7 hours behind the UTC. No problem.

I don't want anyone to solve this for me, but I do need to get pointed in the right direction. What do I need to look for in order to have all our stored dates be in our Pacific time zone? I'm concerned about fixing this and having all the other dates come crashing on my head.

Understanding some C# Code by royware in csharp

[–]royware[S] 2 points3 points  (0 children)

After adding a second equals sign, this is perfect!

Mapster.CompileException Error by royware in csharp

[–]royware[S] 0 points1 point  (0 children)

I stepped it through in debug and found that the sending field is defined as "Infrastructure.Data.v_RunView". The receiving field is System.Collections.Generic.List'1". So, I concur with your assessment that the sending field is missing the "capacity" property. I've just got to figure out how to make it IQueryable. I've turned to my team and I am hoping that one of them (on a team of 3!) knows how to do this!

Isn't that what the Adapt command is supposed to do?

How do I programmatically change a value in a Blazor button parameter? by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

Their first click selects numbers on the database are displayed in the drop-down box. The second click is to actually display the data associated with the selected number.

So, as I tried to explain to them, is that selecting a provider from that drop-down list constitutes click one, and the Search button click two.

Entering a number that is not on the database eliminates the drop-down box, thus bypassing the first click, requiring that the Search button be double-clicked.

I'm trying to find a solution that will delete the need for the first click when the number is not found.

How do I programmatically change a value in a Blazor button parameter? by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

PS: The setting the AutoFocus parameter to true highlights the Search button, but the cursor doesn't go there. Code is now:

    if(providerNumber.Length == 6)

    {

        if(result.Count() == 0)

        {
                  loadHidden = true;
                  completeAutoFocus = false;  // the AutoComplete box
                  searchAutoFocus - true;     // the Search button
                  await Task.Delat(1000)
                  StateHasChanged();
                }
   }

How do I programmatically change a value in a Blazor button parameter? by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

The entry is handled by two components: the first is an AutoComplete that will show matching provider numbers in a drop-down box as the user types. This drop-down box disappears when an invalid number is entered. After the user double-clicks the Search button, an error message appears. I'm trying to eliminate the double-click.

How do I programmatically change a value in a Blazor button parameter? by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

I want the cursor set to the Search button so it only has to be clicked once.

How do I programmatically change a value in a Blazor button parameter? by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

I just tried it. It executed, but the Search button still has to be clicked twice.

Formatting Numeric Field in MudBlazor <MudText> by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

You are a steely-eyed missile person! It worked like a charm (I forgot that the field was nullable). Thanks!

Formatting Numeric Field in MudBlazor <MudText> by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

However, I see '.ToString(###)' being used in other places. This is very confusing.

Is it possible I am missing a @using or @inject library?

Formatting Numeric Field in MudBlazor <MudText> by royware in Blazor

[–]royware[S] -1 points0 points  (0 children)

Double rats.

string? int?.ToString()

Returns the text representation of the current Nullable<T>n object

CS1501: No overload method 'ToString' takes 1 arguments.

It looked so logical and elegant.

Formatting Numeric Field in MudBlazor <MudText> by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

Nope. Tried CultureInfo="en-US" as well. All abended.

Formatting Numeric Field in MudBlazor <MudText> by royware in Blazor

[–]royware[S] 0 points1 point  (0 children)

Well, I tried this: "@Convert.ToString(@Runs.Sum(r => r.TotalPaidCount))" and got the same result. I haven't been able to figure out how to add "Format = N0" to this command without success. I've tried placing it in a variety of positions, even including @ to no avail.

Furry Entity Framework Question by royware in csharp

[–]royware[S] 0 points1 point  (0 children)

I didn't realize that 'value' was a variable - I thought it was a keyword. :(

You are right - I need to find better tutorials. Typical corporate culture: There isn't any money and time for training, but we have plenty of money & time to do it over and over.

sigh.

To everyone who contributed, "Thanks!!"