Example #1
0
 /// <summary>
 /// 转移,扔回呼叫资源池
 /// </summary>
 /// <param name="call"></param>
 /// <returns></returns>
 public bool Transfer(TCallModel call)
 {
     try
     {
         this.db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
         call.state   = 2;
         call.sysFlag = 1;
         this.Update(call);
         TQueueDAL dal   = new TQueueDAL(this.db);
         var       model = dal.GetModel(call.qId);
         model.state   = 0;
         model.sysFlag = 1;
         dal.Update(model);
         this.db.Session.CommitTransaction();
         return(true);
     }
     catch
     {
         this.db.Session.RollbackTransaction();
         return(false);
     }
     finally
     {
         this.db.Dispose();
     }
 }
Example #2
0
 /// <summary>
 /// 全部弃号
 /// </summary>
 public List <TCallModel> GiveUpAll()
 {
     try
     {
         List <TCallModel> tList = new List <TCallModel>();
         this.db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
         var lineQueue = db.Query <TQueueModel>().Where(q => q.state == 0).ToList();
         var qDal      = new TQueueDAL(this.db);
         foreach (var q in lineQueue)
         {
             q.state   = 1;
             q.sysFlag = 1;
             qDal.Update(q);
         }
         var list = db.Query <TCallModel>().Where(q => (q.state == 0 || q.state == 3)).ToList();
         foreach (var l in list)
         {
             l.state   = -1;
             l.sysFlag = 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 #3
0
 /// <summary>
 /// 按窗口全部弃号
 /// </summary>
 /// <returns></returns>
 public List <TCallModel> GiveUpAll(List <TWindowBusinessModel> windowBusys)
 {
     try
     {
         List <TCallModel> tList = new List <TCallModel>();
         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 <TQueueModel>().Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0).ToList();
         var qDal      = new TQueueDAL(this.db);
         foreach (var q in lineQueue)
         {
             q.state   = 1;
             q.sysFlag = 1;
             qDal.Update(q);
         }
         var list = db.Query <TCallModel>().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;
             l.sysFlag = 1;
             this.Update(l);
             tList.Add(l);
         }
         this.db.Session.CommitTransaction();
         return(tList);
     }
     catch
     {
         this.db.Session.RollbackTransaction();
         return(null);
     }
     finally
     {
         this.db.Dispose();
     }
 }