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)); }
protected void RefreshServerInstanceList() { #if false ServerInstance.Items.Clear(); ServerInstance.Items.Add(new ListItem("(select server instance)", Guid.Empty.ToString())); if (DatabaseVersion.SelectedValue != Guid.Empty.ToString()) { DatabaseVersion dv = new DatabaseVersion(RegistryContext); dv.Guid = new Guid(DatabaseVersion.SelectedValue); dv.Load(); EntityFactory ef = new EntityFactory(RegistryContext); foreach (ServerInstance si in ef.FindAll <ServerInstance>().Where(i => i.ServerVersionReference.Guid == dv.ServerVersionReference.Guid)) { ServerInstance.Items.Add(new ListItem(si.Machine.Name + "\\" + si.Name, si.Guid.ToString())); } } #endif ServerInstance.Items.Add(new ListItem("(select server instance)", Guid.Empty.ToString())); var cluster = RegistryContext.Cluster; cluster.LoadMachineRoles(false); foreach (var mr in cluster.MachineRoles.Values) { mr.LoadMachines(false); foreach (var m in mr.Machines.Values) { m.LoadServerInstances(false); foreach (var si in m.ServerInstances.Values) { ServerInstance.Items.Add(new ListItem(m.Name + "\\" + si.Name, si.Guid.ToString())); } } } }
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(); }