public async Task <Result <GetQueueLookupItemsResponse> > Handle(GetQueueLookupItemsCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var roomlist = await _queueUnitOfWork.Repository <Rooms>().Get(x => x.DeleteFlag == false).ToListAsync();

                    var priorities = await _queueUnitOfWork.Repository <LookupItemView>().Get(x => x.MasterName == "Priority").ToListAsync();

                    var servicePoints = await _queueUnitOfWork.Repository <LookupItemView>().Get(x => x.MasterName == "ServicePoint").ToListAsync();

                    var ServiceArea = await _queueUnitOfWork.Repository <ServiceArea>().Get(x => x.DeleteFlag == false).ToListAsync();


                    return(Result <GetQueueLookupItemsResponse> .Valid(new GetQueueLookupItemsResponse
                    {
                        Priority = priorities,
                        rooms = roomlist,
                        ServicePoint = servicePoints,
                        serviceAreas = ServiceArea
                    }));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    return(Result <GetQueueLookupItemsResponse> .Invalid(ex.Message));
                }
            }
        }
예제 #2
0
        public async Task <Result <EditQueueResponse> > Handle(EditQueueCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var editqueue = await _queueUnitOfWork.Repository <QueueWaitingList>().Get(x => x.Id == request.Id).FirstOrDefaultAsync();

                    if (editqueue != null)
                    {
                        editqueue.Status     = request.Status;
                        editqueue.DeleteFlag = request.DeleteFlag;
                        editqueue.UpdateDate = DateTime.Now;
                        editqueue.UpdatedBy  = request.UpdatedBy;
                        _queueUnitOfWork.Repository <QueueWaitingList>().Update(editqueue);
                        await _queueUnitOfWork.SaveAsync();

                        Id      = editqueue.Id;
                        updated = true;
                    }

                    return(Result <EditQueueResponse> .Valid(new EditQueueResponse()
                    {
                        Message = "The waitinglist has been updated successfully",
                        Id = Id,
                        Updated = true
                    }));
                }
                catch (Exception ex)
                {
                    return(Result <EditQueueResponse> .Invalid(ex.Message));
                }
            }
        }
        public async Task <Result <LinkageServiceRoomResponse> > Handle(LinkageServiceRoomCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    if (request.Linkagelist != null)
                    {
                        if (request.Linkagelist.Count > 0)
                        {
                            foreach (var link in request.Linkagelist)
                            {
                                var srvroom = await _queueUnitOfWork.Repository <ServiceRoom>().Get(x => x.ServiceAreaid == link.ServiceAreaId && x.ServicePointId == link.ServicePointId && x.RoomId == link.Roomid).FirstOrDefaultAsync();

                                if (srvroom != null)
                                {
                                    srvroom.RoomId         = link.Roomid;
                                    srvroom.ServiceAreaid  = link.ServiceAreaId;
                                    srvroom.ServicePointId = link.ServicePointId;
                                    srvroom.DeleteFlag     = false;
                                    srvroom.UpdateDate     = DateTime.Now;
                                    srvroom.UpdatedBy      = link.UserId;
                                    _queueUnitOfWork.Repository <ServiceRoom>().Update(srvroom);
                                    await _queueUnitOfWork.SaveAsync();
                                }

                                else
                                {
                                    ServiceRoom rm = new ServiceRoom();
                                    rm.RoomId         = link.Roomid;
                                    rm.ServiceAreaid  = link.ServiceAreaId;
                                    rm.ServicePointId = link.ServicePointId;
                                    rm.Active         = true;
                                    rm.CreateDate     = DateTime.Now;
                                    rm.CreatedBy      = link.UserId;

                                    await _queueUnitOfWork.Repository <ServiceRoom>().AddAsync(rm);

                                    await _queueUnitOfWork.SaveAsync();
                                }
                            }
                        }
                    }


                    return(Result <LinkageServiceRoomResponse> .Valid(new LinkageServiceRoomResponse()
                    {
                        Message = "The linkage was added successfully"
                    }));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    return(Result <LinkageServiceRoomResponse> .Invalid(ex.Message));
                }
            }
        }
