Ejemplo n.º 1
0
        public bool Ping(string client, string line, bool s)
        {
            using (DB db = new DB())
            {
                AscommStatus status = (from o in db.AscommStatuses
                                       where o.Client == client
                                       && o.Line == line
                                       select o).FirstOrDefault();

                if (status != null)
                {
                    status.LastPing = DateTime.Now;
                    status.Status = s;
                    status.Line = line;
                }
                else
                {
                    status.Client = client;
                    status.LastPing = DateTime.Now;
                    status.Status = s;
                    status.Line = line;

                    db.AddToAscommStatuses(status);
                }

                return db.SaveChanges() > 0;
            }
        }