Ejemplo n.º 1
0
        /// <summary>
        /// Method adds a new appointment with selected time and date
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAddAppointment_Click(object sender, RoutedEventArgs e)
        {
            if (!MyCalendar.SelectedDate.HasValue)
            {
                MyCalendar.SelectedDate = DateTime.Now;
            }
            DateTime calendarDate = MyCalendar.SelectedDate.Value;

            string tmp = calendarDate.ToString("yyyy-MM-dd") + " " + cbHour.Text + ":" + cbMinute.Text + ":00";

            DateTime         timestamp = DateTime.Parse(tmp);
            AppointmentModel app       = new AppointmentModel();

            app.ClientID  = client.ID;
            app.Timestamp = timestamp;
            app.Client    = client;
            app.ID        = app.Add();
            AppointmentList.Add(app);
            MyDataGridPlan.Items.Refresh();
            cbHour.SelectedIndex        = -1;
            cbMinute.SelectedIndex      = -1;
            btnAddAppointment.IsEnabled = false;

            if (mainWindow.MyCalendarPV.SelectedDate != null && mainWindow.MyCalendarPV.SelectedDate.Value == calendarDate)
            {
                mainWindow.AppointmentList.Add(app);
                mainWindow.MyDataGridApp.Items.Refresh();
            }
        }
Ejemplo n.º 2
0
        public ActionResult ConfirmAppointment(AppointmentModel model)
        {
            if (ModelState.IsValid)
            {
                var isSaved = model.Add();
                if (isSaved)
                {
                    return(View());
                }
            }

            return(RedirectToAction("GetAppointment", model));
        }