Esempio n. 1
0
 public async void InsertNode(NodeDetails node)
 {
     try
     {
         using (var context = new SqlDataModel(_connectionString))
         {
             context.NodeDetails.Add(node);
             await context.SaveChangesAsync();
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex);
     }
 }
Esempio n. 2
0
 public async void InsertMaster(MasterDetails master)
 {
     try
     {
         using (var context = new SqlDataModel(_connectionString))
         {
             context.MasterDetail.Add(master);
             await context.SaveChangesAsync();
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex);
     }
 }
Esempio n. 3
0
        public List <NodeDetails> GetLiveNodes()
        {
            List <NodeDetails> nodes = null;

            try
            {
                using (var context = new SqlDataModel(_connectionString))
                {
                    nodes = context.NodeDetails.Where(n => n.IsAlive).ToList();
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex);
            }
            return(nodes);
        }
Esempio n. 4
0
        public MasterDetails GetLiveMasterDetails()
        {
            MasterDetails master = null;

            try
            {
                using (var context = new SqlDataModel(_connectionString))
                {
                    master = context.MasterDetail.FirstOrDefault(m => m.IsAlive);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex);
            }
            return(master);
        }
Esempio n. 5
0
 public async void DeclareNodeDead(NodeDetails node)
 {
     try
     {
         using (var context = new SqlDataModel(_connectionString))
         {
             node.IsAlive           = false;
             node.DeadDeclairedDate = DateTime.UtcNow.ToShortTimeString();
             context.NodeDetails.Add(node);
             await context.SaveChangesAsync();
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex);
     }
 }
Esempio n. 6
0
        public NodeDetails GetNode(string nodeId)
        {
            NodeDetails node = null;

            try
            {
                using (var context = new SqlDataModel(_connectionString))
                {
                    node = context.NodeDetails.FirstOrDefault(n => n.IsAlive);
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex);
            }
            return(node);
        }