private void Init()
        {
            InitializeComponent();
            cbEdition.Items.Add(Properties.Resources.CreateDatabaseWebEdition);
            cbEdition.Items.Add(Properties.Resources.CreateDatabaseBusinessEdition);
            cbEdition.SelectedIndex = 0;

            List <Collation> colList = CollationHelper.GetCollationList();

            cbCollations.DataSource = colList;
            string dbCol = CommonFunc.GetAppSettingsStringValue("DBCollation");

            if (dbCol.Length == 0)
            {
                return;
            }

            int index = 0;

            foreach (Collation col in colList)
            {
                if (dbCol.Equals(col.Name, StringComparison.CurrentCultureIgnoreCase))
                {
                    cbCollations.SelectedIndex = index;
                    break;
                }
                ++index;
            }
        }
Ejemplo n.º 2
0
        private void Init()
        {
            List <Collation> colList = CollationHelper.GetCollationList();

            cbCollations.DataSource = colList;
            string dbCol = CommonFunc.GetAppSettingsStringValue("DBCollation");

            if (dbCol.Length > 0)
            {
                int index = 0;
                foreach (Collation col in colList)
                {
                    if (dbCol.Equals(col.Name, StringComparison.CurrentCultureIgnoreCase))
                    {
                        cbCollations.SelectedIndex = index;
                        break;
                    }
                    ++index;
                }
            }

            if (_TargetServerInfo.ServerType != ServerTypes.AzureSQLDB)
            {
                gbDatabaseSize.Enabled = false;
                return;
            }

            gbDatabaseSize.Enabled = true;
            _major = Convert.ToInt32(_TargetServerInfo.Version.Substring(0, 2));

            List <DatabaseEdition> editions = new List <DatabaseEdition>();

            // Web      = 100 MB, 1 GB, 5 GB
            // Business = 10, 20, 30, 40, 50, 100, 150
            // Basic    = 100 MB, 500 MB, 1, 2
            // Standard = 100 MB, 500 MB, 1, 2, 5, 10, 20, 30, 40, 50, 100, 150, 200, 250
            // Premium  = 100 MB, 500 MB, 1, 2, 5, 10, 20, 30, 40, 50, 100, 150, 200, 250, 300, 400, 500

            DatabaseEdition webEdition = new DatabaseEdition(new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseWebEdition, "web"));
            DatabaseEdition busEdition = new DatabaseEdition(new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseBusinessEdition, "business"));
            DatabaseEdition basEdition = new DatabaseEdition(new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseBasicEdition, "basic"));
            DatabaseEdition stdEdition = new DatabaseEdition(new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseStandardEdition, "standard"));
            DatabaseEdition preEdition = new DatabaseEdition(new KeyValuePair <string, string>(Properties.Resources.CreateDatabasePremiumEdition, "premium"));

            KeyValuePair <string, string> dbSize100mb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeOneHundredMB, "100 MB");
            KeyValuePair <string, string> dbSize500mb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeFiveHundredMB, "500 MB");
            KeyValuePair <string, string> dbSize1gb   = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeOneGB, "1 GB");
            KeyValuePair <string, string> dbSize2gb   = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeTwoGB, "2 GB");
            KeyValuePair <string, string> dbSize5gb   = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeFiveGB, "5 GB");
            KeyValuePair <string, string> dbSize10gb  = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeTenGB, "10 GB");
            KeyValuePair <string, string> dbSize20gb  = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeTwentyGB, "20 GB");
            KeyValuePair <string, string> dbSize30gb  = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeThirtyGB, "30 GB");
            KeyValuePair <string, string> dbSize40gb  = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeFourtyGB, "40 GB");
            KeyValuePair <string, string> dbSize50gb  = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeFiftyGB, "50 GB");
            KeyValuePair <string, string> dbSize100gb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeOneHundredGB, "100 GB");
            KeyValuePair <string, string> dbSize150gb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeOneHundredFiftyGB, "150 GB");
            KeyValuePair <string, string> dbSize200gb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeTwoHundredGB, "200 GB");
            KeyValuePair <string, string> dbSize250gb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeTwoHundredFiftyGB, "250 GB");
            KeyValuePair <string, string> dbSize300gb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeThreeHundredGB, "300 GB");
            KeyValuePair <string, string> dbSize400gb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeFourHundredGB, "400 GB");
            KeyValuePair <string, string> dbSize500gb = new KeyValuePair <string, string>(Properties.Resources.CreateDatabaseSizeFiveHundredGB, "500 GB");

            webEdition.Size.Add(dbSize100mb);
            webEdition.Size.Add(dbSize1gb);
            webEdition.Size.Add(dbSize5gb);

            busEdition.Size.Add(dbSize10gb);
            busEdition.Size.Add(dbSize20gb);
            busEdition.Size.Add(dbSize30gb);
            busEdition.Size.Add(dbSize40gb);
            busEdition.Size.Add(dbSize50gb);
            busEdition.Size.Add(dbSize100gb);
            busEdition.Size.Add(dbSize150gb);

            basEdition.Size.Add(dbSize100mb);
            basEdition.Size.Add(dbSize500mb);
            basEdition.Size.Add(dbSize1gb);
            basEdition.Size.Add(dbSize2gb);

            stdEdition.Size.Add(dbSize100mb);
            stdEdition.Size.Add(dbSize500mb);
            stdEdition.Size.Add(dbSize1gb);
            stdEdition.Size.Add(dbSize2gb);
            stdEdition.Size.Add(dbSize5gb);
            stdEdition.Size.Add(dbSize10gb);
            stdEdition.Size.Add(dbSize20gb);
            stdEdition.Size.Add(dbSize30gb);
            stdEdition.Size.Add(dbSize40gb);
            stdEdition.Size.Add(dbSize50gb);
            stdEdition.Size.Add(dbSize100gb);
            stdEdition.Size.Add(dbSize150gb);
            stdEdition.Size.Add(dbSize200gb);
            stdEdition.Size.Add(dbSize250gb);

            preEdition.Size.Add(dbSize100mb);
            preEdition.Size.Add(dbSize500mb);
            preEdition.Size.Add(dbSize1gb);
            preEdition.Size.Add(dbSize2gb);
            preEdition.Size.Add(dbSize5gb);
            preEdition.Size.Add(dbSize10gb);
            preEdition.Size.Add(dbSize20gb);
            preEdition.Size.Add(dbSize30gb);
            preEdition.Size.Add(dbSize40gb);
            preEdition.Size.Add(dbSize50gb);
            preEdition.Size.Add(dbSize100gb);
            preEdition.Size.Add(dbSize150gb);
            preEdition.Size.Add(dbSize200gb);
            preEdition.Size.Add(dbSize250gb);
            preEdition.Size.Add(dbSize300gb);
            preEdition.Size.Add(dbSize400gb);
            preEdition.Size.Add(dbSize500gb);

            webEdition.PerformanceLevel.Add(new KeyValuePair <string, string>("", ""));
            busEdition.PerformanceLevel.Add(new KeyValuePair <string, string>("", ""));

            basEdition.PerformanceLevel.Add(new KeyValuePair <string, string>(Properties.Resources.PerformanceLevelBasicFiveDTUs, ""));

            int eol_Year  = Convert.ToInt32(CommonFunc.GetAppSettingsStringValue("EndOfLife_Year"));
            int eol_Month = Convert.ToInt32(CommonFunc.GetAppSettingsStringValue("EndOfLife_Month"));
            int eol_Day   = Convert.ToInt32(CommonFunc.GetAppSettingsStringValue("EndOfLife_Day"));

            DateTime eol_dt   = new DateTime(eol_Year, eol_Month, eol_Day);
            bool     past_eol = DateTime.Compare(DateTime.Now, eol_dt) < 0 ? false : true;

            stdEdition.PerformanceLevel.Add(new KeyValuePair <string, string>(Properties.Resources.PerformanceLevelStandardS0, "S0"));
            stdEdition.PerformanceLevel.Add(new KeyValuePair <string, string>(Properties.Resources.PerformanceLevelStandardS1, "S1"));
            stdEdition.PerformanceLevel.Add(new KeyValuePair <string, string>(Properties.Resources.PerformanceLevelStandardS2, "S2"));

            preEdition.PerformanceLevel.Add(new KeyValuePair <string, string>(Properties.Resources.PerformanceLevelPremiumP1, "P1"));
            preEdition.PerformanceLevel.Add(new KeyValuePair <string, string>(Properties.Resources.PerformanceLevelPremiump2, "P2"));
            preEdition.PerformanceLevel.Add(new KeyValuePair <string, string>(Properties.Resources.PerformanceLevelPremiumP3, "P3"));

            if (_major > 11)
            {
                stdEdition.PerformanceLevel.Add(new KeyValuePair <string, string>(Properties.Resources.PerformanceLevelStandardS3, "S3"));
            }
            else
            {
                if (!past_eol)
                {
                    editions.Add(webEdition);
                }
                if (!past_eol)
                {
                    editions.Add(busEdition);
                }
            }

            editions.Add(basEdition);
            editions.Add(stdEdition);
            editions.Add(preEdition);

            cbEdition.DataSource    = editions;
            cbEdition.DisplayMember = "Display";
            cbEdition.SelectedItem  = stdEdition;
        }