Пример #1
0
        public void TapSmartCardOnQueueSucceed(string queueId)
        {
            DAL_QueueNumber dalQueue    = new DAL_QueueNumber();
            var             queueDetail = dalQueue.GetQueueInfoByQueueID(new Guid(queueId));

            if (queueDetail != null)
            {
                string resultUT = GetResultUT(queueDetail.NRIC, queueDetail.Date);

                if (resultUT == EnumUTResult.NEG)
                {
                    var drugResult = new DAL_DrugResults().GetByNRICAndUploadedDate(queueDetail.NRIC, queueDetail.Date);
                    if (drugResult != null && drugResult.IsSealed.Value)
                    {
                        this._web.InvokeScript("openPopupOutcome", queueId);
                    }
                    else
                    {
                        dalQueue.UpdateQueueStatusByUserId(queueDetail.UserId, EnumStation.DUTYOFFICER, EnumQueueStatuses.Finished, EnumStation.DUTYOFFICER, EnumQueueStatuses.Finished, "", EnumQueueOutcomeText.UnconditionalRelease);

                        // Re-load queue
                        this._web.InvokeScript("reloadDataQueues");
                    }
                }
                else
                {
                    this._web.InvokeScript("openPopupOutcome", queueId);
                }
            }
        }
Пример #2
0
        public void SaveOutcome(string UserID, string outcome)
        {
            DAL_QueueNumber dalQueue = new DAL_QueueNumber();

            dalQueue.UpdateQueueStatusByUserId(UserID, EnumStation.DUTYOFFICER, EnumQueueStatuses.Finished, EnumStation.DUTYOFFICER, EnumQueueStatuses.Finished, "", outcome);

            // Re-load queue
            this._web.InvokeScript("reloadDataQueues");
        }
Пример #3
0
        public void OnEventPrintFinished()
        {
            if (_PrintMUBSucceed && _PrintTTSucceed)
            {
                // Update queue status is finished
                Session         session     = Session.Instance;
                Trinity.BE.User currentUser = (Trinity.BE.User)session[CommonConstants.USER_LOGIN];
                if (currentUser == null)
                {
                    // Check why current user is null
                    this._web.RunScript("$('.status-text').css('color','#000').text('The current user is null');");
                    return;
                }
                Trinity.BE.User supervisee = null;
                if (currentUser.Role == EnumUserRoles.DutyOfficer)
                {
                    supervisee = (Trinity.BE.User)session[CommonConstants.SUPERVISEE];
                }
                else
                {
                    supervisee = currentUser;
                }
                var dalQueue = new DAL_QueueNumber();
                dalQueue.UpdateQueueStatusByUserId(supervisee.UserId, EnumStation.SSA, EnumQueueStatuses.Finished, EnumStation.UHP, EnumQueueStatuses.Processing, "", EnumQueueOutcomeText.Processing);
                //this._web.LoadPageHtml("PrintingMUBAndTTLabels.html");
                //this._web.RunScript("$('#WaitingSection').hide();$('#CompletedSection').show(); ; ");
                //this._web.RunScript("$('.status-text').css('color','#000').text('Please collect your labels');");
                //this._web.InvokeScript("countdownLogout");

                DeleteQRCodeImageFileTemp();

                CheckMUBPrintingLabellingProgress();
                this._web.RunScript("$('.status-text').css('color','#000').text('Printing and labelling is in progress...');");
                this._web.RunScript("$('#ConfirmBtn').html('Waiting...');");
                this._web.RunScript("$('#lblNextAction').text('CheckIfMUBIsRemoved');");
            }
            else
            {
                _popupModel.Title         = "Printing Failed";
                _popupModel.Message       = "Unable to print labels.\nPlease report to the Duty Officer";
                _popupModel.IsShowLoading = false;
                _popupModel.IsShowOK      = true;

                if (_PrintTTSucceed)
                {
                    _popupModel.Message = "Unable to print MUB labels.\nPlease report to the Duty Officer";
                }
                if (_PrintMUBSucceed)
                {
                    _popupModel.Message = "Unable to print TT labels.\nPlease report to the Duty Officer";
                }
                this._web.InvokeScript("showPopupModal", JsonConvert.SerializeObject(_popupModel));
            }
        }
Пример #4
0
        public void SaveDrugTest(string UserId, bool COCA, bool BARB, bool LSD, bool METH, bool MTQL, bool PCP, bool KET, bool BUPRE, bool CAT, bool PPZ, bool NPS)
        {
            Session session = Session.Instance;

            Trinity.BE.User dutyOfficer = (Trinity.BE.User)session[CommonConstants.USER_LOGIN];
            DAL_DrugResults dalDrug     = new DAL_DrugResults();

            dalDrug.UpdateDrugSeal(UserId, COCA, BARB, LSD, METH, MTQL, PCP, KET, BUPRE, CAT, PPZ, NPS, dutyOfficer.UserId);
            var dalQueue = new DAL_QueueNumber();

            dalQueue.UpdateQueueStatusByUserId(UserId, EnumStation.UT, EnumQueueStatuses.Finished, EnumStation.SSP, EnumQueueStatuses.Processing, "Waiting for SSP", EnumQueueOutcomeText.Processing);


            var    user          = new DAL_User().GetUserById(UserId);
            var    dalLabel      = new DAL_Labels();
            string MarkingNumber = dalLabel.GetMarkingNumber(user.UserId, DateTime.Today);

            if (string.IsNullOrEmpty(MarkingNumber))
            {
                MarkingNumber = new DAL_SettingSystem().GenerateMarkingNumber();
            }
            var myQueue = dalQueue.GetMyQueueToday(user.UserId);

            dalLabel.Insert(new Trinity.BE.Label
            {
                UserId      = UserId,
                Label_Type  = EnumLabelType.UB,
                CompanyName = CommonConstants.COMPANY_NAME,
                MarkingNo   = MarkingNumber,
                NRIC        = user.NRIC,
                Name        = user.Name,
                DrugType    = dalDrug.GetResultUTByNRIC(user.NRIC, DateTime.Today),
                Queue_ID    = myQueue.Queue_ID,
                LastStation = EnumStation.DUTYOFFICER
            });
        }
