public void Log(CSCloudLogEntry logEntry) { using (CSCloudEntities db = new CSCloudEntities()) { db.Logs.Add(LogToModel(logEntry)); db.SaveChanges(); } }
public CSCloudLogEntry[] GetLog() { using (CSCloudEntities db = new CSCloudEntities()) { var logEntries = new List<CSCloudLogEntry>(db.Logs.Count()); foreach (var l in db.Logs) { logEntries.Add(ModelToLogEntry(l)); } return logEntries.ToArray(); } }
private void saveResponse(string clientName, CSCloudResponse response) { try { using (CSCloudEntities db = new CSCloudEntities()) { db.Commands.Add(CommandToModel(clientName, response.Request.Command, response.Result)); db.SaveChanges(); } } catch { } }
public CSCloudCommandRecord[] GetExecutedCommands() { using (CSCloudEntities db = new CSCloudEntities()) { var commands = new List<CSCloudCommandRecord>(db.Commands.Count()); foreach (var c in db.Commands) { commands.Add(ModelToCommandRecord(c)); } return commands.ToArray(); } }
public CSCloudClientRecord[] GetClients(bool OnlyActive) { using (CSCloudEntities db = new CSCloudEntities()) { var dbClients = db.Clients; var cls = new List<CSCloudClientRecord>(dbClients.Count()); foreach (var c in dbClients) { cls.Add(CreateClientRecord(c.Name, ((ICommunicationObject)c).State == CommunicationState.Opened)); } return OnlyActive ? cls.Where(c => c.IsActive).ToArray() : cls.ToArray(); } }