예제 #4
0
        public async Task <Result <AddQueueResponse> > Handle(AddQueueCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    QueueWaitingList qwl = new QueueWaitingList();
                    qwl.PatientId     = request.PatientId;
                    qwl.Priority      = request.Priority;
                    qwl.ServiceRoomId = request.ServiceRoomId;
                    qwl.Status        = request.Status;
                    qwl.CreateDate    = DateTime.Now;
                    qwl.CreatedBy     = request.CreatedBy;

                    await _queueUnitOfWork.Repository <QueueWaitingList>().AddAsync(qwl);

                    await _queueUnitOfWork.SaveAsync();

                    return(Result <AddQueueResponse> .Valid(new AddQueueResponse()
                    {
                        PatientId = qwl.PatientId,
                        Message = "The Patient  has been added to the waiting List successfully"
                    }));
                }
                catch (Exception e)
                {
                    Log.Error(e.Message);
                    return(Result <AddQueueResponse> .Invalid(e.Message));
                }
            }
        }
예제 #5
0
        public async Task <Result <RoomExistResponse> > Handle(CheckRoomExistCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var RoomExists = await _queueUnitOfWork.Repository <Rooms>().Get(x => x.RoomName.Trim().ToLower() == request.RoomName.Trim().ToLower()).ToListAsync();

                    if (RoomExists.Count > 0)
                    {
                        message += "The room  already exists ";
                        exist    = true;
                    }
                    else
                    {
                        message += " The room does not exists";
                        exist    = false;
                    }

                    return(Result <RoomExistResponse> .Valid(new RoomExistResponse()
                    {
                        Message = message,
                        Rooms = RoomExists,
                        Exists = exist
                    }));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    return(Result <RoomExistResponse> .Invalid(ex.Message));
                }
            }
        }
        public async Task <Result <CheckQueueResponse> > Handle(CheckQueueExistCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var QueueExists = await _queueUnitOfWork.Repository <QueueWaitingList>().Get(x => x.PatientId == request.PatientId && x.DeleteFlag == false && x.Status == false).ToListAsync();

                    if (QueueExists.Count > 0)
                    {
                        message += "The room  already exists ";
                        exist    = true;
                    }
                    else
                    {
                        message += " The room does not exists";
                        exist    = false;
                    }

                    return(Result <CheckQueueResponse> .Valid(new CheckQueueResponse()
                    {
                        Message = message,
                        Exists = exist
                    }));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    return(Result <CheckQueueResponse> .Invalid(ex.Message));
                }
            }
        }
예제 #7
0
        public async Task <Result <RoomResultResponse> > Handle(AddRoomCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    Rooms rm = new Rooms();
                    rm.RoomName    = request.RoomName;
                    rm.DisplayName = request.DisplayName;
                    rm.CreateDate  = DateTime.Now;
                    rm.CreatedBy   = request.CreatedBy;
                    rm.Active      = request.Active;
                    rm.DeleteFlag  = request.DeleteFlag;
                    rm.Description = request.Description;

                    await _queueUnitOfWork.Repository <Rooms>().AddAsync(rm);

                    await _queueUnitOfWork.SaveAsync();

                    return(Result <RoomResultResponse> .Valid(new RoomResultResponse()
                    {
                        Id = rm.Id,
                        Message = "The room has been added successfully"
                    }));
                }
                catch (Exception e)
                {
                    Log.Error(e.Message);
                    return(Result <RoomResultResponse> .Invalid(e.Message));
                }
            }
        }
