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 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); }