/// <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(); } }
/// <summary> /// 叫号 * 已弃用 /// </summary> /// <param name="wlBusy"></param> /// <param name="windowNumber"></param> /// <param name="windowUser"></param> /// <returns></returns> public TCallModel CallNo(List <TWindowBusinessModel> wlBusy, string windowNumber, string windowUser) { try { var busyList = wlBusy.Select(w => w.busiSeq).ToList(); var unitList = wlBusy.Select(w => w.unitSeq).ToList(); this.db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); var date = DateTime.Now; var lineFirst = db.Query <TQueueModel>().Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date && q.appType == 1 && q.reserveStartTime <= date && q.reserveEndTime >= date).OrderBy(o => o.id).FirstOrDefault(); TQueueModel line = null; if (lineFirst == null) { var lineQueue = db.Query <TQueueModel>().Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date).OrderBy(o => o.id).ToList();//取到当天 窗口业务排队队列 line = lineQueue.FirstOrDefault(); if (line == null) { return(null); } } else { line = lineFirst; } line.state = 1; line.sysFlag = 1; new TQueueDAL(this.db).Update(line); var call = new TCallModel(); call.busiSeq = line.busTypeSeq; call.handleId = DateTime.Now.ToString("yyyyMMddHHmmss"); call.handleTime = DateTime.Now; call.idCard = line.idCard; call.qId = line.id; call.qNmae = line.qNmae; call.state = 0; call.ticketNumber = line.ticketNumber; call.ticketTime = line.ticketTime; call.unitSeq = line.unitSeq; call.windowNumber = windowNumber; call.windowUser = windowUser; call.sysFlag = 0; var ret = this.Insert(call); this.db.Session.CommitTransaction(); return(ret); } catch { this.db.Session.RollbackTransaction(); return(null); } finally { this.db.Dispose(); } }
/// <summary> /// 叫号 ** 已弃用 /// </summary> /// <param name="unitSeq"></param> /// <param name="busiSeq"></param> /// <param name="windowNumber"></param> /// <param name="windowUser"></param> /// <returns></returns> public TCallModel CallNo(string unitSeq, string busiSeq, string windowNumber, string windowUser) { try { this.db.Session.BeginTransaction(System.Data.IsolationLevel.ReadCommitted); var lineQueue = db.Query <TQueueModel>().Where(q => q.busTypeSeq == busiSeq && q.unitSeq == unitSeq && q.state == 0 && q.ticketTime.Date == DateTime.Now.Date).OrderBy(o => o.id).ToList();//取到当天 窗口业务排队队列 var line = lineQueue.FirstOrDefault(); if (line == null) { return(null); } line.state = 1; line.sysFlag = 1; new TQueueDAL(this.db).Update(line); var call = new TCallModel(); call.busiSeq = line.busTypeSeq; call.handleId = DateTime.Now.ToString("yyyyMMddHHmmss"); call.handleTime = DateTime.Now; call.idCard = line.idCard; call.qId = line.id; call.qNmae = line.qNmae; call.state = 0; call.ticketNumber = line.ticketNumber; call.ticketTime = line.ticketTime; call.unitSeq = line.unitSeq; call.windowNumber = windowNumber; call.windowUser = windowUser; call.sysFlag = 0; var ret = this.Insert(call); this.db.Session.CommitTransaction(); return(ret); } catch { this.db.Session.RollbackTransaction(); return(null); } finally { this.db.Dispose(); } }
public int Delete(TCallModel model) { return(this.db.Delete(model)); }
public int Update(TCallModel model) { return(this.db.Update(model)); }
public TCallModel Insert(TCallModel model) { return(db.Insert(model)); }
/// <summary> /// 叫号 * 加入绿色通道插队 /// </summary> /// <param name="wlBusy"></param> /// <param name="gwlBusy"></param> /// <param name="windowNumber"></param> /// <param name="windowUser"></param> /// <returns></returns> public TCallModel CallNo(List <TWindowBusinessModel> wlBusy, List <TWindowBusinessModel> gwlBusy, string windowNumber, string windowUser) { TCallModel tcModel = null; try { LockAction.Run(LockKey.Call, () => { if (gwlBusy == null) { gwlBusy = new List <TWindowBusinessModel>(); } var busyList = wlBusy.Select(w => w.busiSeq).ToList(); var unitList = wlBusy.Select(w => w.unitSeq).ToList(); var gbList = gwlBusy.Select(w => w.busiSeq).ToList(); var guList = gwlBusy.Select(w => w.unitSeq).ToList(); var date = DateTime.Now; TQueueModel line = null; var lineGreen = db.Query <TQueueModel>().Where(q => gbList.Contains(q.busTypeSeq) && guList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date).OrderBy(o => o.id).FirstOrDefault(); if (lineGreen == null) { var lineFirst = db.Query <TQueueModel>().Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date && ( (q.appType == 1 && q.type == 0 && q.reserveStartTime <= date && q.reserveEndTime >= date) || q.type == 1)).OrderBy(o => o.id).FirstOrDefault(); if (lineFirst == null) { var lineQueue = db.Query <TQueueModel>().Where(q => busyList.Contains(q.busTypeSeq) && unitList.Contains(q.unitSeq) && q.state == 0 && q.ticketTime.Date == date.Date).OrderBy(o => o.id).ToList();//取到当天 窗口业务排队队列 line = lineQueue.FirstOrDefault(); if (line == null) { return; } } else { line = lineFirst; } } else { line = lineGreen; } line.state = 1; line.sysFlag = 1; new TQueueDAL(this.db).Update(line); var call = new TCallModel(); call.busiSeq = line.busTypeSeq; call.handleId = DateTime.Now.ToString("yyyyMMddHHmmss"); call.handleTime = DateTime.Now; call.idCard = line.idCard; call.qId = line.id; call.qNmae = line.qNmae; call.reserveSeq = line.reserveSeq; call.state = 0; call.ticketNumber = line.ticketNumber; call.ticketTime = line.ticketTime; call.unitSeq = line.unitSeq; call.windowNumber = windowNumber; call.windowUser = windowUser; call.sysFlag = 0; var ret = this.Insert(call); tcModel = ret; }); } catch { return(null); } return(tcModel); }
public TCallModel Insert(TCallModel model) { return(this.dal.Insert(model)); }
public bool Transfer(TCallModel call) { return(new TCallDAL().Transfer(call)); }