public async Task <IActionResult> Edit(int id, [Bind("Id,Option,Price")] AppointmentReason appointmentReason)
        {
            if (id != appointmentReason.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(appointmentReason);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AppointmentReasonExists(appointmentReason.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(appointmentReason));
        }
Example #2
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator),
                       Id,
                       PlacerAppointmentId?.ToDelimitedString(),
                       FillerAppointmentId?.ToDelimitedString(),
                       OccurrenceNumber.HasValue ? OccurrenceNumber.Value.ToString(Consts.NumericFormat, culture) : null,
                       PlacerGroupNumber?.ToDelimitedString(),
                       ScheduleId?.ToDelimitedString(),
                       RequestEventReason?.ToDelimitedString(),
                       AppointmentReason?.ToDelimitedString(),
                       AppointmentType?.ToDelimitedString(),
                       AppointmentDuration.HasValue ? AppointmentDuration.Value.ToString(Consts.NumericFormat, culture) : null,
                       AppointmentDurationUnits?.ToDelimitedString(),
                       RequestedStartDateTimeRange != null ? string.Join(Configuration.FieldRepeatSeparator, RequestedStartDateTimeRange.Select(x => x.ToDelimitedString())) : null,
                       PriorityArq,
                       RepeatingInterval?.ToDelimitedString(),
                       RepeatingIntervalDuration,
                       PlacerContactPerson != null ? string.Join(Configuration.FieldRepeatSeparator, PlacerContactPerson.Select(x => x.ToDelimitedString())) : null,
                       PlacerContactPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, PlacerContactPhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       PlacerContactAddress != null ? string.Join(Configuration.FieldRepeatSeparator, PlacerContactAddress.Select(x => x.ToDelimitedString())) : null,
                       PlacerContactLocation?.ToDelimitedString(),
                       EnteredByPerson != null ? string.Join(Configuration.FieldRepeatSeparator, EnteredByPerson.Select(x => x.ToDelimitedString())) : null,
                       EnteredByPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, EnteredByPhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       EnteredByLocation?.ToDelimitedString(),
                       ParentPlacerAppointmentId?.ToDelimitedString(),
                       ParentFillerAppointmentId?.ToDelimitedString(),
                       PlacerOrderNumber != null ? string.Join(Configuration.FieldRepeatSeparator, PlacerOrderNumber.Select(x => x.ToDelimitedString())) : null,
                       FillerOrderNumber != null ? string.Join(Configuration.FieldRepeatSeparator, FillerOrderNumber.Select(x => x.ToDelimitedString())) : null
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Example #3
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator),
                       Id,
                       PlacerAppointmentId?.ToDelimitedString(),
                       FillerAppointmentId?.ToDelimitedString(),
                       OccurrenceNumber.HasValue ? OccurrenceNumber.Value.ToString(Consts.NumericFormat, culture) : null,
                       PlacerGroupNumber?.ToDelimitedString(),
                       ScheduleId?.ToDelimitedString(),
                       EventReason?.ToDelimitedString(),
                       AppointmentReason?.ToDelimitedString(),
                       AppointmentType?.ToDelimitedString(),
                       AppointmentDuration.HasValue ? AppointmentDuration.Value.ToString(Consts.NumericFormat, culture) : null,
                       AppointmentDurationUnits?.ToDelimitedString(),
                       AppointmentTimingQuantity != null ? string.Join(Configuration.FieldRepeatSeparator, AppointmentTimingQuantity.Select(x => x.ToDelimitedString())) : null,
                       PlacerContactPerson?.ToDelimitedString(),
                       PlacerContactPhoneNumber?.ToDelimitedString(),
                       PlacerContactAddress?.ToDelimitedString(),
                       PlacerContactLocation?.ToDelimitedString(),
                       FillerContactPerson?.ToDelimitedString(),
                       FillerContactPhoneNumber?.ToDelimitedString(),
                       FillerContactAddress?.ToDelimitedString(),
                       FillerContactLocation?.ToDelimitedString(),
                       EnteredByPerson?.ToDelimitedString(),
                       EnteredByPhoneNumber != null ? string.Join(Configuration.FieldRepeatSeparator, EnteredByPhoneNumber.Select(x => x.ToDelimitedString())) : null,
                       EnteredByLocation?.ToDelimitedString(),
                       ParentPlacerAppointmentId?.ToDelimitedString(),
                       ParentFillerAppointmentId?.ToDelimitedString(),
                       FillerStatusCode?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
        public async Task <IActionResult> Create([Bind("Id,Option,Price")] AppointmentReason appointmentReason)
        {
            if (ModelState.IsValid)
            {
                _context.Add(appointmentReason);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(appointmentReason));
        }
Example #5
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell = tableView.DequeueReusableCell("CellId", indexPath);

            if (AppointmentTypes != null)
            {
                AppointmentReason apptType = AppointmentTypes[indexPath.Row];
                cell.TextLabel.Text       = apptType.Name;
                cell.DetailTextLabel.Text = apptType.Description;
            }
            return(cell);
        }
Example #6
0
        public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender)
        {
            base.PrepareForSegue(segue, sender);
            //set the appointment reason
            AppReasonViewController controller = segue.SourceViewController as AppReasonViewController;
            AppointmentReason       reason     = ApplicationData.Current.AppointmentTypes[controller.TableView.IndexPathForSelectedRow.Row];

            ApplicationData.Current.NewAppointment.AppointmentType = new EntityStatus {
                Value = reason.AppointmentTypeCode, DisplayLabel = reason.Name
            };
            ApplicationData.Current.NewAppointment.AppointmentSubType = new EntityStatus {
                Value = reason.AppointmentSubTypeCode
            };
        }
Example #7
0
            public async Task <int> Handle(CreateAppointmentReasonCommand request, CancellationToken cancellationToken)
            {
                var model = request.Model;
                var item  = await Context.AppointmentReasons
                            .Where(p => p.AppointmentReasonId == model.AppointmentReasonId)
                            .FirstOrDefaultAsync(cancellationToken);

                if (item != null)
                {
                    throw new AlreadyExistsException(nameof(AppointmentReason), nameof(model.AppointmentReasonId), model.AppointmentReasonId);
                }

                var newRecord = new AppointmentReason
                {
                    Description = model.Description
                };

                Context.AppointmentReasons.Add(newRecord);
                await Context.SaveChangesAsync(cancellationToken);

                return(newRecord.AppointmentReasonId);
            }