コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            item = new DatabaseDefinition(RegistryContext);
            item.Guid = new Guid(Request.QueryString["guid"]);
            item.Load();

            item.LoadDatabaseVersions(false);
            databaseVersions = new List<DatabaseVersion>(item.DatabaseVersions.Values);
            if (!IsPostBack)
            {
                RefreshDatabaseVersionList();
            }

            // Load currently selected database version
            databaseVersion = new DatabaseVersion(RegistryContext);
            databaseVersion.Guid = new Guid(databaseVersionList.SelectedValue);
            databaseVersion.Load();

            // Load server instances
            EntityFactory ef = new EntityFactory(RegistryContext);
            serverInstances = new List<ServerInstance>(ef.FindAll<ServerInstance>()
                .Where(i => i.ServerVersionReference.Guid == databaseVersion.ServerVersionReference.Guid)
                .OrderBy(i => i.Machine.Number));

            // Load slices
            item.LoadSlices(false);
            slices = new List<Slice>(item.Slices.Values);

            if (!IsPostBack)
            {
                UpdateForm();
            }

            GenerateTable();
        }
コード例 #2
0
        protected void Ok_Click(object sender, EventArgs e)
        {
            double sizefactor = double.Parse(SizeFactor.Text);
            string postfix = String.Empty;

            DatabaseVersion rs = new DatabaseVersion(RegistryContext);
            rs.Guid = new Guid(databaseVersionList.SelectedValue);
            rs.Load();

            int q = 0;
            for (int sli = 0; sli < slices.Count; sli++)
            {
                for (int ssi = 0; ssi < serverInstances.Count; ssi++)
                {
                    CheckBox cb = (CheckBox)FindControlRecursive(string.Format("cb_{0}_{1}", sli, ssi));
                    if (cb.Checked)
                    {
                        switch (item.LayoutType)
                        {
                            case DatabaseLayoutType.Sliced:
                                break;
                            default:
                                postfix = String.Format("{0}", q.ToString("00"));
                                break;
                        }

                        var dii = new DatabaseInstanceInstaller(item);

                        dii.GenerateDatabaseInstance(serverInstances[ssi], slices[sli], rs, NamePattern.Text.Replace("[$Number]", postfix), DatabaseNamePattern.Text.Replace("[$Number]", postfix), sizefactor, GenerateFileGroups.Checked);

                        q++;
                    }
                }
            }

            Response.Redirect(item.GetDetailsUrl(EntityGroup.Layout));
        }