/// <summary>
        /// Call on navigated , initializate the view and set sources for list views
        /// </summary>
        /// <param name="e"></param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter == null)
            {
                //ViewModel = new CreateAppointmentViewModel();
            }
            else
            {
                ViewModel = new CreateAppointmentViewModel();
                ViewModel.SetCustomer(((NewPaymentData)e.Parameter).CustomerId);
            }

            //Customer Test = new Customer("12234543-k", "Marco Antonio", "Perez Gonzales", "03/03/1978 00:00:00", "Los leons 29",
            //    "Valpariso", "Valparaiso", "Chile", "gh567", "0983442233", "02122222", DateTime.Now, "Sin alergias");
            //  ViewModel.Customer = Test;

            av = new ApointmetsView();
            ScrollViewer sv = new ScrollViewer();

            sv.Content = av;
            SlotPickSP.Children.Add(sv);
            av.OnEmptySlotTapped += Av_OnEmptySlotTapped;

            CalDate.Date = DateTime.Now;

            ShowAppointments();

            CalDate.DateChanged += CalDate_DateChanged;
        }
        public ActionResult <ResponseObject> Post([FromBody] CreateAppointmentViewModel vm)
        {
            var _userId = User.Claims.First(f => f.Type == "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier").Value;

            var _user = this.db.Users.FirstOrDefault(f => f.AuthServiceId == _userId);

            var _student = this.db.Students.FirstOrDefault(f => f.UserId == _user.Id);

            var _appointment = new Appointment
            {
                StartTime   = vm.StartTime,
                EndTime     = vm.StartTime.AddHours(vm.AppointmentLength),
                IsCompleted = false,
                IsCancelled = false,
                Location    = vm.Location,
                StudentId   = _student.Id,
                TutorId     = vm.TutorId
            };

            this.db.Appointments.Add(_appointment);

            this.db.SaveChanges();

            var _rv = new ResponseObject
            {
                WasSuccessful = true,
                Results       = _appointment
            };

            return(_rv);
        }
        public ActionResult CreateAppointment(int id, int?day, int?month, int?year)
        {
            if (Session["Authen"] == null)
            {
                return(RedirectToAction("Login", "Home"));
            }


            if (month == null && year == null)
            {
                day   = DateTime.Now.Day;
                month = DateTime.Now.Month;
                year  = DateTime.Now.Year;
            }

            CheckExitsTimeSlot(day, month, year);

            CreateAppointmentViewModel result = new CreateAppointmentViewModel
            {
                date       = new DateTime(year.Value, month.Value, day.Value),
                member     = _MemberRepo.GetByID(id),
                pets       = _PetRepo.GetByMemberID(id),
                services   = _ServiceRepo.GetAll(),
                timeblocks = _TimeSlotRepo.GetListByDate(day.Value, month.Value, year.Value)
            };

            return(View(result));
        }
Exemple #4
0
        public JsonResult CreateAppointment(CreateAppointmentViewModel subject)
        {
            var userId = User.GetLoggedInUserId <string>();


            return(CreateJsonResult(true));
        }
Exemple #5
0
        public ActionResult SandcastleBuilding(CreateAppointmentViewModel cavm)
        {
            int length = 1;

            CreateAppointment(cavm, length, "Sandcastle Building");
            return(RedirectToAction("Index"));
        }
Exemple #6
0
        public ActionResult WhaleWatching(CreateAppointmentViewModel cavm)
        {
            int length = 3;

            CreateAppointment(cavm, length, "Whale Watching");
            return(RedirectToAction("Index"));
        }
Exemple #7
0
        public ActionResult Massage(CreateAppointmentViewModel cavm)
        {
            int length = 1;

            CreateAppointment(cavm, length, "Massage");
            return(RedirectToAction("Index"));
        }
