Ejemplo n.º 1
0
        protected void btnPart_Click(object sender, EventArgs e)
        {
            var selectedHd = (string)(ViewState["selectedHD"]);
            var control    = sender as Control;

            if (control == null)
            {
                return;
            }
            var gvRow             = (GridViewRow)control.Parent.Parent;
            var gv                = (GridView)gvRow.FindControl("gvFiles");
            var selectedPartition = gvRow.Cells[2].Text;

            var btn = (LinkButton)gvRow.FindControl("partClick");

            if (gv.Visible == false)
            {
                gv.Visible = true;
                var td = gvRow.FindControl("tdFile");
                td.Visible    = true;
                gv.DataSource = ImageSchema.GetPartitionImageFileInfoForGridView(Image, selectedHd,
                                                                                 selectedPartition);
                gv.DataBind();
                btn.Text = "-";
            }
            else
            {
                gv.Visible = false;
                var td = gvRow.FindControl("tdFile");
                td.Visible = false;
                btn.Text   = "+";
            }
        }
Ejemplo n.º 2
0
        private void SetCustomSchemaUpload()
        {
            var customSchema     = new BLL.ImageSchema(_imageProfile, "upload").GetImageSchema();
            var customHardDrives = new StringBuilder();

            customHardDrives.Append("custom_hard_drives=\"");
            var customPartitions = new StringBuilder();

            customPartitions.Append("custom_partitions=\"");
            var customFixedPartitions = new StringBuilder();

            customFixedPartitions.Append("custom_fixed_partitions=\"");
            var customLogicalVolumes = new StringBuilder();

            customLogicalVolumes.Append("custom_logical_volumes=\"");
            var customFixedLogicalVolumes = new StringBuilder();

            customFixedLogicalVolumes.Append("custom_fixed_logical_volumes=\"");
            foreach (var hd in customSchema.HardDrives.Where(x => x.Active))
            {
                customHardDrives.Append(hd.Name + " ");
                foreach (var partition in hd.Partitions.Where(x => x.Active))
                {
                    customPartitions.Append(hd.Name + partition.Prefix + partition.Number + " ");
                    if (partition.ForceFixedSize)
                    {
                        customFixedPartitions.Append(hd.Name + partition.Prefix + partition.Number + " ");
                    }

                    if (partition.VolumeGroup.LogicalVolumes != null)
                    {
                        foreach (
                            var logicalVolume in partition.VolumeGroup.LogicalVolumes.Where(x => x.Active))
                        {
                            var vgName = partition.VolumeGroup.Name.Replace("-", "--");
                            var lvName = logicalVolume.Name.Replace("-", "--");
                            customLogicalVolumes.Append(vgName + "-" + lvName + " ");
                            if (logicalVolume.ForceFixedSize)
                            {
                                customFixedLogicalVolumes.Append(vgName + "-" + lvName + " ");
                            }
                        }
                    }
                }
            }
            customHardDrives.Append("\"");
            customPartitions.Append("\"");
            customFixedPartitions.Append("\"");
            customLogicalVolumes.Append("\"");
            customFixedLogicalVolumes.Append("\"");
            AppendString(customHardDrives.ToString());
            AppendString(customPartitions.ToString());
            AppendString(customFixedPartitions.ToString());
            AppendString(customLogicalVolumes.ToString());
            AppendString(customFixedLogicalVolumes.ToString());
        }
Ejemplo n.º 3
0
        protected void btnHd_Click(object sender, EventArgs e)
        {
            var control = sender as Control;
            if (control == null) return;
            var gvRow = (GridViewRow) control.Parent.Parent;
            var gv = (GridView) gvRow.FindControl("gvParts");

            var selectedHd = gvRow.Cells[1].Text;
            ViewState["selectedHD"] = gvRow.RowIndex.ToString();
            ViewState["selectedHDName"] = selectedHd;


            var partitions = new ImageSchema(null,null,Image).GetPartitionsForGridView(selectedHd);
            var btn = (LinkButton) gvRow.FindControl("btnHd");
            if (gv.Visible == false)
            {
                gv.Visible = true;

                var td = gvRow.FindControl("tdParts");
                td.Visible = true;
                gv.DataSource = partitions;
                gv.DataBind();

                btn.Text = "-";
            }
            else
            {
                gv.Visible = false;

                var td = gvRow.FindControl("tdParts");
                td.Visible = false;
                btn.Text = "+";
            }

            foreach (GridViewRow row in gv.Rows)
            {
               

                if (partitions[row.RowIndex].VolumeGroup == null) continue;
                if (partitions[row.RowIndex].VolumeGroup.Name == null) continue;
                var gvVg = (GridView) row.FindControl("gvVG");
                gvVg.DataSource = new List<Models.ImageSchema.GridView.VolumeGroup>
                {
                    partitions[row.RowIndex].VolumeGroup
                };
                gvVg.DataBind();

                gvVg.Visible = true;
                var td = row.FindControl("tdVG");
                td.Visible = true;

              
            }
        }
