public void DeleteAppTable(AppTable appTable) { if (DbContext.Entry(appTable).State != System.Data.Entity.EntityState.Detached) { DbContext.Entry(appTable).State = System.Data.Entity.EntityState.Deleted; } else { DbContext.AppTables.Attach(appTable); DbContext.AppTables.Remove(appTable); } }
public void Add(AppTable appTable) { string path = string.Format(@"{0}/Resources/{1}.xml", Application.dataPath, configPath); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(path); var root = xmlDocument.DocumentElement; var script = xmlDocument.CreateElement("AppTable"); script.SetAttribute("TableName", appTable.TableName); script.InnerText = appTable.TablePath; root.AppendChild(script); xmlDocument.Save(path); }
private void OnGUI() { EditorGUILayout.Space(); GUILayout.Label(new GUIContent("AppTableConfig"), titleStyle); EditorGUILayout.Space(); EditorGUILayout.BeginVertical(); EditorGUILayout.Space(); if (config.AppTable.Count > 0) { for (int i = 0; i < config.AppTable.Count; i++) { EditorGUILayout.BeginHorizontal(titleStyle); GUILayout.Label(new GUIContent("AppTable"), titleStyle); GUILayout.Label("1.TableName"); config.AppTable[i].TableName = EditorGUILayout.TextField(config.AppTable[i].TableName); GUILayout.Label("2.TablePath"); config.AppTable[i].TablePath = EditorGUILayout.TextField(config.AppTable[i].TablePath); if (GUILayout.Button("Remove", titleStyle)) { if (config.AppTable.Count > 1) { Remove(i); config.AppTable.RemoveAt(i); } else { Debug.Log("不能删除最后一个Table"); } } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.Space(); if (GUILayout.Button("Add New Table")) { AppTable appTable = new AppTable { TableName = "TestTableData", TablePath = "Table/Test/TestTableData", }; Add(appTable); config.AppTable.Add(appTable); } if (GUILayout.Button("UpdateConfig")) { UpdateConfig(); } EditorGUILayout.EndVertical(); }
public AppHistory(AppTable tableId, AppHistoryType type, int userId, int?elementId = null, string description = null) { TableId = tableId; Type = type; UserId = userId; DateTime = DateTime.Now; ElementId = elementId; if (description != null) { if (description.Length > 200) { description = description.Substring(0, 200); } Description = description; } }
/// <exception cref="T:System.ArgumentOutOfRangeException"></exception> public AppHistory(AppTable tableId, AppHistoryType type, int?elementId = null, string description = null) { TableId = tableId; Type = type; DateTime = DateTime.Now; ElementId = elementId; if (description == null) { return; } if (description.Length > 199) { description = description.Substring(0, 199); } Description = description; }
public void UpdateAppTable(AppTable appTable) { DbContext.AppTables.AttachAsModified(appTable, ChangeSet.GetOriginal(appTable), DbContext); }
public void InsertAppTable(AppTable appTable) { DbContext.AppTables.Add(appTable); }