Do submit page, wait and only redirect page if Status = 'F'

Jerry Lipan 916 Reputation points
2022-03-27T05:22:21.487+00:00

Hi,

I'm thinking to design page (Web Apps) with submit button do as following,

  1. User press submit button
  2. Wait for server processing
  3. if Status in table = 'F', then redirect the page

This is my table design in SQL Server

CREATE TABLE [dbo].[serverProcess_Job001](  
	[Id] [int] IDENTITY(1,1) NOT NULL,  
	[Batch_Id] [uniqueidentifier] NULL,  
	[job_Name] [varchar](200) NULL,  
	[job_Status] [char](1) NULL,  
	[paramData] [varchar](500) NULL,  
	[paramDataNotes] [varchar](200) NULL,  
	[reportFileName] [varchar](200) NULL,  
	[CrtBy] [nvarchar](450) NULL,  
	[CrtDte] [datetime] NULL,  
	[UpdDte] [datetime] NULL,  
	[dtVersion] [timestamp] NULL,  
 CONSTRAINT [PK_serverProcess_Job001] PRIMARY KEY CLUSTERED   
(  
	[Id] ASC  
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY],  
 CONSTRAINT [serverProcess_Job001_UQ001] UNIQUE NONCLUSTERED   
(  
	[Batch_Id] ASC  
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]  
) ON [PRIMARY]  
GO  
  
ALTER TABLE [dbo].[serverProcess_Job001] ADD  CONSTRAINT [DF_serverProcess_Job001_job_Name]  DEFAULT ('N/A') FOR [job_Name]  
GO  
  
ALTER TABLE [dbo].[serverProcess_Job001] ADD  CONSTRAINT [DF_serverProcess_Job001_job_Status]  DEFAULT ('S') FOR [job_Status]  
GO  
  
ALTER TABLE [dbo].[serverProcess_Job001] ADD  CONSTRAINT [DF_serverProcess_Job001_paramData]  DEFAULT ('N/A') FOR [paramData]  
GO  
  
ALTER TABLE [dbo].[serverProcess_Job001] ADD  CONSTRAINT [DF_serverProcess_Job001_CrtBy]  DEFAULT (N'N/A') FOR [CrtBy]  
GO  
  
ALTER TABLE [dbo].[serverProcess_Job001] ADD  CONSTRAINT [DF_serverProcess_Job001_CrtDte]  DEFAULT (getdate()) FOR [CrtDte]  
GO  
  
ALTER TABLE [dbo].[serverProcess_Job001]  WITH CHECK ADD  CONSTRAINT [CK_serverProcess_Job001_01] CHECK  (([job_Status]='S' OR [job_Status]='F'))  
GO  
  
ALTER TABLE [dbo].[serverProcess_Job001] CHECK CONSTRAINT [CK_serverProcess_Job001_01]  
GO  
  
  

My sample data as following,

Do submit, and page wait. It because, Status = 'S'
187160-27032022-01.png

Once Status = 'S' change into Status = 'F', then page redirect
187241-27032022-02.png

There is another process in server (Windows Form), will change Status='S' into Status='F'

Is that possible ? If possible, I need help

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,308 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Jerry Lipan 916 Reputation points
    2022-03-28T01:20:40.187+00:00

    Hi @AgaveJoe ,

    I would like to study - SignalR

    Will come back for you

    0 comments No comments

  2. Jerry Lipan 916 Reputation points
    2022-04-04T04:32:20.697+00:00

    Hi @Zhi Lv - MSFT ,

    I'm in the build of SignalR. Will share

    0 comments No comments

  3. SurferOnWww 2,176 Reputation points
    2022-04-04T07:07:53.91+00:00

    SqlDependency will provide query notofictaion which allow applications to be notified when data has changed.

    Query Notifications in SQL Server
    https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/query-notifications-in-sql-server

    ASP.NET SignalR enables server-side code to push content to clients instantly.

    Overview of ASP.NET Core SignalR
    https://learn.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-6.0

    Combination of SqlDependency and SignalR will probably gives you the funcionalities you want.

    Sorry sample below is written in Japanese but hope codes are readable:

    ASP.NET Core SqlDependency
    http://surferonwww.info/BlogEngine/post/2022/01/01/use-of-sqldependency-in-aspnet-core-application.aspx

    0 comments No comments