Exemple #8
0
        public ActionResult Spa(CreateAppointmentViewModel cavm)
        {
            int length = 3;

            CreateAppointment(cavm, length, "Spa");
            return(RedirectToAction("Index"));
        }
        // GET: Appointments/Create
        public ActionResult Create()
        {
            CreateAppointmentViewModel model = new CreateAppointmentViewModel();

            List <SelectListItem> itemsCustomer = new List <SelectListItem>();

            foreach (var item in Customers.GetCustomers())
            {
                var x = new SelectListItem {
                    Value = item.Id.ToString(), Text = item.Name
                };
                itemsCustomer.Add(x);
            }
            model.CustomersList = itemsCustomer;
            List <SelectListItem> itemsVehicles = new List <SelectListItem>();

            foreach (var item in Vehicles.GetVehicles())
            {
                var x = new SelectListItem {
                    Value = item.Id.ToString(), Text = item.Brand
                };
                itemsVehicles.Add(x);
            }
            model.VehiclesList = itemsVehicles;
            return(View(model));
        }
 public ScheduleEvent PrepareScheduleEventModel(CreateAppointmentViewModel appointmentViewModel, string userId = "")
 {
     return(new ScheduleEvent
     {
         Title = appointmentViewModel.Theme,
         Description = appointmentViewModel.Description,
         Location = appointmentViewModel.Location
     });
 }
        public ActionResult UpdateAppointment(CreateAppointmentViewModel model)
        {
            try
            {
                var timeZone = Request.Cookies["TimeZone"].Value;
                var authInfo = (AuthInfo)Session["auth_info"];
                if (authInfo == null)
                {
                    return(Json(new KeyValueResult(false, "Your session has expired. Please signin again."), JsonRequestBehavior.AllowGet));
                }
                var dateTimeExpected = model.ExpectedDate + " " + model.ExpectedTime;
                var dateExpected     = Utils.StringToDateTime(dateTimeExpected);
                var appointment      = new CreateUpdateAppointmentModel
                {
                    AppointmentId    = model.Id,
                    ClinicId         = authInfo.CurrentSelectedClinic.ClinicId,
                    PatientId        = model.PatientId,
                    DoctorId         = model.DoctorId,
                    DoctorName       = model.DoctorName,
                    ClinicName       = authInfo.CurrentSelectedClinic.ClinicName,
                    ClinicPhone      = authInfo.CurrentSelectedClinic.Phone,
                    ExpectedDuration = int.Parse(model.Duration),
                    CarerFirstName   = model.OtherFirstName,
                    CarerLastName    = model.OtherLastName,
                    IsCarer          = model.IsCarer ? 1 : 0,
                    IsNewPatient     = model.IsNewPatient,
                    Patient          = new PatientCreateAppointmentModel
                    {
                        PatientId = model.PatientId,
                        FirstName = model.FirstName,
                        LastName  = model.LastName,
                        Phone     = model.Phone,
                        Email     = model.Email
                    },
                    ExpectedStartDateTime = Utils.ToUTCTimeSpan(dateExpected, timeZone),
                    MeetingUri            = model.SipUriMeeting,
                    JoinMettingUrl        = model.UrlJoinMeeting,
                    IsFloating            = model.IsFloating
                };

                _appointmentService.UpdateAppointment(appointment);
                return(Json(new KeyValueResult(true, "Welio appointment successfully updated."), JsonRequestBehavior.AllowGet));
            }
            catch (ApiException ex)
            {
                return(Json(new KeyValueResult(false, ex.Message), JsonRequestBehavior.AllowGet));
            }
        }
        // GET: Appointments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var appointment = Appointments.GetAppointmentById(id.Value);

            if (appointment == null)
            {
                return(HttpNotFound());
            }

            CreateAppointmentViewModel model = new CreateAppointmentViewModel();

            List <SelectListItem> itemsCustomer = new List <SelectListItem>();

            foreach (var item in Customers.GetCustomers())
            {
                var x = new SelectListItem {
                    Value = item.Id.ToString(), Text = item.Name
                };
                itemsCustomer.Add(x);
            }
            model.CustomersList = itemsCustomer;
            List <SelectListItem> itemsVehicles = new List <SelectListItem>();

            foreach (var item in Vehicles.GetVehicles())
            {
                var x = new SelectListItem {
                    Value = item.Id.ToString(), Text = item.Brand
                };
                itemsVehicles.Add(x);
            }
            model.VehiclesList = itemsVehicles;
            model.Id           = id.Value;
            return(View(model));
        }
Exemple #13
0
        /// <summary>
        /// Wes Richardson
        /// Create: 2019/04/18
        ///
        /// Helper Method that creates the appointment
        /// </summary>
        /// <param name="cavm"></param>
        /// <param name="length"></param>

        private void CreateAppointment(CreateAppointmentViewModel cavm, int length, string type)
        {
            try
            {
                Appointment appointment = new Appointment
                {
                    AppointmentType = type,
                    StartDate       = cavm.StartDay.AddHours(cavm.StartTime),
                    EndDate         = cavm.StartDay.AddHours(cavm.StartTime + length),
                    Description     = cavm.Description,
                    GuestID         = _guestID
                };
                if (appointment.Description == null)
                {
                    appointment.Description = "";
                }
                _appointmentMgr.CreateAppointmentByGuest(appointment);
            }
            catch (Exception ex)
            {
                ViewBag.errorMessage = ex.Message;
            }
        }
Exemple #14
0
        //
        // GET: /Appointment/Create

        public ActionResult Create()
        {
            var model = new CreateAppointmentViewModel();

            return(View(model));
        }