コード例 #1
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));
        }
コード例 #2
0
        protected void Ok_Click(object sender, EventArgs e)
        {
            string[]   slicenames      = new string[sliceCount];
            long[][]   slicelimits     = new long[sliceCount][];
            string[][] partitionnames  = new string[sliceCount][];
            long[][][] partitionlimits = new long[sliceCount][][];

            TextBox tb;

            for (int si = 0; si < sliceCount; si++)
            {
                tb             = (TextBox)FindControlRecursive(string.Format("slice_name_{0}", si));
                slicenames[si] = tb.Text;

                partitionnames[si]  = new string[partitionCount];
                partitionlimits[si] = new long[partitionCount][];
                for (int pi = 0; pi < partitionCount; pi++)
                {
                    tb = (TextBox)FindControlRecursive(string.Format("partition_name_{0}_{1}", si, pi));
                    partitionnames[si][pi] = tb.Text;

                    partitionlimits[si][pi] = new long[2];

                    tb = (TextBox)FindControlRecursive(string.Format("partition_limit_{0}_{1}", si, pi));
                    partitionlimits[si][pi][0] = long.Parse(tb.Text);
                }
            }

            long closing_limit = long.Parse(((TextBox)FindControlRecursive("closing_limit")).Text);

            for (int si = 0; si < sliceCount; si++)
            {
                slicelimits[si]    = new long[2];
                slicelimits[si][0] = partitionlimits[si][0][0];

                if (si < sliceCount - 1)
                {
                    slicelimits[si][1] = partitionlimits[si + 1][0][0];
                }
                else
                {
                    slicelimits[si][1] = closing_limit;
                }
            }

            for (int si = 0; si < sliceCount; si++)
            {
                for (int pi = 0; pi < partitionCount; pi++)
                {
                    if (pi < partitionCount - 1)
                    {
                        partitionlimits[si][pi][1] = partitionlimits[si][pi + 1][0];
                    }
                    else if (si < sliceCount - 1)
                    {
                        partitionlimits[si][pi][1] = slicelimits[si + 1][0];
                    }
                    else
                    {
                        partitionlimits[si][pi][1] = closing_limit;
                    }
                }
            }

            var ddi = new DatabaseDefinitionInstaller(item);

            ddi.GenerateSlices(slicenames, slicelimits, partitionnames, partitionlimits);

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