Ejemplo n.º 1
0
    protected string SetCustomUploadSchema()
    {
        var schema = new BLL.ImageSchema(ImageProfile, "upload").GetImageSchema();

        var rowCounter = 0;

        foreach (GridViewRow row in gvHDs.Rows)
        {
            var box = row.FindControl("chkHDActive") as CheckBox;
            if (box != null)
            {
                schema.HardDrives[rowCounter].Active = box.Checked;
            }

            var gvParts = (GridView)row.FindControl("gvParts");

            var partCounter = 0;
            foreach (GridViewRow partRow in gvParts.Rows)
            {
                var boxPart = partRow.FindControl("chkPartActive") as CheckBox;
                if (boxPart != null)
                {
                    schema.HardDrives[rowCounter].Partitions[partCounter].Active = boxPart.Checked;
                }

                var chkFixed = partRow.FindControl("chkFixed") as CheckBox;
                if (chkFixed != null)
                {
                    schema.HardDrives[rowCounter].Partitions[partCounter].ForceFixedSize = chkFixed.Checked;
                }

                var gvVg = (GridView)partRow.FindControl("gvVG");
                foreach (GridViewRow vg in gvVg.Rows)
                {
                    var gvLvs     = (GridView)vg.FindControl("gvLVS");
                    var lvCounter = 0;
                    foreach (GridViewRow lv in gvLvs.Rows)
                    {
                        var lvBoxPart = lv.FindControl("chkPartActive") as CheckBox;
                        if (lvBoxPart != null)
                        {
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].Active = lvBoxPart.Checked;
                        }

                        var lvChkFixed = lv.FindControl("chkFixed") as CheckBox;
                        if (lvChkFixed != null)
                        {
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].ForceFixedSize = lvChkFixed.Checked;
                        }
                        lvCounter++;
                    }
                }
                partCounter++;
            }
            rowCounter++;
        }
        return(JsonConvert.SerializeObject(schema));
    }
Ejemplo n.º 2
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[2].Text;
        ViewState["selectedHD"] = gvRow.RowIndex.ToString();
        ViewState["selectedHDName"] = selectedHd;


        var partitions = new ImageSchema(ImageProfile,"upload").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.º 3
0
    protected string SetCustomUploadSchema()
    {
        var schema = new BLL.ImageSchema(ImageProfile,"upload").GetImageSchema();

        var rowCounter = 0;
        foreach (GridViewRow row in gvHDs.Rows)
        {
            var box = row.FindControl("chkHDActive") as CheckBox;
            if (box != null)
                schema.HardDrives[rowCounter].Active = box.Checked;

            var gvParts = (GridView)row.FindControl("gvParts");

            var partCounter = 0;
            foreach (GridViewRow partRow in gvParts.Rows)
            {
                var boxPart = partRow.FindControl("chkPartActive") as CheckBox;
                if (boxPart != null)
                    schema.HardDrives[rowCounter].Partitions[partCounter].Active = boxPart.Checked;

                var chkFixed = partRow.FindControl("chkFixed") as CheckBox;
                if (chkFixed != null)
                    schema.HardDrives[rowCounter].Partitions[partCounter].ForceFixedSize = chkFixed.Checked;

                var gvVg = (GridView)partRow.FindControl("gvVG");
                foreach (GridViewRow vg in gvVg.Rows)
                {
                    var gvLvs = (GridView)vg.FindControl("gvLVS");
                    var lvCounter = 0;
                    foreach (GridViewRow lv in gvLvs.Rows)
                    {
                        var lvBoxPart = lv.FindControl("chkPartActive") as CheckBox;
                        if (lvBoxPart != null)
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].Active = lvBoxPart.Checked;

                        var lvChkFixed = lv.FindControl("chkFixed") as CheckBox;
                        if (lvChkFixed != null)
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].ForceFixedSize = lvChkFixed.Checked;
                        lvCounter++;
                    }
                }
                partCounter++;
            }
            rowCounter++;
        }
        return JsonConvert.SerializeObject(schema);

    }