예제 #8
0
        public async Task <Result <GetLinkedRoomsResponse> > Handle(GetLinkedRoomsCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    sRoomView = new List <ServiceRoomView>();
                    sRoomView = await _queueUnitOfWork.Repository <ServiceRoomView>().Get(x => x.DeleteFlag == false).OrderByDescending(x => x.Id).ToListAsync();

                    sRoomView.ForEach(x =>
                    {
                        RoomServiceList rl = new RoomServiceList();
                        rl.Id   = x.Id;
                        rl.Name = x.ServiceAreaName + "-" + x.ServicePointName + "-" + x.RoomName;
                        RoomServiceLists.Add(rl);
                    });


                    return(Result <GetLinkedRoomsResponse> .Valid(new GetLinkedRoomsResponse()
                    {
                        ServiceRoomViews = sRoomView,
                        RoomServices = RoomServiceLists
                    }));
                }
                catch (Exception e)
                {
                    Log.Error(e.Message);
                    return(Result <GetLinkedRoomsResponse> .Invalid(e.Message));
                }
            }
        }
        public async Task <Result <GetRoomsAndServicePointResponse> > Handle(GetRoomsAndServicePointCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    if (request.ServiceArea != null)
                    {
                        sRoomView = new List <ServiceRoomView>();
                        sRoomView = await _queueUnitOfWork.Repository <ServiceRoomView>().Get(x => x.ServiceAreaId == request.ServiceArea).ToListAsync();
                    }


                    return(Result <GetRoomsAndServicePointResponse> .Valid(new GetRoomsAndServicePointResponse()
                    {
                        ServiceRoomViews = sRoomView
                    }));
                }
                catch (Exception e)
                {
                    Log.Error(e.Message);
                    return(Result <GetRoomsAndServicePointResponse> .Invalid(e.Message));
                }
            }
        }
        public async Task <Result <CheckLinkageServiceExistsResponse> > Handle(CheckLinkageServiceExistsCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var LinkageServiceArea = await _queueUnitOfWork.Repository <ServiceRoom>().Get(x => x.ServiceAreaid == request.ServiceAreaId && x.ServicePointId == request.ServicePointId && x.RoomId == request.RoomId && x.DeleteFlag == false).ToListAsync();

                    if (LinkageServiceArea.Count > 0)
                    {
                        servicerooms = LinkageServiceArea;
                        exist        = true;
                    }
                    else
                    {
                        exist = false;
                    }

                    return(Result <CheckLinkageServiceExistsResponse> .Valid(new CheckLinkageServiceExistsResponse()
                    {
                        Exists = exist,
                        ServiceRooms = servicerooms
                    }));
                }
                catch (Exception e)
                {
                    Log.Error(e.Message);
                    return(Result <CheckLinkageServiceExistsResponse> .Invalid(e.Message));
                }
            }
        }
        public async Task <Result <EditRoomsResponse> > Handle(EditRoomCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var RoomExists = await _queueUnitOfWork.Repository <Rooms>().Get(x => x.Id == request.Id).FirstOrDefaultAsync();

                    if (RoomExists != null)
                    {
                        RoomExists.RoomName    = request.RoomName;
                        RoomExists.DisplayName = request.DisplayName;
                        RoomExists.Description = request.Description;
                        RoomExists.UpdateDate  = DateTime.Now;
                        RoomExists.UpdatedBy   = request.UpdatedBy;
                        RoomExists.Active      = request.Active;
                        RoomExists.DeleteFlag  = request.DeleteFlag;

                        _queueUnitOfWork.Repository <Rooms>().Update(RoomExists);
                        await _queueUnitOfWork.SaveAsync();

                        message += "The Room details have been updated successfully";
                        id       = RoomExists.Id;
                    }

                    return(Result <EditRoomsResponse> .Valid(new EditRoomsResponse
                    {
                        Message = message,
                        RoomId = id
                    }));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    return(Result <EditRoomsResponse> .Invalid(ex.Message));
                }
            }
        }
