public void AddOrUpdateRange(List <DomDbModel> list)
        {
            lock (_lockObject)
            {
                using (var context = new ScadaDbContext())
                {
                    foreach (var model in list)
                    {
                        DomDbModel m = context.Dom.FirstOrDefault(d => !String.IsNullOrEmpty(d.Mrid) && d.Mrid == model.Mrid);

                        if (m == null)
                        {
                            context.Dom.Add(model);
                        }
                        else
                        {
                            m.ManipulationConut++;
                            m.TimeStamp            = DateTime.Now.ToString();
                            context.Entry(m).State = System.Data.Entity.EntityState.Modified;
                        }
                    }
                    context.SaveChanges();
                }
            }
        }
        public void Add(List <DomDbModel> list)
        {
            foreach (var model in list)
            {
                DomDbModel m = _context.Dom.FirstOrDefault(d => d.Mrid == model.Mrid);

                if (m == null)
                {
                    _context.Dom.Add(model);
                }
            }
            _context.SaveChanges();
        }
        public void UpdateSingle(DomDbModel model)
        {
            DomDbModel m = _context.Dom.FirstOrDefault(d => d.Mrid == model.Mrid);

            if (m != null)
            {
                m.ManipulationConut++;
                m.TimeStamp             = DateTime.Now.ToString();
                _context.Entry(m).State = System.Data.Entity.EntityState.Modified;
            }


            _context.SaveChanges();
        }
        public void AddOrUpdateRange(List <DomDbModel> list)
        {
            foreach (var model in list)
            {
                DomDbModel m = _context.Dom.FirstOrDefault(d => d.Mrid == model.Mrid);

                if (m == null)
                {
                    _context.Dom.Add(model);
                }
                else
                {
                    m.ManipulationConut++;
                    m.TimeStamp             = DateTime.Now.ToString();
                    _context.Entry(m).State = System.Data.Entity.EntityState.Modified;
                }
            }
            _context.SaveChanges();
        }
        public void Add(List <DomDbModel> list)
        {
            lock (_lockObject)
            {
                using (var context = new ScadaDbContext())
                {
                    foreach (var model in list)
                    {
                        DomDbModel m = context.Dom.FirstOrDefault(d => d.Mrid == model.Mrid);

                        if (m == null)
                        {
                            context.Dom.Add(model);
                        }
                    }
                    context.SaveChanges();
                }
            }
        }
        public void UpdateSingle(DomDbModel model)
        {
            lock (_lockObject)
            {
                using (var context = new ScadaDbContext())
                {
                    DomDbModel m = context.Dom.FirstOrDefault(d => !String.IsNullOrEmpty(d.Mrid) && d.Mrid == model.Mrid);

                    if (m != null)
                    {
                        m.ManipulationConut++;
                        m.TimeStamp            = DateTime.Now.ToString();
                        context.Entry(m).State = System.Data.Entity.EntityState.Modified;
                    }


                    context.SaveChanges();
                }
            }
        }
Exemple #7
0
 public void UpdateSingle(DomDbModel model)
 {
     repo.UpdateSingle(model);
 }
Exemple #8
0
 public void AddOrUpdate(DomDbModel model)
 {
     repo.AddOrUpdate(model);
 }
 public async Task UpdateSingle(DomDbModel model)
 {
     ServiceEventSource.Current.ServiceMessage(_context, "DomService - UpdateSingle");
     await Task.Factory.StartNew(() => { _repo.UpdateSingle(model); });
 }
Exemple #10
0
 public void UpdateSingle(DomDbModel model)
 {
     proxy.UpdateSingle(model);
 }
Exemple #11
0
 public void AddOrUpdate(DomDbModel model)
 {
     proxy.AddOrUpdate(model);
 }
Exemple #12
0
 public async Task UpdateSingle(DomDbModel model)
 {
     var client = BuildClient();
     await client.InvokeWithRetryAsync(x => x.Channel.UpdateSingle(model));
 }