Ejemplo n.º 4
0
    protected string SetCustomSchema()
    {
        var schema = new BLL.ImageSchema(ImageProfile, "deploy").GetImageSchema();

        var rowCounter = 0;

        foreach (GridViewRow row in gvHDs.Rows)
        {
            var box = row.FindControl("chkHDActive") as CheckBox;
            if (box != null)
            {
                schema.HardDrives[rowCounter].Active = box.Checked;
            }

            var txtDestination = row.FindControl("txtDestination") as TextBox;
            if (txtDestination != null)
            {
                schema.HardDrives[rowCounter].Destination = txtDestination.Text;
            }

            var gvParts     = (GridView)row.FindControl("gvParts");
            var partCounter = 0;
            foreach (GridViewRow partRow in gvParts.Rows)
            {
                var boxPart = partRow.FindControl("chkPartActive") as CheckBox;
                if (boxPart != null)
                {
                    schema.HardDrives[rowCounter].Partitions[partCounter].Active = boxPart.Checked;
                }

                var txtCustomSize = partRow.FindControl("txtCustomSize") as TextBox;
                if (txtCustomSize != null)
                {
                    schema.HardDrives[rowCounter].Partitions[partCounter].CustomSize = txtCustomSize.Text;
                }

                var ddlUnit = partRow.FindControl("ddlUnit") as DropDownList;
                if (ddlUnit != null)
                {
                    schema.HardDrives[rowCounter].Partitions[partCounter].CustomSizeUnit = ddlUnit.Text;
                }

                var chkFixed = partRow.FindControl("chkFixed") as CheckBox;
                if (chkFixed != null)
                {
                    schema.HardDrives[rowCounter].Partitions[partCounter].ForceFixedSize = chkFixed.Checked;
                }

                var gvVg = (GridView)partRow.FindControl("gvVG");

                foreach (GridViewRow vg in gvVg.Rows)
                {
                    var gvLvs     = (GridView)vg.FindControl("gvLVS");
                    var lvCounter = 0;
                    foreach (GridViewRow lv in gvLvs.Rows)
                    {
                        var lvBoxPart = lv.FindControl("chkPartActive") as CheckBox;
                        if (lvBoxPart != null)
                        {
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].Active = lvBoxPart.Checked;
                        }

                        var lvTxtCustomSize = lv.FindControl("txtCustomSize") as TextBox;
                        if (lvTxtCustomSize != null)
                        {
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].CustomSize = lvTxtCustomSize.Text;
                        }

                        var lvDdlUnit = lv.FindControl("ddlUnit") as DropDownList;
                        if (lvDdlUnit != null)
                        {
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].CustomSizeUnit = lvDdlUnit.Text;
                        }

                        var lvChkFixed = lv.FindControl("chkFixed") as CheckBox;
                        if (lvChkFixed != null)
                        {
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].ForceFixedSize = lvChkFixed.Checked;
                        }
                        lvCounter++;
                    }
                }
                partCounter++;
            }
            rowCounter++;
        }
        return(JsonConvert.SerializeObject(schema, new JsonSerializerSettings {
            NullValueHandling = NullValueHandling.Ignore
        }));
    }
Ejemplo n.º 5
0
    protected string SetCustomSchema()
    {
        var schema = new BLL.ImageSchema(ImageProfile,"deploy").GetImageSchema();

        var rowCounter = 0;
        foreach (GridViewRow row in gvHDs.Rows)
        {
            var box = row.FindControl("chkHDActive") as CheckBox;
            if(box != null)
            schema.HardDrives[rowCounter].Active = box.Checked;

            var txtDestination = row.FindControl("txtDestination") as TextBox;
            if(txtDestination != null)
                schema.HardDrives[rowCounter].Destination = txtDestination.Text;

            var gvParts = (GridView)row.FindControl("gvParts");
            var partCounter = 0;
            foreach (GridViewRow partRow in gvParts.Rows)
            {
                var boxPart = partRow.FindControl("chkPartActive") as CheckBox;
                if (boxPart != null)
                schema.HardDrives[rowCounter].Partitions[partCounter].Active = boxPart.Checked;

                var txtCustomSize = partRow.FindControl("txtCustomSize") as TextBox;
                if (txtCustomSize != null)
                    schema.HardDrives[rowCounter].Partitions[partCounter].CustomSize = txtCustomSize.Text;

                var ddlUnit = partRow.FindControl("ddlUnit") as DropDownList;
                if (ddlUnit != null)
                    schema.HardDrives[rowCounter].Partitions[partCounter].CustomSizeUnit = ddlUnit.Text;

                var chkFixed = partRow.FindControl("chkFixed") as CheckBox;
                if (chkFixed != null)
                    schema.HardDrives[rowCounter].Partitions[partCounter].ForceFixedSize = chkFixed.Checked;

                var gvVg = (GridView)partRow.FindControl("gvVG");

                foreach (GridViewRow vg in gvVg.Rows)
                {
                    var gvLvs = (GridView)vg.FindControl("gvLVS");
                    var lvCounter = 0;
                    foreach (GridViewRow lv in gvLvs.Rows)
                    {
                        var lvBoxPart = lv.FindControl("chkPartActive") as CheckBox;
                        if (lvBoxPart != null)
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].Active = lvBoxPart.Checked;

                        var lvTxtCustomSize = lv.FindControl("txtCustomSize") as TextBox;
                        if (lvTxtCustomSize != null)
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].CustomSize = lvTxtCustomSize.Text;

                        var lvDdlUnit = lv.FindControl("ddlUnit") as DropDownList;
                        if (lvDdlUnit != null)
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].CustomSizeUnit = lvDdlUnit.Text;

                        var lvChkFixed = lv.FindControl("chkFixed") as CheckBox;
                        if (lvChkFixed != null)
                            schema.HardDrives[rowCounter].Partitions[partCounter].VolumeGroup.LogicalVolumes[lvCounter].ForceFixedSize = lvChkFixed.Checked;
                        lvCounter++;
                    }
                }
                partCounter++;
            }
            rowCounter++;
        }
        return JsonConvert.SerializeObject(schema, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
    }
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[2].Text;
        ViewState["selectedHD"] = gvRow.RowIndex.ToString();
        ViewState["selectedHDName"] = selectedHd;

        var partitions = new ImageSchema(ImageProfile,"deploy").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 (ddlObject.Text != "Dynamic")
            {
                foreach (GridViewRow partRow in gv.Rows)
                {
                    var txtCustomSize = partRow.FindControl("txtCustomSize") as TextBox;
                    if (txtCustomSize != null)
                        txtCustomSize.Enabled = false;

                    var ddlUnit = partRow.FindControl("ddlUnit") as DropDownList;
                    if (ddlUnit != null)
                        ddlUnit.Enabled = false;

                    var chkFixed = partRow.FindControl("chkFixed") as CheckBox;
                    if (chkFixed != null)
                        chkFixed.Enabled = false;
                }
            }

            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;

        }
    }