Example #1
0
        public bool SqlBaseClear(SqlBaseItemXml basemodel)
        {
            bool revalue    = false;
            var  serverlist = DBConfig.GetServerItemXmlConfigList(basemodel);

            if (serverlist != null)
            {
                foreach (var serveritem in serverlist)
                {
                    string connstr      = DBProxyAction.GetConnStr(basemodel, serveritem);
                    var    databaselist = DBConfig.GetDatabaseItemXmlConfigList(basemodel, serveritem.Number);
                    if (databaselist != null)
                    {
                        foreach (var databaseitem in databaselist)
                        {
                            DBProxy.GetDBAccess(serveritem.DBType).DatabaseDrop(connstr, databaseitem.DatabaseName);
                        }
                    }
                }
                ManagerConfig servermanagerconfig = new ManagerConfig();
                //servermanagerconfig.InitServerXml(basemodel);
                servermanagerconfig.InitDatabaseXml(basemodel);
                servermanagerconfig.InitTableXml(basemodel);
                servermanagerconfig.InitFieldXml(basemodel);
            }
            return(revalue);
        }
Example #2
0
        public bool GetDatabase(SqlBaseItemXml basemodel, SqlServerItemXml item)
        {
            var databaselist  = DBConfig.GetDatabaseItemXmlConfigList(basemodel, item.Number);
            var databaselist2 = databaselist.Where(m => m.IsUse == true && m.IsWrite == true).ToList();

            foreach (var item2 in databaselist2)
            {
                currentdatabase        = item2.DatabaseName;
                currentdatabasenumber  = item2.Number;
                currentconnstrdatabase = DBProxyAction.GetConnStr(basemodel, item, item2);
                var temp2      = DBProxy.GetDBAccess(item.DBType).DatabaseStorageSize(currentconnstrdatabase, item2.DatabaseName);
                var temp2count = DBConfig.GetTableXmlConfig(basemodel).SqlTableList.Where(m => m.DataBaseNumber == item2.Number).Count();
                if (item2.StorageSize > temp2 && item2.TableNum >= temp2count && GetTable(basemodel, item, item2))
                {
                    return(isposition);
                }
                else
                {
                    new ManagerConfig().DatabaseChangeIsWrite(item2);
                }
            }
            if (item.DatabaseNum > databaselist.Count() && item.IsCreate)
            {
                var tempdata = DBWrite.AddDatabase(currentconnstrserver, item);
                currentdatabase        = tempdata.DatabaseName;
                currentdatabasenumber  = tempdata.Number;
                currentconnstrdatabase = DBProxyAction.GetConnStr(basemodel, item, tempdata);
                var temptable = DBWrite.AddTable(currentconnstrdatabase, item, tempdata);
                currenttable       = temptable.TableName;
                currenttablenumber = temptable.Number;
                isposition         = true;
                return(isposition);
            }
            else
            {
                new ManagerConfig().ServerChangeIsWrite(item);
            }

            return(isposition);
        }