Carrotware.CMS.DBUpdater.DatabaseUpdate.HandleResponse C# (CSharp) Method

HandleResponse() public method

public HandleResponse ( List lstMsgs, Exception ex ) : List
lstMsgs List
ex System.Exception
return List
        public List<DatabaseUpdateMessage> HandleResponse(List<DatabaseUpdateMessage> lstMsgs, Exception ex)
        {
            if (lstMsgs == null) {
                lstMsgs = new List<DatabaseUpdateMessage>();
            }

            DatabaseUpdateResponse execMessage = new DatabaseUpdateResponse();
            execMessage.LastException = ex;
            execMessage.Response = "An error occurred.";

            HandleResponse(lstMsgs, "Error: ", execMessage);

            return lstMsgs;
        }

Same methods

DatabaseUpdate::HandleResponse ( List lstMsgs, string sMsg ) : List
DatabaseUpdate::HandleResponse ( List lstMsgs, string sMsg, DatabaseUpdateResponse execMessage ) : List

Usage Example

        protected void Page_Load(object sender, EventArgs e)
        {
            DatabaseUpdate du = new DatabaseUpdate(true);

            if (!String.IsNullOrEmpty(Request.QueryString["signout"])) {
                FormsAuthentication.SignOut();
            }

            List<DatabaseUpdateMessage> lst = new List<DatabaseUpdateMessage>();

            btnLogin.Visible = false;
            btnCreate.Visible = false;

            if (DatabaseUpdate.LastSQLError != null) {
                du.HandleResponse(lst, DatabaseUpdate.LastSQLError);
                DatabaseUpdate.LastSQLError = null;
            } else {
                bool bUpdate = true;

                if (!du.DoCMSTablesExist()) {
                    bUpdate = false;
                }

                bUpdate = du.DatabaseNeedsUpdate();

                if (bUpdate) {
                    DatabaseUpdateStatus status = du.PerformUpdates();
                    lst = du.MergeMessages(lst, status.Messages);
                } else {
                    DataInfo ver = DatabaseUpdate.GetDbSchemaVersion();
                    du.HandleResponse(lst, "Database up-to-date [" + ver.DataValue + "] ");
                }

                bUpdate = du.DatabaseNeedsUpdate();

                if (!bUpdate && DatabaseUpdate.LastSQLError == null) {
                    if (DatabaseUpdate.UsersExist) {
                        btnLogin.Visible = true;
                    } else {
                        btnCreate.Visible = true;
                    }
                }
            }

            if (DatabaseUpdate.LastSQLError != null) {
                du.HandleResponse(lst, DatabaseUpdate.LastSQLError);
            }

            if (lst.Where(x => !String.IsNullOrEmpty(x.ExceptionText)).Count() > 0) {
                bOK = false;
            } else {
                bOK = true;
            }

            GeneralUtilities.BindRepeater(rpMessages, lst.OrderBy(x => x.Order));

            using (CMSConfigHelper cmsHelper = new CMSConfigHelper()) {
                cmsHelper.ResetConfigs();
            }
        }
All Usage Examples Of Carrotware.CMS.DBUpdater.DatabaseUpdate::HandleResponse