Exemple #1
0
        //要执行的方法
        private void ScanQueue()
        {
            try
            {
                using (CleanProcedureEntities db = new CleanProcedureEntities())
                {
                    while (ListQueue.Count > 0)
                    {
                        //从队列中取出
                        Clean_RecordList queueinfo = ListQueue.Dequeue();

                        Clean_RecordList find = db.Clean_RecordList.FirstOrDefault(model => model.Sequence == queueinfo.Sequence && model.StepNum == queueinfo.StepNum);
                        if (find != null)
                        {
                            //if(find.MaxNum==find.StepNum)
                            find.EndTime = queueinfo.EndTime;
                        }
                        else
                        {
                            db.Clean_RecordList.Add(queueinfo);
                        }
                    }
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                LogHelper.WriteLog(typeof(Exception), e);
                //throw;
            }
        }
Exemple #2
0
 public bool  AddEntity(Clean_RecordList entity)
 {
     using (CleanProcedureEntities db = new CleanProcedureEntities())
     {
         db.Clean_RecordList.Add(entity);
         if (db.SaveChanges() > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }