Exemple #1
0
        public static AscommStatus GetAscommStatus(string client, string line)
        {
            using (DB db = new DB(GetConnectionString()))
            {
                AscommStatus status =  (from o in db.AscommStatuses
                                        where o.Client == client
                                        && o.Line == line
                                    select o).FirstOrDefault();

                if (status == null)
                {
                    status = new AscommStatus();
                    status.Client = Filter_Client;
                    status.LastPing = DateTime.Now;
                    status.Line = line;
                    status.Status = false;

                    db.AddToAscommStatuses(status);

                    db.SaveChanges();
                }

                return status;
            }
        }
Exemple #2
0
        public static void UpdateAscommPing(string client, DateTime date, string line, bool s)
        {
            using (DB db = new DB(GetConnectionString()))
            {
                AscommStatus status = (from o in db.AscommStatuses
                                       where o.Client == client
                                       && o.Line == line
                                       select o).FirstOrDefault();

                if (status == null)
                {
                    status = new AscommStatus();

                    status.Client = client;
                    status.LastPing = DateTime.Now;
                    status.Status = s;
                    status.Line = line;

                    db.AddToAscommStatuses(status);
                }
                else
                {
                    status.Status = s;
                    status.LastPing = date;
                }

                db.SaveChanges();
            }
        }