public virtual void BeginModulePageInterceptor(ref string ds, ref string xml, ref string keyValue, ref ModuleConfig moduleObj) { fDs = ds; fXml = xml; fKeyValue = keyValue; fModuleObj = moduleObj; }
public virtual void BeginModuleMergeInterceptor(ref string ds, ref string xml, ref string pageStyle, ref ModuleConfig moduleObj) { fDs = ds; fXml = xml; fPageStyle = pageStyle; fModuleObj = moduleObj; }
public void Initialize(ModuleConfig moduleConfig, FormConfig formConfig, AtawPageConfigView basePageView) { ModuleConfig = moduleConfig; FormConfig = formConfig; BasePageView = basePageView; FormViews = new List <AtawFormConfigView>(); }
public virtual void BeginSearchFormInterceptor(ref string ds, ref string xml, ref string form, ref ModuleConfig moduleObj) { // throw new NotImplementedException(); fModuleObj = moduleObj; fDs = ds; fXml = xml; fForm = form; fPageStyle = "List"; }
public virtual void Initialize(ModuleConfig moduleConfig, DataSet postDataSet, string keyValue, string formName, bool isFillEmpty) { FormName = formName; PostDataSet = postDataSet; KeyValue = keyValue; IsFillEmpty = isFillEmpty; //ForeignKeyValue = foreignKeyValue; ModuleConfig = AnalysisModule(moduleConfig); this.BasePageView.Data = new DataSet(); }
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); } }); } } }
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(); }
/// <summary> /// 对ModuleConfig进行再处理,FormName不为空时则只对单个Form处理(例如,多表中对某张表进行查询) /// </summary> /// <param name="moduleConfig"></param> /// <returns></returns> private ModuleConfig AnalysisModule(ModuleConfig moduleConfig) { FormConfigs = moduleConfig.Forms.Where(a => a is FormConfig) .Cast <FormConfig>() .Where(a => IsSupportPage(a.SupportPage, this.PageStyle)); MvcFormConfigs = moduleConfig.Forms.Where(a => a is MvcFormConfig) == null ? null : moduleConfig.Forms.Where(a => a is MvcFormConfig).Cast <MvcFormConfig>(); SeaFormConfigs = moduleConfig.Forms.Where(a => a is SeaFormConfig) == null ? null : moduleConfig.Forms.Where(a => a is SeaFormConfig).Cast <SeaFormConfig>(); ScriptFormConfigs = moduleConfig.Forms.Where(a => a is ScriptFormConfig) == null ? null : moduleConfig.Forms.Where(a => a is ScriptFormConfig).Cast <ScriptFormConfig>(); //if (moduleConfig.Mode == ModuleMode.MasterDetail) //{ // AtawDebug.AssertArgumentNull(moduleConfig.Relations, "主从表必须配置Relation", this); //BasePageView.KeyValue = KeyValue; //主从表修改时,主表主键需要传递给前台 // } #region 非空属性赋值 //Form配置中Name或TableName或Title可能没有值,此时需要赋值 moduleConfig.Forms.ForEach(a => { if (a is FormConfig) { var form = a as FormConfig; var dataForm = form.File.InstanceByPage <DataFormConfig>(a.Name); if (form.TableName.IsEmpty()) { form.TableName = dataForm.TableName; } if (form.TableName.IsEmpty()) { form.TableName = form.DataPlug.InstanceByPage <IListDataTable>(a.Name).RegName; } if (a.Name.IsEmpty()) { a.Name = dataForm.Name; } if (a.Name.IsEmpty()) { a.Name = form.TableName; } a.Width = form.Width; string msg = string.Format("数据源为{0}插件的form的名称不能为空", form.DataPlug); AtawDebug.AssertNotNullOrEmpty(form.Name, msg, this); if (a.Title.IsEmpty()) { a.Title = dataForm.Title; } if (a.Title.IsEmpty()) { a.Title = moduleConfig.Title; } } if (a is MvcFormConfig) { var mvcForm = a as MvcFormConfig; AtawDebug.AssertNotNull(mvcForm.DataRoute, "MvcForm需要配置DataRoute", this); var dataRoute = AtawAppContext.Current.MvcConfigXml.DataRoutes.FirstOrDefault(route => route.Name == mvcForm.DataRoute.Name); if (dataRoute != null) { mvcForm.DataRoute.ActionName = dataRoute.ActionName; mvcForm.DataRoute.ControlName = dataRoute.ControlName; mvcForm.DataRoute.AreaName = dataRoute.AreaName; mvcForm.DataRoute.NameSpace = dataRoute.NameSpace; } else { if (mvcForm.DataRoute.ControlName.IsEmpty()) { AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.ControlName, "DataRoute的ControlName不能为空", this); } if (mvcForm.DataRoute.ActionName.IsEmpty()) { AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.ActionName, "DataRoute的ActionName不能为空", this); } if (mvcForm.DataRoute.AreaName.IsEmpty()) { AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.AreaName, "DataRoute的AreaName不能为空", this); } if (mvcForm.DataRoute.NameSpace.IsEmpty()) { AtawDebug.AssertNotNullOrEmpty(mvcForm.DataRoute.NameSpace, "DataRoute的NameSpace不能为空", this); } } } }); #endregion #region 主从表批量修改或显示明细时,现只针对主表操作 if (PostDataSet != null && PostDataSet.Tables.Count > 0) { DataTable dt = PostDataSet.Tables["_KEY"]; if (dt != null) { if (dt.Rows.Count > 1) { moduleConfig.Mode = ModuleMode.Single; } //else if (dt.Rows.Count == 1) // BasePageView.KeyValue = dt.Rows[0][0].ToString(); var keyValueList = new List <string>(); foreach (DataRow row in dt.Rows) { string _key = row["KeyValue"].ToString(); keyValueList.Add(_key); } BasePageView.KeyValue = String.Join <string>(",", keyValueList); } } #endregion if (FormName.IsEmpty()) { if (moduleConfig.Mode == ModuleMode.Single || moduleConfig.Mode == ModuleMode.MasterDetail || moduleConfig.Mode == ModuleMode.SingleToSingle) { var form = FormConfigs.FirstOrDefault(a => a.IsMainTable); var mainForm = form == null?FormConfigs.FirstOrDefault() : form; //若没有配置主表,则指定第一个为主表 mainForm.IsMainTable = true; switch (PageStyle) { case PageStyle.List: moduleConfig.Forms.Clear(); mainForm.HasSearch = true; moduleConfig.Forms.Add(mainForm); moduleConfig.HasReview = mainForm.HasReview; break; case PageStyle.Insert: case PageStyle.Update: case PageStyle.Review: case PageStyle.Detail: mainForm.FormType = FormType.Normal; if (moduleConfig.Mode == ModuleMode.Single) { moduleConfig.Forms.Clear(); moduleConfig.Forms.Add(mainForm); moduleConfig.HasReview = mainForm.HasReview; } else { //var detailForms = FormConfigs.Where(a => !a.IsMainTable); //foreach (FormConfig item in detailForms) //{ // item.FormType = FormType.Grid; //} } break; } } } else { var form = moduleConfig.Forms.Find(a => a.Name == FormName); AtawDebug.AssertNotNull(form, string.Format(ObjectUtil.SysCulture, "请求的formname: {0}不存在,请检查xml文件是否有问题", FormName), this); //var mainForm = form == null ? moduleConfig.Forms.First() : form;//若没有配置主表,则指定第一个为主表 //if (PageStyle == PageStyle.Insert || PageStyle == PageStyle.Detail || PageStyle == PageStyle.Update) //{ // mainForm.FormType = FormType.Normal; //} //if (moduleConfig.Mode == ModuleMode.Single) //{ moduleConfig.Forms.Clear(); moduleConfig.Forms.Add(form); // } } return(moduleConfig); }
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); }