Пример #1
0
        public string Color(string Station)
        {
            QueueDetail detail = this.QueueDetails.FirstOrDefault(c => c.Station == EnumStation.ARK);

            if (detail != null)
            {
                if (Station == EnumStation.ARK)
                {
                    if (detail.Status == EnumQueueStatuses.Errors)
                    {
                        return(EnumColors.Red);
                    }
                    else
                    {
                        return(EnumColors.Green);
                    }
                }
                else if (Station == EnumStation.APS)
                {
                    if (this.Appointment_ID.HasValue)
                    {
                        return(EnumColors.Green);
                    }
                    else
                    {
                        return(EnumColors.Notrequired);
                    }
                }
            }
            return(EnumColors.Grey);
        }
Пример #2
0
        public DBContext.Queue UpdateQueueStatusByUserId(string userId, string currentStation, string statusCurrentStattion, string nextStation, string statusNextStation, string messageNextStation, string outcome)
        {
            DBContext.Queue dbQueue = _localUnitOfWork.DataContext.Queues.Include("Appointment").FirstOrDefault(d => d.UserId == userId && DbFunctions.TruncateTime(d.CreatedTime).Value == DateTime.Today);

            if (dbQueue == null)
            {
                return(null);
            }

            dbQueue.CurrentStation = nextStation;
            if (!string.IsNullOrEmpty(outcome))
            {
                dbQueue.Outcome = outcome;
            }
            DBContext.QueueDetail dbQueueDetailCurrent = _localUnitOfWork.DataContext.QueueDetails.FirstOrDefault(d => d.Queue_ID == dbQueue.Queue_ID && d.Station == currentStation);
            if (dbQueueDetailCurrent != null)
            {
                dbQueueDetailCurrent.Status = statusCurrentStattion;
                _localUnitOfWork.GetRepository <DBContext.QueueDetail>().Update(dbQueueDetailCurrent);
            }

            DBContext.QueueDetail dbQueueDetailNextStation = _localUnitOfWork.DataContext.QueueDetails.FirstOrDefault(d => d.Queue_ID == dbQueue.Queue_ID && d.Station == nextStation);
            if (dbQueueDetailNextStation != null)
            {
                dbQueueDetailNextStation.Status  = statusNextStation;
                dbQueueDetailNextStation.Message = messageNextStation;

                _localUnitOfWork.GetRepository <DBContext.QueueDetail>().Update(dbQueueDetailNextStation);
            }

            _localUnitOfWork.GetRepository <DBContext.Queue>().Update(dbQueue);

            _localUnitOfWork.Save();

            return(dbQueue);
        }