Esempio n. 1
0
        public override bool DoConversion(bool forOnlineDB)
        {
            bool             RetVal     = false;
            int              TotalSteps = 10;
            DBVersionBuilder VersionBuilder;

            // Do the conversion only if database has different Schema
            try
            {
                if (DICommon.IsDI7Database(this.DBConnection.ConnectionStringParameters.DbName))
                {
                    this._DBQueries = new DIQueries(this._DBQueries.DataPrefix, this._DBQueries.LanguageCode);

                    if (this._ConvertDatabase)
                    {
                        this.RaiseProcessStartedEvent(TotalSteps);

                        this.RaiseProcessInfoEvent(1);

                        this.SetAllLanguageCodes();

                        this.RaiseProcessInfoEvent(2);
                        if (this.UpdateDBSchema(forOnlineDB))
                        {
                            this.RaiseProcessInfoEvent(9);

                            // Insert version info into database after conversion
                            VersionBuilder = new DBVersionBuilder(this._DBConnection, this._DBQueries);

                            //Delete newer version from table keep 6.0.0.5 record and delete which greater than 6.0.0.5 as like 7 version
                            VersionBuilder.DeleteVersionsFromVersionNumberToEnd(Constants.Versions.DI6_0_0_5);

                            this.RaiseProcessInfoEvent(10);

                            RetVal = true;
                        }
                    }
                }
                else
                {
                    RetVal = true;
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.ToString());
            }

            return(RetVal);
        }