Exemple #1
0
        public string SaveQCS(string heatseal, string type)
        {
            //The first condition is that the heatseal number has to be in the AutoSort.ArticleCode column and
            //slot blank
            AssemblyDB.AutoSort auto = dbassembly.AutoSorts.Where(au => au.ArticleCode == heatseal &&
                                                                  au.Slot == " ").SingleOrDefault();
            if (auto == null)
            {
                return(string.Empty);
            }
            QCSInfo qcs = dbBCS.QCSInfoes.Where(Q => Q.HeatSeal == heatseal).SingleOrDefault();

            if (qcs != null)   //if already there then update the type
            {
                qcs.Bin = type;
            }
            else
            {
                QCSInfo dbItem = new QCSInfo()
                {
                    HeatSeal = heatseal, Bin = type, Time = auto.DueDate
                };
                dbBCS.QCSInfoes.Add(dbItem);
            }
            try
            {
                dbBCS.SaveChanges();
            }
            catch (Exception e)
            {
                return(e.InnerException.Message);
            }
            return(string.Empty);
        }
Exemple #2
0
        public bool RemoveQCSInfoEntries(string heatseal)
        {
            QCSInfo qcs = dbBCS.QCSInfoes.Where(Q => Q.HeatSeal == heatseal).SingleOrDefault();

            if (qcs == null)
            {
                return(false);
            }
            dbBCS.QCSInfoes.Remove(qcs);
            dbBCS.SaveChanges();
            return(true);
        }
        public string SaveQCS(string heatseal, string location)
        {
            QCSInfo dbItem = new QCSInfo()
            {
                HeatSeal = heatseal, Bin = location, Time = DateTime.Now
            };

            db.QCSInfoes.Add(dbItem);
            try
            {
                db.SaveChanges();
            }
            catch (Exception e)
            {
                return(e.InnerException.Message);
            }
            return(string.Empty);
        }