Exemplo n.º 1
0
 public void AddBatch(Batch Batch)
 {
     using (var db = new WeighrContext())
     {
         db.Batches.Add(Batch);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void UpdateShiftTarget(ShiftTarget shiftTarget)
 {
     using (var db = new WeighrContext())
     {
         db.ShiftTargets.Update(shiftTarget);
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void AddShiftTarget(ShiftTarget shiftTarget)
 {
     using (var db = new WeighrContext())
     {
         db.ShiftTargets.Add(shiftTarget);
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void UpdateTransactionLog(TransactionLog transactionLog)
 {
     using (var db = new WeighrContext())
     {
         db.TransactionLogs.Update(transactionLog);
         db.SaveChanges();
     }
 }
Exemplo n.º 5
0
        public void DeleteDeviceInfo()
        {
            using (var db = new WeighrContext())
            {
                var dev = db.DeviceInfos.FirstOrDefault();

                if (dev != null)
                {
                    db.DeviceInfos.Remove(dev);
                    db.SaveChanges();
                }
            }
        }
Exemplo n.º 6
0
        public ScaleConfig ZeroScale(decimal offset)
        {
            using (var db = new WeighrContext())
            {
                var current = db.ScaleConfigs.FirstOrDefault();
                // current.offset = offset;

                db.ScaleConfigs.Update(current);
                db.SaveChanges();

                return(current);
            }
        }
Exemplo n.º 7
0
        public Product SetCurrentProduct(string productCode)
        {
            using (var db = new WeighrContext())
            {
                var previousCurrent = db.Products
                                      .Where(p => p.isCurrent == true).FirstOrDefault();

                if (previousCurrent != null)
                {
                    previousCurrent.isCurrent = false;
                    db.Products.Update(previousCurrent);
                }


                var current = db.Products
                              .Where(p => p.ProductCode == productCode).FirstOrDefault();

                current.isCurrent = true;
                db.Products.Update(current);
                db.SaveChanges();

                return(current);
            }
        }