예제 #1
0
 protected void BtnSubmitClick(object sender, EventArgs e)
 {
     var file = lbFiles.SelectedValue;
     if (!String.IsNullOrEmpty(file))
     {
         _dbsUpgrade = new DbsFileProcessor(file);
         if (_dbsUpgrade.Applied)
         {
             ((PageBase) Page).ShowMessage("Script has already been applied");
             return;
         }
         lblResult.Text = _dbsUpgrade.Process();
     }
 }
예제 #2
0
        private void UpdateDatabase(string updatetype)
        {
            DbsFileProcessor dbsUpgrade = new DbsFileProcessor(HttpContext.Current.Server.MapPath("update.xml"));
            switch (updatetype)
            {
                case "new":
                    UpdateProgress(0,"Creating database<br/>");
                    Thread.Sleep(500);
                    Snitz.BLL.Admin.ExecuteScript(CREATE_DATABASE);
                    foreach (string basetable in _basecreateStrings)
                    {
                        string res = Snitz.BLL.Admin.ExecuteScript(basetable);
                        if (String.IsNullOrEmpty(res))
                        {
                            UpdateProgress(0,string.Format("<br/> {0}", basetable));
                        }
                        else
                        {
                            UpdateProgress(0,string.Format("<br/><span style='color:red'>{0}:{1}</span>",
                                                                 basetable, res));
                        }

                    }
                    StoredProcedures();
                    //Add some default data
                    UpdateProgress(0,"Adding default data<br/>");
                    AddRoles();
                    AddDefaultData();
                    break;
                case "empty":
                    StoredProcedures();
                    UpdateProgress(0,"Creating base forum tables<br/>");
                    Thread.Sleep(500);
                    //create base forum tables
                    foreach (string basetable in _basecreateStrings)
                    {
                        string res = Snitz.BLL.Admin.ExecuteScript(basetable);
                        if (String.IsNullOrEmpty(res))
                        {
                            UpdateProgress(0,string.Format("<br/> {0}", basetable));
                        }
                        else
                        {
                            UpdateProgress(0,string.Format("<br/><span style='color:red'>{0}:{1}</span>",
                                                                 basetable, res));
                        }
                        Thread.Sleep(200);
                    }
                    //upgrade to latest version
                    dbsUpgrade.Process();
                    //Add some default data
                    AddRoles();
                    AddDefaultData();
                    break;
                case "upgrade":
                    var restext = dbsUpgrade.Process();
                    if(restext != "success")
                        UpdateProgress(5, restext + "<br/>");
                    StoredProcedures();
                    AddRankings();
                    AddRoles();
                    UpdateUserRoles();
                    UpdateForumAllowedRoles();
                    UpdateMembersTable();
                    UpdateMembersRole();
                    TransferAvatars();

                    break;
                case "upgradeadmin":

                    dbsUpgrade.Process();
                    AddRoles();
                    AddDefaultData();
                    UpdateForumAllowedRoles();
                    break;
            }

            Config.UpdateConfig("RunSetup", "false");
        }
예제 #3
0
 protected override bool SetupMod(ModController controller)
 {
     DbsFileProcessor dbsUpgrade = new DbsFileProcessor(HttpContext.Current.Server.MapPath("thanksSetup.xml"));
     if (!dbsUpgrade.Applied)
     {
         var restext = dbsUpgrade.Process();
         if (restext == "success")
             return true;
     }
     return false;
 }