protected void bt_Add_RowGroup_Click(object sender, EventArgs e) { SaveGrid_RowGroup(); Rpt_ReportBLL report = new Rpt_ReportBLL((Guid)ViewState["ID"]); IList<Rpt_ReportRowGroups> columns = report.GetRowGroups(); int maxsortid = 0; if (columns.Count > 0) maxsortid = columns.Max(p => p.GroupSortID); foreach (ListItem item in cbxl_Fields.Items) { if (item.Selected && columns.FirstOrDefault(p => p.DataSetField == new Guid(item.Value)) == null) { maxsortid++; Rpt_ReportRowGroupsBLL column = new Rpt_ReportRowGroupsBLL(); column.Model.Report = (Guid)ViewState["ID"]; column.Model.DataSetField = new Guid(item.Value); column.Model.DisplayName = item.Text; column.Model.GroupSortID = maxsortid; column.Model.AddSummary = "N"; column.Add(); } } BindDataSetFields(); BindGrid_RowGroup(); }
protected void bt_Add_RowGroup_Click(object sender, EventArgs e) { SaveGrid_RowGroup(); Rpt_ReportBLL report = new Rpt_ReportBLL((Guid)ViewState["ID"]); IList <Rpt_ReportRowGroups> columns = report.GetRowGroups(); int maxsortid = 0; if (columns.Count > 0) { maxsortid = columns.Max(p => p.GroupSortID); } foreach (ListItem item in cbxl_Fields.Items) { if (item.Selected && columns.FirstOrDefault(p => p.DataSetField == new Guid(item.Value)) == null) { maxsortid++; Rpt_ReportRowGroupsBLL column = new Rpt_ReportRowGroupsBLL(); column.Model.Report = (Guid)ViewState["ID"]; column.Model.DataSetField = new Guid(item.Value); column.Model.DisplayName = item.Text; column.Model.GroupSortID = maxsortid; column.Model.AddSummary = "N"; column.Add(); } } BindDataSetFields(); BindGrid_RowGroup(); }
protected void bt_Decrease_RowGroup_Click(object sender, EventArgs e) { SaveGrid_RowGroup(); int rowindex = ((GridViewRow)((Button)sender).Parent.Parent).RowIndex; if (rowindex > 0) { Guid id = (Guid)gv_List_RowGroup.DataKeys[rowindex][0]; Rpt_ReportRowGroupsBLL bll = new Rpt_ReportRowGroupsBLL(id); if (bll.Model.GroupSortID > 0) { bll.Model.GroupSortID--; } bll.Update(); id = (Guid)gv_List_RowGroup.DataKeys[rowindex - 1][0]; bll = new Rpt_ReportRowGroupsBLL(id); bll.Model.GroupSortID++; bll.Update(); } BindGrid_RowGroup(); }
protected void gv_List_RowGroup_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Guid id = (Guid)gv_List_RowGroup.DataKeys[e.Row.RowIndex][0]; Rpt_ReportRowGroups c = new Rpt_ReportRowGroupsBLL(id).Model; if (c != null) { RadioButtonList rbl_AddSummary = (RadioButtonList)e.Row.FindControl("rbl_AddSummary"); rbl_AddSummary.SelectedValue = c.AddSummary == "Y" ? "Y" : "N"; } if (e.Row.RowIndex == 0) { e.Row.FindControl("bt_Decrease_RowGroup").Visible = false; } if (e.Row.RowIndex == new Rpt_ReportBLL((Guid)ViewState["ID"]).GetRowGroups().Count - 1) { e.Row.FindControl("bt_Increase_RowGroup").Visible = false; } } }
private void SaveGrid_RowGroup() { foreach (GridViewRow row in gv_List_RowGroup.Rows) { Guid id = (Guid)gv_List_RowGroup.DataKeys[row.RowIndex][0]; Rpt_ReportRowGroupsBLL column = new Rpt_ReportRowGroupsBLL(id); column.Model.DisplayName = ((TextBox)row.FindControl("tbx_DisplayName")).Text; column.Model.AddSummary = ((RadioButtonList)row.FindControl("rbl_AddSummary")).SelectedValue; column.Update(); } }
protected void gv_List_RowGroup_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Guid id = (Guid)gv_List_RowGroup.DataKeys[e.Row.RowIndex][0]; Rpt_ReportRowGroups c = new Rpt_ReportRowGroupsBLL(id).Model; if (c != null) { RadioButtonList rbl_AddSummary = (RadioButtonList)e.Row.FindControl("rbl_AddSummary"); rbl_AddSummary.SelectedValue = c.AddSummary == "Y" ? "Y" : "N"; } if (e.Row.RowIndex == 0) e.Row.FindControl("bt_Decrease_RowGroup").Visible = false; if (e.Row.RowIndex == new Rpt_ReportBLL((Guid)ViewState["ID"]).GetRowGroups().Count - 1) e.Row.FindControl("bt_Increase_RowGroup").Visible = false; } }
protected void bt_Increase_RowGroup_Click(object sender, EventArgs e) { SaveGrid_RowGroup(); int rowindex = ((GridViewRow)((Button)sender).Parent.Parent).RowIndex; if (rowindex < gv_List_RowGroup.Rows.Count - 1) { Guid id = (Guid)gv_List_RowGroup.DataKeys[rowindex][0]; Rpt_ReportRowGroupsBLL bll = new Rpt_ReportRowGroupsBLL(id); bll.Model.GroupSortID++; bll.Update(); id = (Guid)gv_List_RowGroup.DataKeys[rowindex + 1][0]; bll = new Rpt_ReportRowGroupsBLL(id); if (bll.Model.GroupSortID > 0) bll.Model.GroupSortID--; bll.Update(); } BindGrid_RowGroup(); }