예제 #12
0
        public async Task <Result <EditLinkageServiceRoomResponse> > Handle(EditLinkageServiceRoomCommand request, CancellationToken cancellationToken)
        {
            try
            {
                var serviceroomresult = _queueUnitOfWork.Repository <ServiceRoom>().Get(x => x.Id == request.Id).FirstOrDefault();

                if (serviceroomresult != null)
                {
                    serviceroomresult.RoomId         = request.RoomId;
                    serviceroomresult.ServiceAreaid  = request.ServiceAreaId;
                    serviceroomresult.ServicePointId = request.ServicePointId;
                    serviceroomresult.Active         = request.Active;
                    serviceroomresult.DeleteFlag     = request.DeleteFlag;
                    serviceroomresult.UpdateDate     = DateTime.Now;
                    serviceroomresult.UpdatedBy      = request.UpdatedBy;
                    serviceroomresult.DeleteFlag     = request.DeleteFlag;
                    _queueUnitOfWork.Repository <ServiceRoom>().Update(serviceroomresult);
                    await _queueUnitOfWork.SaveAsync();

                    id = serviceroomresult.Id;
                }



                return(Result <EditLinkageServiceRoomResponse> .Valid(new EditLinkageServiceRoomResponse()
                {
                    Message = "The data has been updated successfully",
                    Id = id,
                    Updated = true
                }));
            }
            catch (Exception ex)
            {
                return(Result <EditLinkageServiceRoomResponse> .Invalid(ex.Message));
            }
        }
예제 #13
0
        public async Task <Result <GetRoomByIdResponse> > Handle(GetRoomByIdCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var Rooms = await _queueUnitOfWork.Repository <Rooms>().Get(x => x.DeleteFlag == false && x.Id == request.Id).FirstOrDefaultAsync();

                    return(Result <GetRoomByIdResponse> .Valid(new GetRoomByIdResponse()
                    {
                        RoomsList = Rooms
                    }));
                }
                catch (Exception ex)
                {
                    return(Result <GetRoomByIdResponse> .Invalid(ex.Message));
                }
            }
        }
예제 #14
0
        public async Task <Result <GetServiceAreasResponse> > Handle(GetServiceAreasCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var ServiceArea = await _queueUnitOfWork.Repository <ServiceArea>().Get(x => x.DeleteFlag == false).ToListAsync();


                    return(Result <GetServiceAreasResponse> .Valid(new GetServiceAreasResponse
                    {
                        serviceAreas = ServiceArea
                    }));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    return(Result <GetServiceAreasResponse> .Invalid(ex.Message));
                }
            }
        }
        public async Task <Result <GetPrioritiesListResponse> > Handle(GetPrioritiesListCommand request, CancellationToken cancellationToken)
        {
            using (_queueUnitOfWork)
            {
                try
                {
                    var priorities = await _queueUnitOfWork.Repository <LookupItemView>().Get(x => x.MasterName == "Priority").ToListAsync();



                    return(Result <GetPrioritiesListResponse> .Valid(new GetPrioritiesListResponse
                    {
                        Priority = priorities,
                    }));
                }
                catch (Exception ex)
                {
                    Log.Error(ex.Message);
                    return(Result <GetPrioritiesListResponse> .Invalid(ex.Message));
                }
            }
        }
        public async Task <Result <GetQueueListByRoomsResponse> > Handle(GetQueueListByRoomIdCommand request, CancellationToken cancellationToken)
        {
            try
            {
                var sql = "exec pr_OpenDecryptedSession;" +
                          $"SELECT * FROM WaitingListView WHERE RoomId = {request.RoomId} order by PriorityRank asc,CreateDate desc; " +
                          $"exec [dbo].[pr_CloseDecryptedSession];";

                var result = await _queueUnitOfWork.Repository <WaitingListView>().FromSql(sql);

                var finalresult = result.ToList().Where(x => x.DeleteFlag == false && x.Status == false).ToList();

                return(Result <GetQueueListByRoomsResponse> .Valid(new GetQueueListByRoomsResponse()
                {
                    waitingListViews = finalresult
                }));
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                return(Result <GetQueueListByRoomsResponse> .Invalid(ex.Message));
            }
        }