I have a batch process that runs on a background thread on an ASP.NET site. When that batch process runs I did not want the users to access specific features of the site. If you want to read more about running batch jobs from a website using ASP.NET and IIS read this post.
In order to do that I added a Boolean flag to the server cache for 10 minutes. When the users access a specific feature of the site it will check if the flag in the cache is set. If so the end user will be taken to a page that shows a “Batch Running” message (shown below using jQuery).
The “Batch Running” page will post back to the server every minute checking if the cache item exists. Once the cache item is gone the batch process page will redirect the user back to the feature that was offline.
if (CTX.Cache["BatchRunning"] == null) Response.Redirect("~/default.aspx")
The Javascript below clicks a button every minute to post back the page
var Timer = setInterval(function () { ClickButton() }, 60000);
function ClickButton() {
document.getElementById("BtnPost").click();
}
The ZIP file below contains a HTML page and an ASPX page with the code discussed in this post.
BatchProcessingMessage.zip (3.3KB)
Very cool sample code and app on MSDN or download the source below.
Run the project, and select the type of LINQ sample that you want to examine. Examine the options, and run each query that interests you. The output from the query and the source code is displayed on the interface of the application.
LINQ-Sample-Queries.zip (2.5MB)
procedure prc_insert_data(IN_ID in number, ON_PK_VALUE_ID out number) is
begin
insert into MyTable (SEQ_ID)
values (SEQ_ID_PK.nextval) RETURNING PARTNUMBER_ID INTO ON_PK_VALUE_ID;
commit;
end prc_insert_building;