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();
            }
        }
Пример #3
0
        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
            {

            }
        }
Пример #4
0
        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();
            }
        }
Пример #5
0
        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();
            }
        }