public GFiles(BBS bbs, BBSDataCore bbsDataCore) { _bbs = bbs; _bbsDataCore = bbsDataCore; _bbs.currentArea = "GFiles"; _currentGFileArea = null; _bbs.SendFileForTermType("gfile_entry_root", false); CmdList(); }
public GFileArea CreateGFileArea(string title, string description, int?parentAreaId) { var gfileArea = new GFileArea() { Title = title, Description = description, ParentAreaId = parentAreaId }; _bbsDataContext.GFileAreas.Add(gfileArea); _bbsDataContext.SaveChanges(); return(gfileArea); }
public GFileArea GetGFileArea(int id) { GFileArea result = null; try { result = _bbsDataContext.GFileAreas.FirstOrDefault(p => p.Id == id); } catch (Exception e) { LoggingAPI.Error(e); result = null; } return(result); }
public int GFile_ParentArea(int area) { int i = -1; try { GFileArea gfa = _bbsDataContext.GFileAreas.FirstOrDefault(p => p.Id.Equals(area)); if (gfa != null) { i = gfa.ParentAreaId == null?-1:(int)gfa.ParentAreaId; } } catch (Exception e) { LoggingAPI.LogEntry("Exception in DataInterface.GFile_ParentArea: " + e.Message); } return(i); }
public static int GFile_ParentArea(int area) { int i = -1; try { BBSDataContext bbs = new BBSDataContext(); GFileArea gfa = bbs.GFileAreas.FirstOrDefault(p => p.GFileAreaId.Equals(area)); if (gfa != null) { i = gfa.ParentAreaId; } } catch (Exception e) { LoggingAPI.LogEntry("Exception in DataInterface.GFile_ParentArea: " + e.Message); } return(i); }
public void CmdAreaChange(int?areaId) { //Select Area if (areaId == null) { _currentGFileArea = null; } else { _currentGFileArea = _bbsDataCore.GetGFileArea((int)areaId); } if (areaId == null) { _bbs.SendFileForTermType("gfile_entry_root", true); } else { _bbs.SendFileForTermType("gfile_entry_" + _currentGFileArea.Id.ToString(), true); } CmdList(); }
private static void SetupGFileAreas() { var quitFlag = false; while (!quitFlag) { GFileHeader(); if (currentArea != null) { Console.WriteLine("0. Navigate To Parent Area"); } Console.WriteLine("1. Add Child Area"); if (currentArea != null) { Console.WriteLine("2. Edit This Area"); Console.WriteLine("3. Delete This Area"); } if (gfileAreas.Any(p => p.ParentAreaId == currentArea?.Id) || (currentArea == null && gfileAreas.Any())) { Console.WriteLine("4. Navigate To Child Area"); } Console.WriteLine("I. Import Here."); Console.WriteLine("Q. Quit To Main Menu"); var choice = Console.ReadLine(); switch (choice.ToString().ToUpper()) { case "0": //Change to parent area currentArea = gfileAreas.FirstOrDefault(p => p.Id == currentArea.ParentAreaId); break; case "1": CreateGFileArea(); break; case "2": //NOT IMPLEMENTED break; case "3": //NOT IMPLEMENTED break; case "4": int areaId = 0; if (int.TryParse(Input("Enter the Id of the area to navigate to: ", ""), out areaId)) { currentArea = gfileAreas.FirstOrDefault(p => p.Id == areaId); } break; case "I": ImportGFiles(); break; case "Q": quitFlag = true; break; default: break; } } }