Ejemplo n.º 4
0
        private void SetCustomSchemaDeploy()
        {
            var customSchema     = new BLL.ImageSchema(_imageProfile, "deploy").GetImageSchema();
            var customHardDrives = new StringBuilder();

            customHardDrives.Append("custom_hard_drives=\"");

            foreach (var hd in customSchema.HardDrives.Where(x => x.Active && !string.IsNullOrEmpty(x.Destination)))
            {
                customHardDrives.Append(hd.Destination + " ");
            }

            customHardDrives.Append("\"");
            AppendString(customHardDrives.ToString());
        }
Ejemplo n.º 5
0
        private void SetCustomSchemaUpload()
        {
            var customSchema = new BLL.ImageSchema(_imageProfile, "upload").GetImageSchema();
            var customHardDrives = new StringBuilder();
            customHardDrives.Append("custom_hard_drives=\"");
            var customPartitions = new StringBuilder();
            customPartitions.Append("custom_partitions=\"");
            var customFixedPartitions = new StringBuilder();
            customFixedPartitions.Append("custom_fixed_partitions=\"");
            var customLogicalVolumes = new StringBuilder();
            customLogicalVolumes.Append("custom_logical_volumes=\"");
            var customFixedLogicalVolumes = new StringBuilder();
            customFixedLogicalVolumes.Append("custom_fixed_logical_volumes=\"");
            foreach (var hd in customSchema.HardDrives.Where(x => x.Active))
            {
                customHardDrives.Append(hd.Name + " ");
                foreach (var partition in hd.Partitions.Where(x => x.Active))
                {
                    customPartitions.Append(hd.Name + partition.Prefix + partition.Number + " ");
                    if (partition.ForceFixedSize)
                        customFixedPartitions.Append(hd.Name + partition.Prefix + partition.Number + " ");

                    if (partition.VolumeGroup.LogicalVolumes != null)
                    {
                        foreach (
                            var logicalVolume in partition.VolumeGroup.LogicalVolumes.Where(x => x.Active))
                        {
                            var vgName = partition.VolumeGroup.Name.Replace("-", "--");
                            var lvName = logicalVolume.Name.Replace("-", "--");
                            customLogicalVolumes.Append(vgName + "-" + lvName + " ");
                            if (logicalVolume.ForceFixedSize)
                                customFixedLogicalVolumes.Append(vgName + "-" + lvName + " ");
                        }
                    }
                }
            }
            customHardDrives.Append("\"");
            customPartitions.Append("\"");
            customFixedPartitions.Append("\"");
            customLogicalVolumes.Append("\"");
            customFixedLogicalVolumes.Append("\"");
            AppendString(customHardDrives.ToString());
            AppendString(customPartitions.ToString());
            AppendString(customFixedPartitions.ToString());
            AppendString(customLogicalVolumes.ToString());
            AppendString(customFixedLogicalVolumes.ToString());
        }
Ejemplo n.º 6
0
        protected void btnHd_Click(object sender, EventArgs e)
        {
            var control = sender as Control;

            if (control == null)
            {
                return;
            }
            var gvRow = (GridViewRow)control.Parent.Parent;
            var gv    = (GridView)gvRow.FindControl("gvParts");

            var selectedHd = gvRow.Cells[1].Text;

            ViewState["selectedHD"]     = gvRow.RowIndex.ToString();
            ViewState["selectedHDName"] = selectedHd;


            var partitions = new ImageSchema(null, null, Image).GetPartitionsForGridView(selectedHd);
            var btn        = (LinkButton)gvRow.FindControl("btnHd");

            if (gv.Visible == false)
            {
                gv.Visible = true;

                var td = gvRow.FindControl("tdParts");
                td.Visible    = true;
                gv.DataSource = partitions;
                gv.DataBind();

                btn.Text = "-";
            }
            else
            {
                gv.Visible = false;

                var td = gvRow.FindControl("tdParts");
                td.Visible = false;
                btn.Text   = "+";
            }

            foreach (GridViewRow row in gv.Rows)
            {
                if (partitions[row.RowIndex].VolumeGroup == null)
                {
                    continue;
                }
                if (partitions[row.RowIndex].VolumeGroup.Name == null)
                {
                    continue;
                }
                var gvVg = (GridView)row.FindControl("gvVG");
                gvVg.DataSource = new List <Models.ImageSchema.GridView.VolumeGroup>
                {
                    partitions[row.RowIndex].VolumeGroup
                };
                gvVg.DataBind();

                gvVg.Visible = true;
                var td = row.FindControl("tdVG");
                td.Visible = true;
            }
        }
Ejemplo n.º 7
0
 private void SetCustomSchemaDeploy()
 {
     var customSchema = new BLL.ImageSchema(_imageProfile, "deploy").GetImageSchema();
     var customHardDrives = new StringBuilder();
     customHardDrives.Append("custom_hard_drives=\"");
             
     foreach (var hd in customSchema.HardDrives.Where(x => x.Active && !string.IsNullOrEmpty(x.Destination)))          
         customHardDrives.Append(hd.Destination + " ");
                  
     customHardDrives.Append("\"");
     AppendString(customHardDrives.ToString());
 }