public DataGrid Addattachment() { Models.DGObjectDef dGObject = standard.GetDGObjectDefByName(dataTable.TableName); int rowNum = 0; foreach (DataRow row in dataTable.Rows) { try { int columnNum = 0; foreach (Models.PropertyMeta meta in dGObject.PropertyContainer) { if (meta.LangStr.Contains("关联")) { AddButton(rowNum, columnNum); } columnNum++; } } catch (Exception ex) { System.Windows.MessageBox.Show(ex.ToString()); } rowNum++; } return(DataDG); }
public DataGrid RefreshStyle() { Models.DGObjectDef dGObject = standard.GetDGObjectDefByName(dataTable.TableName); int rowNum = 0; foreach (DataRow row in dataTable.Rows) { try { if (rowNum == 0) { rowNum = 1; continue; } int columnNum = 0; foreach (Models.PropertyMeta meta in dGObject.PropertyContainer) { if (meta.RegularExp != null) { var data = row[meta.LangStr].ToString(); bool reult1 = (data != "" & data != null); bool result = Regex.IsMatch(row[meta.LangStr].ToString(), meta.RegularExp); if (reult1 & !result) { Check(rowNum, columnNum); } if ((meta.IsKey == true | meta.Nullable == false) & (row[meta.LangStr].ToString() == null | row[meta.LangStr].ToString() == "")) { CheckIfEmpty(rowNum, columnNum); } } else if ((meta.IsKey == true | meta.Nullable == false) & (row[meta.LangStr].ToString() == null | row[meta.LangStr].ToString() == "")) { CheckIfEmpty(rowNum, columnNum); } columnNum++; } } catch (Exception ex) { rowNum++; continue; } rowNum++; } return(DataDG); }