Ejemplo n.º 1
0
        private void SetImageState(AppointmentState state)
        {
            switch (state)
            {
            case AppointmentState.Pianificato:
                pictureEdit1.Image = imageCollection1.Images[0];
                break;

            case AppointmentState.In_Scadenza:
                pictureEdit1.Image = imageCollection1.Images[1];
                break;

            case AppointmentState.Scade_Oggi:
                pictureEdit1.Image = imageCollection1.Images[2];
                break;

            case AppointmentState.Scaduto:
                pictureEdit1.Image = imageCollection1.Images[3];
                break;

            case AppointmentState.Eseguito:
                pictureEdit1.Image = imageCollection1.Images[4];
                break;

            case AppointmentState.Concluso:
                pictureEdit1.Image = imageCollection1.Images[5];
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        public static OutlookDeadLineState GetState(AppointmentState state, int daysbeforeDeadLine)
        {
            switch (state)
            {
            case AppointmentState.Pianificato:
                return(GetInternalState(daysbeforeDeadLine));

            case AppointmentState.In_Scadenza:
                return(GetInternalState(daysbeforeDeadLine));

            case AppointmentState.Scade_Oggi:
                return(OutlookDeadLineState.SuperRedFlag);

            case AppointmentState.Scaduto:
                return(OutlookDeadLineState.SuperRedFlag);

            case AppointmentState.Eseguito:
                return(OutlookDeadLineState.CompleteFlag);

            case AppointmentState.Concluso:
                return(OutlookDeadLineState.CompleteFlag);

            default:
                return(OutlookDeadLineState.CompleteFlag);
            }
        }
Ejemplo n.º 3
0
        protected override void OnStateChanged(IChangeEvent @event)
        {
            switch (@event)
            {
            case Events.Appointment.Created _:
                break;

            case Events.Appointment.DetailsChanged changed:
                DoctorId = changed.DoctorId;
                StartUtc = changed.StartUtc;
                EndUtc   = changed.EndUtc;

                Logger.LogDebug("Appointment {Id} changed details for {Doctor}", Id, DoctorId);
                break;

            case Events.Appointment.AppointmentStarted _:
                State = AppointmentState.Started;

                Logger.LogDebug("Appointment {Id} was started", Id);
                break;

            case Events.Appointment.AppointmentEnded _:
                State = AppointmentState.Ended;

                Logger.LogDebug("Appointment {Id} was ended", Id);
                break;

            default:
                throw new InvalidOperationException($"Unknown event {@event.GetType()}");
            }
        }
Ejemplo n.º 4
0
        public void Apply(AppointmentCreatedEvent @event)
        {
            var open         = new Open();
            var completed    = new Completed();
            var currentState = new AppointmentState(@event.State);
            var appointment  = new Appointment
            {
                Id = @event.Id,
                OwnerFamilyName = @event.OwnerFamilyName,
                OwnerGivenName  = @event.OwnerGivenName,
                OwnerId         = @event.OwnerId,
                PetId           = @event.PetId,
                PetName         = @event.PetName,
                StartingTime    = @event.StartingTime
            };

            if (currentState.Equals(open))
            {
                appointment.State = open;
            }
            else
            {
                appointment.State = completed;
            }
            Appointments.Add(appointment);
        }
Ejemplo n.º 5
0
 public Appointment(AppointmentCreated @event)
 {
     Id    = @event.AppointmentId;
     Pet   = @event.Data.Pet;
     Owner = @event.Data.Owner;
     AttendingVeterinarianId = @event.Data.AttendingVeterinarianId;
     ReasonForVisit          = @event.Data.ReasonForVisit;
     ScheduledOn             = @event.Data.ScheduledOn;
     State = @event.Data.State;
 }
Ejemplo n.º 6
0
        public Appointment(
            Pet pet,
            Owner owner,
            string reasonForVisit,
            DateTimeOffset scheduledOn)
        {
            Id             = Guid.NewGuid();
            Pet            = pet;
            Owner          = owner;
            ReasonForVisit = reasonForVisit;
            ScheduledOn    = scheduledOn;
            State          = AppointmentState.Requested;

            AppendEvent(new AppointmentCreated(Id, CreateMemento()));
        }
Ejemplo n.º 7
0
        public async Task <ActionResult> GetBoxToAccept(AppointmentState filter = AppointmentState.已装箱)
        {
            try
            {
                var storeId = _storeContract.QueryManageStoreId(AuthorityHelper.OperatorId.Value)?.FirstOrDefault();
                if (!storeId.HasValue)
                {
                    return(Json(OperationResult.Error("店铺权限不足"), JsonRequestBehavior.AllowGet));
                }
                var res = await _appointmentContract.GetBoxToAccept(storeId.Value, filter);

                return(Json(res, JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(OperationResult.Error("系统错误"), JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Calculates the appointmentState and the days before and after the deadline
        /// if the apppointment is not closed or executed
        /// </summary>
        /// <param name="daysBeforeDeadline"></param>
        public void CalculateAppointmentInfo(int daysBeforeDeadline)
        {
            _deadlineNotes      = "";
            _daysAfterDeadline  = 0;
            _daysBeforeDeadline = 0;
            _state = AppointmentState.Pianificato;

            if (_isClosed)
            {
                _state = AppointmentState.Concluso;
            }
            else if (_outcomeCreated)
            {
                _state = AppointmentState.Eseguito;
            }
            else
            {
                _state = CalculateState(daysBeforeDeadline);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Calculates the activityDeadlineState and the days before and after the deadline
        /// if the activity is not completed
        /// </summary>
        /// <param name="daysBeforeDeadline"></param>
        public void CalculateAppointmentInfo(int daysBeforeDeadline)
        {
            _deadlineNotes         = "";
            _daysAfterDeadline     = 0;
            _daysBeforeDeadline    = 0;
            _activityDeadlineState = AppointmentState.Pianificato;

            if (_activityState == ActivityState.Completata)
            {
                _activityDeadlineState = AppointmentState.Concluso;

                _deadlineNotes = string.Format("Attività completata {0}", _outcomeDate.Date.ToLongDateString());
            }

            else
            {
                _activityDeadlineState = CalculateState(daysBeforeDeadline);
            }



            _outlookDeadLineState = OutlookDeadLineStateFactory.GetState(_activityDeadlineState, _daysBeforeDeadline);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Sets the appointment category to give the appointment the correct color
        /// </summary>
        /// <param name="item">The item to set</param>
        /// <param name="state">The appointment state to set to the appointment</param>
        public static void SetAppointmentState(this AppointmentItem item, AppointmentState state)
        {
            var newCategories = new List <string>();

            // get the previous categories and remove our categories
            if (!string.IsNullOrEmpty(item.Categories))
            {
                foreach (var itm in item.Categories.Split(';'))
                {
                    // Preserve other categories.
                    if (!AppointmentState.IsValidAppointmentStateName(itm))
                    {
                        newCategories.Add(itm);
                    }
                }
            }

            // set our new categories
            newCategories.Insert(0, state.Name);

            if (state == AppointmentState.Modified)
            {
                item.SetAppointmentModificationDate(DateTime.Now);
            }

            item.Categories = string.Join(";", newCategories);

            // Update the previous sate of the appointment, if the current state is not syncerror.
            var previousState = item.GetAppointmentCustomId(Constants.FieldAppointmentState);

            if (previousState.HasValue && previousState.Value != AppointmentState.SyncError.Value)
            {
                item.SetAppointmentCustomId(Constants.FieldAppointmentPreviousState, previousState);
            }

            item.SetAppointmentCustomId(Constants.FieldAppointmentState, state.Value);
        }
Ejemplo n.º 11
0
        public SqlCommand getAllAppointments(DateTime dateFrom, DateTime dateTo, AppointmentState[] states = null, int ownerID = 0)
        {
            String str = getAllAppointmentsSQL() +
                " WHERE DateAppointment > @dateFrom AND DateAppointment < @dateTo";

            if (ownerID > 0)
                str += " AND OwnerID = @ownerID";

            if (states != null)
            {
                str += " AND ";
                // Lista de estados
                for (int i = 0; i < states.Length; i++)
                {
                    if (i == 0)
                        str += " State = " + (int)states[i];
                    else
                        str += " OR State = " + (int)states[i];
                }
            }

            // Executar comando
            SqlCommand cmd = new SqlCommand(str, Database.Connection);
            cmd.Parameters.AddWithValue("@dateFrom", dateFrom);
            cmd.Parameters.AddWithValue("@dateTo", dateTo);

            if (ownerID > 0)
                cmd.Parameters.AddWithValue("@ownerID", ownerID);

            return cmd;
        }
Ejemplo n.º 12
0
        public SqlCommand getAppointments(DateTime dateFrom, DateTime dateTo, AppointmentState[] states = null, int animalID = 0)
        {
            String str = "SELECT ap.*, a.Name as Animal, apt.Description as AppointmentType, " +
                " CASE" +
                "  WHEN State = 0 THEN 'Em espera'" +
                "  WHEN State = 1 THEN 'Aceite'" +
                "  WHEN State = 2 THEN 'Rejeitado'" +
                "  WHEN State = 3 THEN 'Cancelado'" +
                " END as StateStr" +
                " FROM Appointments ap" +
                "  LEFT OUTER JOIN Animals a ON a.AnimalID = ap.AnimalID" +
                "  LEFT OUTER JOIN Owners o ON o.OwnerID = ap.OwnerID" +
                "  LEFT OUTER JOIN AppointmentTypes apt ON apt.AppointmentTypeID = ap.AppointmentTypeID" +
                " WHERE DateAppointment > @dateFrom AND DateAppointment < @dateTo" +
                "  AND ap.OwnerID = @id";

            if (states != null) {
                str += " AND (";
                // Lista de estados
                for (int i = 0; i < states.Length; i++)
                {
                    if (i == 0)
                        str += " State = " + (int)states[i];
                    else
                        str += " OR State = " + (int)states[i];
                }
                str += ")";
            }

            if (animalID > 0)
                str += " AND ap.AnimalID = @animalID";

            // Ordenação
            str += " ORDER BY DateAppointment";

            // Executar comando
            SqlCommand cmd = new SqlCommand(str, Database.Connection);
            cmd.Parameters.AddWithValue("@dateFrom", dateFrom);
            cmd.Parameters.AddWithValue("@dateTo", dateTo);
            cmd.Parameters.AddWithValue("@id", getUniqueID());

            if (animalID > 0)
                cmd.Parameters.AddWithValue("@animalID", animalID);

            return cmd;
        }
Ejemplo n.º 13
0
 public void Cancel(string reason)
 {
     State = AppointmentState.Canceled;
     CancellationReason = reason;
     AppendEvent(new AppointmentCanceled(Id, reason));
 }
Ejemplo n.º 14
0
 public void Reschedule(DateTimeOffset date)
 {
     State       = AppointmentState.Requested;
     ScheduledOn = date;
     AppendEvent(new AppointmentRescheduled(Id, date));
 }
Ejemplo n.º 15
0
 public void Reject(string reason)
 {
     State           = AppointmentState.Rejected;
     RejectionReason = reason;
     AppendEvent(new AppointmentRejected(Id, reason));
 }
Ejemplo n.º 16
0
 public void Confirm(Guid attendingVeterinarianId)
 {
     State = AppointmentState.Confirmed;
     AttendingVeterinarianId = attendingVeterinarianId;
     AppendEvent(new AppointmentConfirmed(Id, attendingVeterinarianId));
 }
Ejemplo n.º 17
0
 public void Complete()
 {
     State = AppointmentState.Completed;
     AppendEvent(new AppointmentCompleted(Id));
 }
        public SqlCommand getAppointments()
        {
            AppointmentState[] states = new AppointmentState[3];
            // Lista dos estados a carregar
            states[0] = AppointmentState.astWaiting;
            states[1] = AppointmentState.astAccepted;
            states[2] = AppointmentState.astRejected;

            return getAppointments(getDefaultDateFrom(), getDefaultDateTo(), states);
        }
Ejemplo n.º 19
0
 public void Apply(AppointmentCompleted @event)
 {
     State = @event.State;
 }
Ejemplo n.º 20
0
 public void Apply(AppointmentMembersCheckedIn @event)
 {
     State = @event.State;
 }
Ejemplo n.º 21
0
 public void Apply(AppointmentCanceled @event)
 {
     CancellationReason = @event.CancellationReason;
     State = @event.State;
 }
Ejemplo n.º 22
0
 public void Apply(AppointmentRejected @event)
 {
     RejectionReason = @event.RejectionReason;
     State           = @event.State;
 }
Ejemplo n.º 23
0
 public void Apply(AppointmentConfirmed @event)
 {
     AttendingVeterinarianId = @event.AttendingVeterinarianId;
     State = @event.State;
 }
Ejemplo n.º 24
0
        public bool existsAppointments(AppointmentState state, DateTime dateFrom, DateTime dateTo, int ownerID = 0)
        {
            String str = "SELECT *" +
                " FROM Appointments" +
                " WHERE DateAppointment > @dateFrom AND DateAppointment < @dateTo" +
                "  AND State = " + (int)state;

            if (ownerID > 0)
                str += " AND OwnerID = @ownerID";

            // Executar comando
            SqlCommand cmd = new SqlCommand(str, Database.Connection);
            cmd.Parameters.AddWithValue("@dateFrom", dateFrom);
            cmd.Parameters.AddWithValue("@dateTo", dateTo);

            if (ownerID > 0)
                cmd.Parameters.AddWithValue("@ownerID", ownerID);

            SqlDataReader dr = cmd.ExecuteReader();
            bool has = dr.HasRows;
            dr.Close();
            return has;
        }
        public SqlCommand getAppointments()
        {
            AppointmentState[] states = new AppointmentState[3];
            // Lista dos estados a carregar
            states[0] = AppointmentState.astWaiting;
            states[1] = AppointmentState.astAccepted;
            states[2] = AppointmentState.astCanceled;

            return getAllAppointments(getMinDate(), getMaxDate(), states);
        }
Ejemplo n.º 26
0
 public void Apply(AppointmentRescheduled @event)
 {
     ScheduledOn = @event.Date;
     State       = @event.State;
 }
Ejemplo n.º 27
0
 public void CheckIn()
 {
     State = AppointmentState.CheckedIn;
     AppendEvent(new AppointmentMembersCheckedIn(Id));
 }