示例#1
0
文件: JSCallCS.cs 项目: tuga1975/SSK
        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
            });
        }
示例#2
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();
            }
        }
示例#3
0
        private void GetMyQueueNumber()
        {
            // Get current user
            Session session = Session.Instance;

            Trinity.BE.User currentUser = (Trinity.BE.User)session[CommonConstants.USER_LOGIN];
            Trinity.BE.User supervisee  = null;
            if (currentUser.Role == EnumUserRoles.DutyOfficer)
            {
                supervisee = (Trinity.BE.User)session[CommonConstants.SUPERVISEE];
            }
            else
            {
                supervisee = currentUser;
            }
            DAL_Appointments _Appointment = new DAL_Appointments();

            Trinity.DAL.DBContext.Appointment appointment = new DAL_Appointments().GetAppointmentByDate(supervisee.UserId, DateTime.Today);
            var _dalQueue = new DAL_QueueNumber();

            Trinity.DAL.DBContext.Queue queueNumber = null;

            if (!_dalQueue.IsUserAlreadyQueue(supervisee.UserId, DateTime.Today))
            {
                if (appointment != null)
                {
                    if (string.IsNullOrEmpty(appointment.Timeslot_ID) && currentUser.Role == EnumUserRoles.Supervisee)
                    {
                        _web.ShowMessage("You have not selected a timeslot!");
                        BookAppointment();
                    }
                    else
                    {
                        queueNumber = _dalQueue.InsertQueueNumber(appointment.ID, appointment.UserId, EnumStation.ARK, currentUser.UserId);
                        var    dalLabel      = new DAL_Labels();
                        string MarkingNumber = dalLabel.GetMarkingNumber(supervisee.UserId, DateTime.Today);
                        if (string.IsNullOrEmpty(MarkingNumber))
                        {
                            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.ARK,
                            Queue_ID    = queueNumber.Queue_ID
                        });
                        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.ARK,
                            Queue_ID    = queueNumber.Queue_ID
                        });


                        Trinity.SignalR.Client.Instance.AppointmentReported(queueNumber.Queue_ID.ToString().Trim(), queueNumber.Appointment_ID.ToString().Trim());
                        Trinity.SignalR.Client.Instance.QueueInserted(queueNumber.Queue_ID.ToString().Trim());
                        APIUtils.FormQueueNumber.RefreshQueueNumbers();
                        this._web.ShowMessage("Your queue number is:" + queueNumber.QueuedNumber);
                    }
                }
                else
                {
                    queueNumber = _dalQueue.InsertQueueNumberFromDO(supervisee.UserId, EnumStation.ARK, currentUser.UserId);
                    var    dalLabel      = new DAL_Labels();
                    string MarkingNumber = dalLabel.GetMarkingNumber(supervisee.UserId, DateTime.Today);
                    if (string.IsNullOrEmpty(MarkingNumber))
                    {
                        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.ARK,
                        Queue_ID    = queueNumber.Queue_ID
                    });
                    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.ARK,
                        Queue_ID    = queueNumber.Queue_ID
                    });
                    Trinity.SignalR.Client.Instance.QueueInserted(queueNumber.Queue_ID.ToString().Trim());
                    APIUtils.FormQueueNumber.RefreshQueueNumbers();
                    this._web.ShowMessage("Your queue number is:" + queueNumber.QueuedNumber);
                }

                //if (appointment != null && string.IsNullOrEmpty(appointment.Timeslot_ID))
                //{
                //    var eventCenter = Trinity.Common.Common.EventCenter.Default;
                //    eventCenter.RaiseEvent(new Trinity.Common.EventInfo() { Name = EventNames.ALERT_MESSAGE, Message = "You have not selected the timeslot!\n Please go to Book Appointment page to select a timeslot." });
                //}
                //else if (appointment != null && !string.IsNullOrEmpty(appointment.Timeslot_ID))
                //{
                //    queueNumber = _dalQueue.InsertQueueNumber(appointment.ID, appointment.UserId, EnumStation.ARK, currentUser.UserId);
                //    if (queueNumber != null)
                //    {
                //        Trinity.SignalR.Client.Instance.AppointmentBookedOrReported(appointment.ID.ToString().Trim(), EnumAppointmentStatuses.Reported);
                //        Trinity.SignalR.Client.Instance.QueueInserted(queueNumber.Queue_ID.ToString().Trim());
                //        APIUtils.FormQueueNumber.RefreshQueueNumbers();
                //        var eventCenter = Trinity.Common.Common.EventCenter.Default;
                //        eventCenter.RaiseEvent(new Trinity.Common.EventInfo() { Name = EventNames.ALERT_MESSAGE, Message = "Your queue number is:" + queueNumber.QueuedNumber });
                //    }
                //    else
                //    {
                //        this._web.ShowMessage("Sorry all timeslots are fully booked!");
                //    }

                //}
                //else
                //{

                //}
            }
            else
            {
                this._web.ShowMessage("You already registered a queue number!\n Please wait for your turn.");
            }
            //if (appointment == null && currentUser.Role == EnumUserRoles.Supervisee)
            //{
            //    var eventCenter = Trinity.Common.Common.EventCenter.Default;
            //    eventCenter.RaiseEvent(new Trinity.Common.EventInfo() { Name = EventNames.ALERT_MESSAGE, Message = "You have no appointment today" });
            //}
            //else
            //{

            //}
        }