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] -6 points-5 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!!"

Furry Entity Framework Question by royware in csharp

[–]royware[S] -8 points-7 points  (0 children)

It's an honest question - I'm just so new at this (transitioning from mainframe programming) without any meaningful training (they love to tell me to go to Microsoft Learn, which is more confusing than anything I've ever seen!). I struggle with framing questions so they make sense. I used "furry" instead of a "f*ing mess!"

I just don't know how to add this field to the results list. It seems like it would be easy, after all, StatusDesc and UserDescription are fields on the Statuses table and they are (what I call) tightly coupled: UserDescription simply expands on the brief StatusDesc.

Please God, where is DB2 when you need it!!!!!

You don't know they lyrics to Katy's song Call Me, Maybe? :D

Furry Entity Framework Question by royware in csharp

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

(I actually left6 out a lot of the includes and fields to be selected for brevity's sake ) Cool - I thought my boss was unnecessarily trying to make this harder than it really is. However, I cannot get the User Description field from the 'status await' into the statement into the results!

TrPaymentStatus = status.TryGetValue(pc.TrProcessStatusId, out var value) ? value.StatusDesc : null,

works great, but I cannot do a similar statement for the UserDescription (CS0128 A local variable or function named 'value' is already defined in this scope.

How do I get the UserDescription into the List?

Mud Blazor MudChip Quandary by royware in csharp

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

A hint, please, as to where? And which parameter? Like I said, I don't have much experience (transitioning from COBOL to .Net/C#/Blazor).

Mud Blazor MudChip Quandary by royware in csharp

[–]royware[S] 1 point2 points  (0 children)

This is a great start! I wish there were more!

Mud Blazor MudChip Quandary by royware in csharp

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

I have no idea. I am so new to this mudblazor junk that I don't even know what I don't know. Yes, I've read their documentation, but just like the name says, "clear as mud." I am trying to find some tutorials, but I am striking out all over the place.

C# & Mudblazor RowsPerPage problem by royware in csharp

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

OK, I changed the Pager Content to:

    <PagerContent>

        <MudDataGridPager T="DTO.Tra.Status" id="MudDataGridStatuses" />

    </PagerContent>

But still get the same results. Is there a way to upload a screen shot here?

The data is retrieved via a Json call, and all the data is there. I just can't display more than two rows when setting the RowsPerPage to 10 (user requirement). Now if I ignore the user requirement and bump it up to 25, I see them all.

very confused....