//private Trinity.BE.WorkingTimeshift SetSelectedTimes( Appointment appointment) //{ // var date = appointment.Date; // Trinity.BE.WorkingTimeshift selectedTimes = new DAL_Setting().GetApptmtTime(date); // SetSelectedTime(appointment, selectedTimes.Morning); // SetSelectedTime(appointment, selectedTimes.Afternoon); // SetSelectedTime(appointment, selectedTimes.Evening); // this._web.LoadPageHtml("BookAppointment.html", new object[] { appointment, selectedTimes }); // return selectedTimes; //} //private static void SetSelectedTime(Appointment appointment, List<Trinity.BE.WorkingShiftDetails> selectedTimes) //{ // var item = selectedTimes.Where(d => appointment.Timeslot != null && appointment.Timeslot.StartTime != null && d.StartTime == appointment.Timeslot.StartTime.Value && d.EndTime == appointment.Timeslot.EndTime.Value).FirstOrDefault(); // if (item != null) // { // item.IsSelected = true; // } // if (!string.IsNullOrEmpty(appointment.Timeslot_ID)) // { // var maxAppPerTimeslot = new DAL_Appointments().GetMaxNumberOfTimeslot(appointment.Timeslot_ID); // foreach (var selectedItem in selectedTimes) // { // var count = new DAL_Appointments().CountListApptmtByTimeslot(appointment); // if (count >= maxAppPerTimeslot) // { // selectedItem.IsAvailble = false; // } // } // } //} public void UpdateTimeAppointment(string appointment_ID, string timeslot_ID) { if (new DAL_QueueNumber().IsInQueue(appointment_ID, EnumStation.ARK)) { this._web.ShowMessage("You already registered a queue number!"); } else { Trinity.BE.User supervisee = getSuperviseeLogin(); bool updateResult = new DAL_Appointments().UpdateTimeslot_ID(appointment_ID, timeslot_ID); if (updateResult) { Trinity.SignalR.Client.Instance.AppointmentBooked(supervisee.UserId, appointment_ID, timeslot_ID); AppointmentDetails appointmentdetails = new DAL_Appointments().GetAppointmentDetails(appointment_ID); if (BarcodePrinterUtil.Instance.GetDeviceStatus(EnumDeviceNames.ReceiptPrinter).Contains(EnumDeviceStatus.Connected)) { ReceiptPrinterUtil.Instance.PrintAppointmentDetails(appointmentdetails); } else { Trinity.SignalR.Client.Instance.SendToAppDutyOfficers(supervisee.UserId, "Lost connection to printer", "Lost connection to printer", EnumNotificationTypes.Error); _web.ShowMessage("Lost connection to printer"); } LoadPageSupervisee(); } else { this._web.ShowMessage("Book Appointment failed.<br/>Please try again!"); } } }
public List <Statistics> GetStatistics() { if (_isFocusQueue) { SmartCardReaderUtil.Instance.StopSmartCardMonitor(); _isFocusQueue = false; } var dalAppointment = new DAL_Appointments(); var result = dalAppointment.GetAllStats(); List <Statistics> data = result; foreach (var item in data) { var maxResult = dalAppointment.GetMaxNumberOfTimeslot(item.Timeslot_ID); item.Max = maxResult; var bookedResult = dalAppointment.CountApptmtBookedByTimeslot(item.Timeslot_ID); item.Booked = bookedResult; var reportedResult = dalAppointment.CountApptmtReportedByTimeslot(item.Timeslot_ID); item.Reported = reportedResult; var absentResult = dalAppointment.CountApptmtAbsentByTimeslot(item.Timeslot_ID); item.Absent = absentResult; item.Available = item.Max - item.Booked - item.Reported - item.Absent; } return(data); }
private static List <Trinity.DAL.DBContext.Queue> GetAllNextQueue(List <Trinity.BE.Queue> allQueue) { var appointment = new DAL_Appointments().GetAppointmentByID(allQueue[0].AppointmentId); //var nextTimeslot = new DAL_Setting().GetNextTimeslotToday(appointment.Timeslot.StartTime.Value); var allNextQueue = new DAL_QueueNumber().GetAllQueueByNextimeslot(appointment.Timeslot.StartTime.Value, EnumStation.ARK); return(allNextQueue); }
public List <Appointment> GetAllAppoinments(string date, string category, string timeslot) { if (_isFocusQueue) { Trinity.Device.Util.SmartCardReaderUtil.Instance.StopSmartCardMonitor(); _isFocusQueue = false; } var dalAppointment = new DAL_Appointments(); var result = dalAppointment.GetAppointmentsByDate(DateTime.ParseExact(date, "dd/MM/yyyy", CultureInfo.InvariantCulture), category, timeslot); return(result); }
private void btnGenerateAppointments_Click(object sender, EventArgs e) { try { DAL_Appointments dalAppointment = new DAL_Appointments(); var result = dalAppointment.CreateApptmtsForAllUsers(dateTimePicker1.Value); MessageBox.Show("OK"); } catch (Exception ex) { MessageBox.Show("Lỗi", ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// Reporting for Queue Number public void ReportingForQueueNumber() { // Get current user Trinity.BE.User supervisee = getSuperviseeLogin(); // Check if the current user is a duty officcer int absenceCount = 0; if (supervisee != null) { absenceCount = new DAL_Appointments().CountAbsenceReport(supervisee.UserId); } if (absenceCount == 0) { GetMyQueueNumber(); } //else if (absenceCount >= 3 || supervisee.Status==EnumUserStatuses.Blocked) //{ // var eventCenter = Trinity.Common.Common.EventCenter.Default; // //eventCenter.RaiseEvent(new Trinity.Common.EventInfo() { Name = EventNames.ABSENCE_MORE_THAN_3, Message = "You have been blocked for 3 or more absences \n Please report to the Duty Officer" }); // this._web.ShowMessage("You have been blocked for 3 or more absences <br/> Please report to the Duty Officer"); // //for testing purpose // //notify to officer // Trinity.SignalR.Client.Instance.SendToAllDutyOfficers(supervisee.UserId, "Supervisee got blocked for 3 or more absences", "Please check the Supervisee's information!", EnumNotificationTypes.Caution); // //var dalUser = new DAL_User(); // //// Create absence reporting // //var listAppointment = new DAL_Appointments().GetAbsentAppointments(supervisee.UserId); // //session[CommonConstants.LIST_APPOINTMENT] = listAppointment; // //_web.LoadPageHtml("ReasonsForQueue.html", listAppointment.Select(d => new // //{ // // ID = d.ID, // // GetDateTxt = d.GetDateTxt // //})); //} else { var listAppointment = new DAL_Appointments().GetAbsentAppointments(supervisee.UserId); this._web.ShowMessage("You have been absent for " + absenceCount + " time(s).<br/>Please provide reason(s) and supporting document(s)."); _web.LoadPageHtml("ReasonsForQueue.html", listAppointment.Select(d => new { ID = d.ID, GetDateTxt = d.GetDateTxt })); } }
public string GetNextAppointmentDate() { Session session = Session.Instance; Trinity.BE.User user = getSuperviseeLogin(); if (user != null) { var _appointment = new DAL_Appointments().GetNextAppointment(user.UserId); if (_appointment != null) { return(_appointment.Date.ToLongDateString()); } } return(null); }
private void PrintTTLabels_OnPrintTTLabelSucceeded(object sender, PrintMUBAndTTLabelsEventArgs e) { try { _PrintTTSucceed = true; var labelInfo = new Trinity.BE.Label { UserId = e.LabelInfo.UserId, Label_Type = EnumLabelType.TT, CompanyName = e.LabelInfo.CompanyName, MarkingNo = e.LabelInfo.MarkingNo, //DrugType = e.LabelInfo.DrugType, NRIC = e.LabelInfo.NRIC, Name = e.LabelInfo.Name, Date = DateTime.Now, LastStation = e.LabelInfo.LastStation, PrintCount = e.LabelInfo.PrintCount, ReprintReason = e.LabelInfo.ReprintReason }; var dalLabel = new DAL_Labels(); var update = dalLabel.UpdateLabel(labelInfo); if (update != null) { var dalAppointment = new DAL_Appointments(); var dalQueue = new DAL_QueueNumber(); var appointment = dalAppointment.GetTodayAppointmentByUserId(labelInfo.UserId); //var appointment = result.Data; if (appointment != null) { var sskQueue = new DAL_QueueNumber().GetQueueDetailByAppointment(appointment, EnumStation.SSK); dalQueue.UpdateQueueStatus(sskQueue.Queue_ID, EnumQueueStatuses.Finished, EnumStation.SSK); dalQueue.UpdateQueueStatus(sskQueue.Queue_ID, EnumQueueStatuses.Processing, EnumStation.SSA); } //this._web.RunScript("$('#WaitingSection').hide();$('#CompletedSection').show(); ; "); //this._web.RunScript("$('.status-text').css('color','#000').text('Please collect your labels');"); //DeleteQRCodeImageFileTemp(); } } catch (Exception ex) { } }
private void GetQueueForSupervisee(string userId) { Session session = Session.Instance; Trinity.BE.User dutyOfficer = (Trinity.BE.User)session[CommonConstants.USER_LOGIN]; DAL_Appointments dalAppointment = new DAL_Appointments(); Trinity.DAL.DBContext.Appointment appointment = dalAppointment.GetAppointmentByDate(userId, DateTime.Today); if (appointment != null) { //var responseResult= _Appointment.GetTimeslotNearestAppointment(); DAL_QueueNumber dalQueue = new DAL_QueueNumber(); Trinity.DAL.DBContext.Timeslot timeslot = dalQueue.GetTimeSlotEmpty(); var response = dalAppointment.UpdateTimeslotForApptmt(appointment.ID, timeslot.Timeslot_ID); appointment = response; Trinity.DAL.DBContext.Queue queueNumber = dalQueue.InsertQueueNumber(appointment.ID, appointment.UserId, EnumStation.ARK, dutyOfficer.UserId); } }
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 //{ //} }
public void PrintAppointmentDetails(string appointmentId) { AppointmentDetails appointmentdetails = new DAL_Appointments().GetAppointmentDetails(appointmentId); ReceiptPrinterUtil.Instance.PrintAppointmentDetails(appointmentdetails); }
public void BookAppointment() { Session session = Session.Instance; var eventCenter = Trinity.Common.Common.EventCenter.Default; Trinity.BE.User supervisee = getSuperviseeLogin(); // check supervisee have appoitment Trinity.DAL.DBContext.Appointment appointment = new DAL_Appointments().GetNextAppointment(supervisee.UserId); if (appointment != null && (appointment.Status == EnumAppointmentStatuses.Reported || appointment.Status == EnumAppointmentStatuses.Absent)) { appointment = new DAL_Appointments().GetNextAppointmentByStatus(supervisee.UserId, EnumAppointmentStatuses.Pending); } if (appointment == null) { eventCenter.RaiseEvent(new Trinity.Common.EventInfo() { Name = EventNames.ALERT_MESSAGE, Message = "You have no appointment today." }); return; } // get timeslots of appoitment day List <Timeslot> timeslots = new DAL_Timeslots().GetTimeSlots(appointment.Date); if (timeslots == null) { eventCenter.RaiseEvent(new Trinity.Common.EventInfo() { Name = EventNames.ALERT_MESSAGE, Message = "Have no timeslot to select. \nPlease contact Duty Officer." }); return; } // set workingTimeshift Trinity.BE.WorkingTimeshift workingTimeshift = new Trinity.BE.WorkingTimeshift(); workingTimeshift.Morning = GetWorkingTimeshift(timeslots, appointment.Timeslot_ID, EnumTimeshift.Morning); workingTimeshift.Afternoon = GetWorkingTimeshift(timeslots, appointment.Timeslot_ID, EnumTimeshift.Afternoon); workingTimeshift.Evening = GetWorkingTimeshift(timeslots, appointment.Timeslot_ID, EnumTimeshift.Evening); var appointmentBE = new Trinity.BE.Appointment() { ID = appointment.ID.ToString(), AbsenceReporting_ID = appointment.AbsenceReporting_ID, Timeslot_ID = appointment.Timeslot_ID, UserId = appointment.UserId, AppointmentDate = appointment.Date, ChangedCount = appointment.ChangedCount, Status = appointment.Status, ReportTime = appointment.ReportTime, StartTime = appointment.Timeslot != null ? appointment.Timeslot.StartTime : null, EndTime = appointment.Timeslot != null ? appointment.Timeslot.EndTime : null }; // redirect this._web.LoadPageHtml("BookAppointment.html", new object[] { appointmentBE, workingTimeshift }); }