// Get User Id of the current User
        private static int GetUserId()
        {
            int userId = 0;

            try
            {
                userId = Int32.Parse(BatchService.GetUserId().ToString());
            }
            catch
            {
                Security.RedirectToHomePage();
            }

            return(userId);
        }
        // Redirect to the home page or initialise page before it is presented to the User
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                // Redirect User if they do not have permission to view this page
                Security.RedirectIfNoQueryString();

                int?userId = BatchService.GetUserId();
                Security.RedirectIfUserIdMismatch(userId);
                Security.RedirectIfIsGuest();
                Security.RedirectIfBatchIsNotActive();

                // Display Success/Error message on page if appropriate
                DisplayMessage();
            }
        }