Maintenance of a demo web application for test purposes


Often it is useful to showcase a web application to potential customers allowing them to live test the application features. For this you need to publish and maintain a demo version with some relevant base data.

A service application, triggered to run at a given time, basicly will clean the database by restoring it from a mock-up backup and also will provide some control over the website.

A configuration file will be needed to provide following information:

  • action – specifies the action to be performed (possible values: “start” – bring up the web application, “stop” – bring down the web application, “restart” – stop followed by a restore of the mock-up database and actualization update, followed by a start);
  • app_location – the base directory of the web application that we want to manage;
  • database_connection – e.g. name of the SQL Server instance, name of the database;
  • backup_location – the location of the database backup file or script needed to restore the mock-up database;
  • basespan – reference date based on which will reset database information;

    Assume the web application in case it is a management application which involves: making up plans and budget plans in the phase of designing a project; pursue tasks on different levels, for different category of resources; administrate issues, bugs and customer tickets, etc. (iManagement ).  In this case it is important to provide testing data relative to the current date. Based on this reference parameter – reflecting the information as it is in the mock-up database – the program logic will bring everything up to date;

  • daysspan – in same case, dates of events must be shifted forward or backward relative to the current date (normally it is set to the value of 1).

In the entry point of the application will call the constructor of the maintenance class providing all parameters.

                   Configuration oCfg = new Configuration(sCfgFilePath);
                        "Arguments loaded successfully.",
                        new iManagementMaintenance(_log,
                    catch (Exception ex)
                            "Error " + Environment.NewLine + ex.ToString(),

The program will act accordingly to the specified action.

            switch (sAction.ToLower())
                case "start":
                case "stop":
                case "restart":
                        "Invalid action in configuration file!",

The main task takes place in the “restart” action. An update query will be provided in order to shift the data relative to current date.

     private const string sUpdateQuery = @"USE [{0}];
            DECLARE @BASESPAN Datetime;
            DECLARE @DAYSSPAN int;
            DECLARE @DAYSCALC int;
            SET @BASESPAN = '{1}';
            SET @DAYSSPAN = {2};
            --SELECT @DAYSCALC;
            UPDATE [bt_comments] SET [date] = DATEADD(DAY, @DAYSCALC, [date]);
            UPDATE [bt_issues] SET [reported_date] = DATEADD(DAY, @DAYSCALC, [reported_date]),
            [last_updated_date] = DATEADD(DAY, @DAYSCALC, [last_updated_date]);..."
        private void DoMaintenance()
            // bring it down
            if (!ToggleUpDown(false))
            oDB = new DBManager(BuildConnectionString());
                // get rid of any connections to the database in case, before running the restore
                DataView dv = oDB.GetDBQuery("sp_who", "activity_monitor");
                foreach (DataRow dr in dv.Table.Rows)
                    if (dr["dbname"].ToString().Contains(_sDBName))
                        sQuery_SPIDKill += "KILL " + dr["spid"] + "; ";
                // attempt restore
                sMsg = oDB.PostDBNonQuery("USE master; RESTORE DATABASE " + _sDBName
                    + " FROM DISK = '" + _sBackupPath + "' WITH REPLACE");
                if (sMsg.CompareTo("-1") == 0)
                    Tools.Message(_log, "Database successfully restored.", false);
                // adjust daysspan to skip over weekend days
                if (DateTime.Today.AddDays(_nDaysSpan).DayOfWeek == DayOfWeek.Saturday
                    || DateTime.Today.AddDays(_nDaysSpan).DayOfWeek == DayOfWeek.Sunday)
                    _nDaysSpan += (DateTime.Today.AddDays(_nDaysSpan).DayOfWeek
                         == DayOfWeek.Saturday) ? 3 : 2;
                sMsg = oDB.PostDBNonQuery(string.Format(sUpdateQuery,
                    dtBaseSpan.Year + dtBaseSpan.Month.ToString("00") + dtBaseSpan.Day.ToString("00"),
                if (!sMsg.ToUpper().Contains("ERROR"))
                    Tools.Message(_log, "Database successfully updated.", false);
                // bring it back up
                if (!ToggleUpDown(true))
            catch(Exception ex)
                    "Database error!" + Environment.NewLine + Environment.NewLine + ex.ToString(),

Finally, there’s another very important peculiarity of what does Cialis that brings it so high above its alternatives. It is the only med that is available in two versions – one intended for use on as-needed basis and one intended for daily use. As you might know, Viagra and Levitra only come in the latter of these two forms and should be consumed shortly before expected sexual activity to ensure best effect. Daily Cialis, in its turn, contains low doses of Tadalafil, which allows to build its concentration up in your system gradually over time and maintain it on acceptable levels, which, consequently, makes it possible for you to enjoy sex at any moment without having to time it.

By continuing to use the site, you agree to the use of cookies. More information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.