Example #1
0
 /// <summary>
 /// 按窗口全部弃号
 /// </summary>
 /// <returns></returns>
 public List <BCallModel> GiveUpAll(List <TWindowBusinessModel> windowBusys)
 {
     try
     {
         List <BCallModel> tList = new List <BCallModel>();
         this.db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
         var busyList  = windowBusys.Select(w => w.busiSeq).ToList();
         var unitList  = windowBusys.Select(w => w.unitSeq).ToList();
         var lineQueue = db.Query <BQueueModel>().Where(a => a.AreaNo == this.areaNo).Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0).ToList();
         var qDal      = new BQueueDAL(this.db, this.areaNo);
         foreach (var q in lineQueue)
         {
             q.state = 1;
             qDal.Update(q);
         }
         var list = db.Query <BCallModel>().Where(a => a.AreaNo == this.areaNo).Where(q => busyList.Contains(q.busiSeq) && unitList.Contains(q.unitSeq) && (q.state == 0 || q.state == 3)).ToList();
         foreach (var l in list)
         {
             l.state = -1;
             this.Update(l);
             tList.Add(l);
         }
         this.db.Session.CommitTransaction();
         return(tList);
     }
     catch
     {
         this.db.Session.RollbackTransaction();
         return(null);
     }
     finally
     {
         this.db.Dispose();
     }
 }
Example #2
0
 /// <summary>
 /// 转移,扔回呼叫资源池
 /// </summary>
 /// <param name="call"></param>
 /// <returns></returns>
 public bool Transfer(BCallModel call)
 {
     try
     {
         this.db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
         call.state      = 2;
         call.finishTime = DateTime.Now;
         this.Update(call);
         BQueueDAL dal   = new BQueueDAL(this.db, this.areaNo);
         var       model = dal.GetModel(call.qId);
         model.state = 0;
         dal.Update(model);
         this.db.Session.CommitTransaction();
         return(true);
     }
     catch
     {
         this.db.Session.RollbackTransaction();
         return(false);
     }
     finally
     {
         db.Session.Dispose();
     }
 }
Example #3
0
 /// <summary>
 /// 全部弃号
 /// </summary>
 public List <BCallModel> GiveUpAll()
 {
     try
     {
         List <BCallModel> tList = new List <BCallModel>();
         this.db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
         var lineQueue = db.Query <BQueueModel>().Where(a => a.AreaNo == this.areaNo).Where(q => q.state == 0).ToList();
         var qDal      = new BQueueDAL(this.db, this.areaNo);
         foreach (var q in lineQueue)
         {
             q.state = 1;
             qDal.Update(q);
         }
         var list = db.Query <BCallModel>().Where(a => a.AreaNo == this.areaNo).Where(q => (q.state == 0 || q.state == 3)).ToList();
         foreach (var l in list)
         {
             l.state = -1;
             this.Update(l);
             tList.Add(l);
         }
         this.db.Session.CommitTransaction();
         return(tList);
     }
     catch
     {
         this.db.Session.RollbackTransaction();
         return(null);
     }
     finally
     {
         this.db.Dispose();
     }
 }
Example #4
0
 /// <summary>
 /// 全部弃号
 /// </summary>
 public List <BCallModel> GiveUpAll()
 {
     try
     {
         List <BCallModel> tList = new List <BCallModel>();
         this.db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
         var lineQueue = db.Query <BQueueModel>().Where(a => a.AreaNo == this.areaNo).Where(q => q.state == 0).ToList();
         var qDal      = new BQueueDAL(this.db, this.areaNo);
         foreach (var q in lineQueue)
         {
             q.state = 1;
             qDal.Update(q);
         }
         var list = db.Query <BCallModel>().Where(a => a.AreaNo == this.areaNo).Where(q => (q.state == 0 || q.state == 3)).ToList();
         foreach (var l in list)
         {
             l.finishTime = DateTime.Now;
             l.state      = -1;
             this.Update(l);
             tList.Add(l);
         }
         this.db.Session.CommitTransaction();
         return(tList);
     }
     catch (Exception ex)
     {
         this.db.Session.RollbackTransaction();
         if (ex.InnerException != null)
         {
             File.AppendAllText(AppDomain.CurrentDomain.BaseDirectory + "s_Exception.txt", ex.InnerException.Message + "\r\n" + ex.InnerException.StackTrace + "\r\n");
             throw ex.InnerException;
         }
         throw ex;
     }
     finally
     {
         this.db.Session.Dispose();
     }
 }