public static void MergeColumns(FormConfig form, DataFormConfig dataForm, ModuleConfig moduleConfig) { if (form.FormColumnRight != null) { ColumnRightConfig columnRight = null; string columnRightname = form.FormColumnRight.Name; if (form.FormColumnRight.RegName.IsEmpty()) { AtawDebug.AssertArgumentNullOrEmpty(columnRightname, "FormColumnRight中若没指定RegName,Name属性不能为空", moduleConfig); columnRight = moduleConfig.Right.ColumnRights.FirstOrDefault(a => a.Name == columnRightname); AtawDebug.AssertArgumentNull(columnRight, string.Format("ModuleXml中必须配置名为'{0}'的ColumnRight", columnRightname), moduleConfig); } else { IColumnRight columnRightPlug = form.FormColumnRight.RegName.CodePlugIn <IColumnRight>(); columnRightname = columnRightPlug.GetColumnRightName(); columnRight = moduleConfig.Right.ColumnRights.FirstOrDefault(a => a.Name == columnRightname); AtawDebug.AssertArgumentNull(columnRight, string.Format("ModuleXml中必须配置名为'{0}'的ColumnRight", columnRightname), moduleConfig); } //if (columnRight.Delete != null) //{ // columnRight.Delete.ForEach(dCol => // { // var col = dataForm.Columns.FirstOrDefault(baseCol => baseCol.Name.Equals(dCol.Name, StringComparison.OrdinalIgnoreCase)); // if (col != null) // dataForm.Columns.Remove(col); // }); //} if (columnRight.Override != null) { columnRight.Override.ForEach(oCol => { var col = dataForm.Columns.FirstOrDefault(baseCol => baseCol.Name.Equals(oCol.BaseColumnName, StringComparison.OrdinalIgnoreCase)); if (col != null) { AssignColumn(oCol, col); } }); } if (columnRight.Add != null) { dataForm.Columns.AddRange(columnRight.Add); } } }
private void MergeDelColumns(FormConfig form, DataFormConfig dataForm, ModuleConfig moduleConfig) { if (form.FormColumnRight != null) { ColumnRightConfig columnRight = GetColumnRight(form, dataForm, moduleConfig); if (columnRight.Delete != null) { columnRight.Delete.ForEach(dCol => { var col = dataForm.Columns.FirstOrDefault(baseCol => baseCol.Name.Equals(dCol.Name, StringComparison.OrdinalIgnoreCase)); if (col != null) { dataForm.Columns.Remove(col); } }); } } }
private static ColumnRightConfig GetColumnRight(FormConfig form, DataFormConfig dataForm, ModuleConfig moduleConfig) { ColumnRightConfig columnRight = null; string columnRightname = form.FormColumnRight.Name; if (form.FormColumnRight.RegName.IsEmpty()) { AtawDebug.AssertArgumentNullOrEmpty(columnRightname, "FormColumnRight中若没指定RegName,Name属性不能为空", moduleConfig); columnRight = moduleConfig.Right.ColumnRights.FirstOrDefault(a => a.Name == columnRightname); AtawDebug.AssertArgumentNull(columnRight, string.Format("ModuleXml中必须配置名为'{0}'的ColumnRight", columnRightname), moduleConfig); } else { IColumnRight columnRightPlug = form.FormColumnRight.RegName.CodePlugIn <IColumnRight>(); columnRightname = columnRightPlug.GetColumnRightName(); columnRight = moduleConfig.Right.ColumnRights.FirstOrDefault(a => a.Name == columnRightname); AtawDebug.AssertArgumentNull(columnRight, string.Format("ModuleXml中必须配置名为'{0}'的ColumnRight", columnRightname), moduleConfig); } return(columnRight); }
public static void MergeColumns(FormConfig form, DataFormConfig dataForm, ModuleConfig moduleConfig, PageStyle pagestyle, out List <ColumnConfig> fullColumns) { if (form.FormColumnRight != null) { ColumnRightConfig columnRight = GetColumnRight(form, dataForm, moduleConfig); if (columnRight.Delete != null) { columnRight.Delete.ForEach(dCol => { var col = dataForm.Columns.FirstOrDefault(baseCol => baseCol.Name.Equals(dCol.Name, StringComparison.OrdinalIgnoreCase)); if (col != null) { dataForm.Columns.Remove(col); } }); } if (columnRight.Override != null) { columnRight.Override.ForEach(oCol => { var col = dataForm.Columns.FirstOrDefault(baseCol => baseCol.Name.Equals(oCol.BaseColumnName, StringComparison.OrdinalIgnoreCase)); if (col != null) { AssignColumn(oCol, col); } }); } if (columnRight.Add != null) { dataForm.Columns.AddRange(columnRight.Add); } } fullColumns = new List <ColumnConfig>(); fullColumns = dataForm.Columns; dataForm.Columns = dataForm.Columns.Where(a => a.ShowPage.HasFlag(pagestyle)).ToList(); }