Пример #5
0
        public void Start()
        {
            Trinity.BE.User supervisee = _jsCallCS.getSuperviseeLogin();
            if (supervisee == null)
            {
                _jsCallCS.LogOut();
                return;
            }

            LabelInfo labelInfo = null;

            if (supervisee.Role.Equals(EnumUserRoles.USA, StringComparison.OrdinalIgnoreCase))
            {
                var dalLabel = new DAL_Labels();
                var lable    = dalLabel.GetByUserID(supervisee.UserId, EnumLabelType.MUB, DateTime.Today);
                if (lable == null)
                {
                    string MarkingNumber = new DAL_SettingSystem().GenerateMarkingNumber();
                    dalLabel.Insert(new Trinity.BE.Label
                    {
                        UserId      = supervisee.UserId,
                        Label_Type  = EnumLabelType.TT,
                        CompanyName = CommonConstants.COMPANY_NAME,
                        MarkingNo   = MarkingNumber,
                        NRIC        = supervisee.NRIC,
                        Name        = supervisee.Name,
                        LastStation = EnumStation.ALK
                    });
                    dalLabel.Insert(new Trinity.BE.Label
                    {
                        UserId      = supervisee.UserId,
                        Label_Type  = EnumLabelType.MUB,
                        CompanyName = CommonConstants.COMPANY_NAME,
                        MarkingNo   = MarkingNumber,
                        NRIC        = supervisee.NRIC,
                        Name        = supervisee.Name,
                        LastStation = EnumStation.ALK
                    });
                    lable = dalLabel.GetByUserID(supervisee.UserId, EnumLabelType.MUB, DateTime.Today);
                }
                labelInfo = new LabelInfo
                {
                    UserId      = lable.UserId,
                    Name        = lable.Name,
                    NRIC        = lable.NRIC,
                    Label_Type  = EnumLabelType.MUB,
                    Date        = DateTime.Now.ToString("dd/MM/yyyy"),
                    CompanyName = lable.CompanyName,
                    LastStation = EnumStation.ALK,
                    MarkingNo   = lable.MarkingNo,
                    DrugType    = "NA",
                    QRCode      = lable.QRCode
                };
            }
            else if (supervisee.Role.Equals(EnumUserRoles.Supervisee, StringComparison.OrdinalIgnoreCase))
            {
                var dalQueue = new DAL_QueueNumber();
                var myQueue  = dalQueue.GetMyQueueToday(supervisee.UserId);
                if (myQueue == null)
                {
                    _web.ShowMessage("Please register for a queue number at " + EnumStation.ARK + " first.");
                    _jsCallCS.LogOut();
                    return;
                }
                else if (myQueue != null && myQueue.QueueDetails.Any(d => d.Station == EnumStation.ARK && d.Status == EnumQueueStatuses.Waiting))
                {
                    _web.ShowMessage("Please wait for your queue number to appear under the \"Now Serving\" list.");
                    _jsCallCS.LogOut();
                    return;
                }

                dalQueue.UpdateQueueStatusByUserId(supervisee.UserId, EnumStation.ARK, EnumQueueStatuses.Processing, EnumStation.ALK, EnumQueueStatuses.Processing, "Printing MUB/TT labels", EnumQueueOutcomeText.Processing);
                var    lable     = new DAL_Labels().GetByUserID(supervisee.UserId, EnumLabelType.MUB, DateTime.Today);
                string markingNo = lable.MarkingNo;
                labelInfo = new LabelInfo
                {
                    UserId      = lable.UserId,
                    Name        = lable.Name,
                    NRIC        = lable.NRIC,
                    Label_Type  = EnumLabelType.MUB,
                    Date        = DateTime.Now.ToString("dd/MM/yyyy"),
                    CompanyName = lable.CompanyName,
                    LastStation = EnumStation.ALK,
                    MarkingNo   = markingNo,
                    DrugType    = "NA",
                    QRCode      = lable.QRCode
                };
            }

            using (var ms = new System.IO.MemoryStream(labelInfo.QRCode))
            {
                System.IO.Directory.CreateDirectory(String.Format("{0}/Temp", CSCallJS.curDir));
                string fileName = String.Format("{0}/Temp/{1}", CSCallJS.curDir, "QRCode_" + supervisee.NRIC + ".png");
                if (System.IO.File.Exists(fileName))
                {
                    System.IO.File.Delete(fileName);
                }
                var bitmap = System.Drawing.Image.FromStream(ms);
                bitmap.Save(fileName, System.Drawing.Imaging.ImageFormat.Png);
            }
            //profile model
            _web.LoadPageHtml("SuperviseeParticulars.html", labelInfo);
            _main._isPrintingMUBTT = false;
            if (_main._timerCheckLogout != null)
            {
                if (_main._timerCheckLogout.Enabled)
                {
                    _main._timerCheckLogout.Stop();
                }
                _main._timerCheckLogout.Start();
            }
        }