Exemplo n.º 1
0
    protected void Insert(object sender, EventArgs e)
    {
        GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent;
        var partition = new Models.Partition
        {
            LayoutId = Layout.Id,
            Type = ((DropDownList)gvRow.FindControl("ddlTypeAdd")).Text,
            Number = Convert.ToInt32(((DropDownList)gvRow.FindControl("ddlNumberAdd")).Text),
            FsType = ((DropDownList)gvRow.FindControl("ddlFsTypeAdd")).Text,
            Size = Convert.ToInt32(((TextBox)gvRow.FindControl("txtSizeAdd")).Text),
            Unit = ((DropDownList)gvRow.FindControl("ddlUnitAdd")).Text,
            Boot = Convert.ToInt32(((CheckBox)gvRow.FindControl("chkBootAdd")).Checked)
        };

        BLL.Partition.AddPartition(partition);

        this.BindGrid();
    }
Exemplo n.º 2
0
    protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow gvRow = gvPartitions.Rows[e.RowIndex];
        var partition = new Models.Partition
        {
            Id = Convert.ToInt32(gvPartitions.DataKeys[e.RowIndex].Values[0]),
            LayoutId = Layout.Id,
            Type = ((DropDownList)gvRow.FindControl("ddlType")).Text,
            Number = Convert.ToInt32(((DropDownList)gvRow.FindControl("ddlNumber")).Text),
            FsType = ((DropDownList)gvRow.FindControl("ddlFsType")).Text,
            Size = Convert.ToInt32(((TextBox)gvRow.FindControl("txtSize")).Text),
            Unit = ((DropDownList)gvRow.FindControl("ddlUnit")).Text,
            Boot = Convert.ToInt32(((CheckBox)gvRow.FindControl("chkBoot")).Checked)
        };
        BLL.Partition.UpdatePartition(partition);

        gvPartitions.EditIndex = -1;
        this.BindGrid();
    }