protected void bt_AddToDataSet_Click(object sender, EventArgs e) { IList <Rpt_DataSetFields> datasetfields = new Rpt_DataSetBLL((Guid)ViewState["ID"]).GetFields(); int maxsortid = 0; if (datasetfields.Count > 0) { maxsortid = datasetfields.Max(p => p.ColumnSortID); } foreach (ListItem item in cbxl_Fields.Items) { if (item.Selected) { Guid fieldid = new Guid(item.Value); UD_ModelFields f = new UD_ModelFieldsBLL(fieldid).Model; if (f != null) { string fieldname = new UD_TableListBLL(f.TableID).Model.ModelClassName + "_" + f.FieldName; if (datasetfields.FirstOrDefault(p => p.FieldName == fieldname) != null) { continue; } maxsortid++; Rpt_DataSetFieldsBLL fieldbll = new Rpt_DataSetFieldsBLL(); fieldbll.Model.DataSet = (Guid)ViewState["ID"]; fieldbll.Model.FieldID = f.ID; fieldbll.Model.FieldName = fieldname; fieldbll.Model.DisplayName = f.DisplayName; fieldbll.Model.DataType = f.DataType; fieldbll.Model.IsComputeField = "N"; fieldbll.Model.ColumnSortID = maxsortid; if (f.RelationType == 1 || f.RelationType == 2) { fieldbll.Model.DisplayMode = 2; } else { fieldbll.Model.DisplayMode = 1; } fieldbll.Model.Description = f.Description; fieldbll.Add(); } } } BindGrid(); new Rpt_DataSetBLL((Guid)ViewState["ID"]).ClearCache(); }
protected void bt_Expand_Click(object sender, EventArgs e) { Rpt_DataSetFields m = new Rpt_DataSetFieldsBLL((Guid)ViewState["ID"]).Model; if (m == null || m.TreeLevel != 0) return; UD_ModelFields field = new UD_ModelFieldsBLL(m.FieldID).Model; if (field == null) return; //如果关联表是树形结构,则允许设定树表层次 if (field.RelationType == 2 && new UD_TableListBLL(field.RelationTableName).Model.TreeFlag == "Y") { int maxsortid = 0; IList<Rpt_DataSetFields> datasetfields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields(); if (datasetfields.Count > 0) maxsortid = datasetfields.Max(p => p.ColumnSortID); Dictionary<string, Dictionary_Data> levels; if (field.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") levels = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel");//关联至管理片区 else if (field.RelationTableName == "MCS_SYS.dbo.Addr_OfficialCity") levels = DictionaryBLL.GetDicCollections("Addr_OfficialCityLevel"); //关联至行政城市 else return; foreach (string level in levels.Keys) { string fieldname = m.FieldName + level; if (datasetfields.FirstOrDefault(p => p.FieldName == fieldname) == null) { maxsortid++; Rpt_DataSetFieldsBLL fieldbll = new Rpt_DataSetFieldsBLL(); fieldbll.Model.DataSet = (Guid)ViewState["DataSet"]; fieldbll.Model.FieldID = field.ID; fieldbll.Model.FieldName = fieldname; fieldbll.Model.DisplayName = levels[level].Name; fieldbll.Model.DataType = 3; //固定为字符串型 fieldbll.Model.IsComputeField = "N"; fieldbll.Model.ColumnSortID = maxsortid; fieldbll.Model.DisplayMode = 2; fieldbll.Model.TreeLevel = int.Parse(level); fieldbll.Model.Description = field.Description; fieldbll.Add(); } } MessageBox.ShowAndRedirect(this, "展开级别成功!", "Rpt_DataSetFieldsList.aspx?ID=" + ViewState["DataSet"].ToString()); } }
protected void bt_AddToDataSet_Click(object sender, EventArgs e) { IList<Rpt_DataSetFields> datasetfields = new Rpt_DataSetBLL((Guid)ViewState["ID"]).GetFields(); int maxsortid = 0; if (datasetfields.Count > 0) maxsortid = datasetfields.Max(p => p.ColumnSortID); foreach (ListItem item in cbxl_Fields.Items) { if (item.Selected) { Guid fieldid = new Guid(item.Value); UD_ModelFields f = new UD_ModelFieldsBLL(fieldid).Model; if (f != null) { string fieldname = new UD_TableListBLL(f.TableID).Model.ModelClassName + "_" + f.FieldName; if (datasetfields.FirstOrDefault(p => p.FieldName == fieldname) != null) continue; maxsortid++; Rpt_DataSetFieldsBLL fieldbll = new Rpt_DataSetFieldsBLL(); fieldbll.Model.DataSet = (Guid)ViewState["ID"]; fieldbll.Model.FieldID = f.ID; fieldbll.Model.FieldName = fieldname; fieldbll.Model.DisplayName = f.DisplayName; fieldbll.Model.DataType = f.DataType; fieldbll.Model.IsComputeField = "N"; fieldbll.Model.ColumnSortID = maxsortid; if (f.RelationType == 1 || f.RelationType == 2) fieldbll.Model.DisplayMode = 2; else fieldbll.Model.DisplayMode = 1; fieldbll.Model.Description = f.Description; fieldbll.Add(); } } } BindGrid(); new Rpt_DataSetBLL((Guid)ViewState["ID"]).ClearCache(); }
private void BindDataSetFields() { Rpt_ReportBLL report = new Rpt_ReportBLL((Guid)ViewState["ID"]); IList <Rpt_ReportGridColumns> columns = report.GetGridColumns(); IList <Rpt_DataSetFields> fields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields(); foreach (Rpt_ReportGridColumns col in columns) { Rpt_DataSetFields f = fields.FirstOrDefault(p => p.ID == col.DataSetField); if (f != null) { fields.Remove(f); } } cbxl_Fields.DataSource = fields; cbxl_Fields.DataBind(); }
protected void bt_Decrease_Click(object sender, EventArgs e) { int rowindex = ((GridViewRow)((Button)sender).Parent.Parent).RowIndex; Guid id = (Guid)gv_List.DataKeys[rowindex][0]; Rpt_DataSetFieldsBLL bll = new Rpt_DataSetFieldsBLL(id); if (bll.Model.ColumnSortID > 0) bll.Model.ColumnSortID--; bll.Update(); IList<Rpt_DataSetFields> fields = new Rpt_DataSetBLL((Guid)ViewState["ID"]).GetFields(); Rpt_DataSetFields pre = fields.FirstOrDefault(p => p.ColumnSortID == bll.Model.ColumnSortID && p.ID != id); if (pre != null) { bll = new Rpt_DataSetFieldsBLL(pre.ID); if (bll.Model.ColumnSortID > 0) bll.Model.ColumnSortID++; bll.Update(); } BindGrid(); }
protected void bt_Expand_Click(object sender, EventArgs e) { Rpt_DataSetFields m = new Rpt_DataSetFieldsBLL((Guid)ViewState["ID"]).Model; if (m == null || m.TreeLevel != 0) { return; } UD_ModelFields field = new UD_ModelFieldsBLL(m.FieldID).Model; if (field == null) { return; } //如果关联表是树形结构,则允许设定树表层次 if (field.RelationType == 2 && new UD_TableListBLL(field.RelationTableName).Model.TreeFlag == "Y") { int maxsortid = 0; IList <Rpt_DataSetFields> datasetfields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields(); if (datasetfields.Count > 0) { maxsortid = datasetfields.Max(p => p.ColumnSortID); } Dictionary <string, Dictionary_Data> levels; if (field.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { levels = DictionaryBLL.GetDicCollections("Addr_OrganizeCityLevel");//关联至管理片区 } else if (field.RelationTableName == "MCS_SYS.dbo.Addr_OfficialCity") { levels = DictionaryBLL.GetDicCollections("Addr_OfficialCityLevel"); //关联至行政城市 } else { return; } foreach (string level in levels.Keys) { string fieldname = m.FieldName + level; if (datasetfields.FirstOrDefault(p => p.FieldName == fieldname) == null) { maxsortid++; Rpt_DataSetFieldsBLL fieldbll = new Rpt_DataSetFieldsBLL(); fieldbll.Model.DataSet = (Guid)ViewState["DataSet"]; fieldbll.Model.FieldID = field.ID; fieldbll.Model.FieldName = fieldname; fieldbll.Model.DisplayName = levels[level].Name; fieldbll.Model.DataType = 3; //固定为字符串型 fieldbll.Model.IsComputeField = "N"; fieldbll.Model.ColumnSortID = maxsortid; fieldbll.Model.DisplayMode = 2; fieldbll.Model.TreeLevel = int.Parse(level); fieldbll.Model.Description = field.Description; fieldbll.Add(); } } MessageBox.ShowAndRedirect(this, "展开级别成功!", "Rpt_DataSetFieldsList.aspx?ID=" + ViewState["DataSet"].ToString()); } }
private void BindDataSetFields() { Rpt_ReportBLL report = new Rpt_ReportBLL((Guid)ViewState["ID"]); IList<Rpt_DataSetFields> fields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields(); foreach (Rpt_ReportColumnGroups col in report.GetColumnGroups()) { Rpt_DataSetFields f = fields.FirstOrDefault(p => p.ID == col.DataSetField); if (f != null) fields.Remove(f); } foreach (Rpt_ReportRowGroups col in report.GetRowGroups()) { Rpt_DataSetFields f = fields.FirstOrDefault(p => p.ID == col.DataSetField); if (f != null) fields.Remove(f); } foreach (Rpt_ReportValueGroups col in report.GetValueGroups()) { Rpt_DataSetFields f = fields.FirstOrDefault(p => p.ID == col.DataSetField); if (f != null) fields.Remove(f); } cbxl_Fields.DataSource = fields; cbxl_Fields.DataBind(); }
private void BindDataSetFields() { Rpt_ReportBLL report = new Rpt_ReportBLL((Guid)ViewState["ID"]); IList<Rpt_ReportGridColumns> columns = report.GetGridColumns(); IList<Rpt_DataSetFields> fields = new Rpt_DataSetBLL((Guid)ViewState["DataSet"]).GetFields(); foreach (Rpt_ReportGridColumns col in columns) { Rpt_DataSetFields f = fields.FirstOrDefault(p => p.ID == col.DataSetField); if (f != null) fields.Remove(f); } cbxl_Fields.DataSource = fields; cbxl_Fields.DataBind(); }