public override void ViewDidLoad() { base.ViewDidLoad(); this.CurrentFrame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Size.Width, UIScreen.MainScreen.Bounds.Size.Height); this.AddButton(); //Creating an instance for SfSchedule control SFSchedule schedule = new SFSchedule(); schedule.Frame = new CGRect(0, removeExceptionAppointment.Frame.Bottom, this.CurrentFrame.Size.Width, this.CurrentFrame.Size.Height - removeExceptionAppointment.Frame.Bottom); schedule.ScheduleView = SFScheduleView.SFScheduleViewWeek; NSCalendar calendar = new NSCalendar(NSCalendarType.Gregorian); NSDate today = NSDate.Now; // Get the year, month, day from the date NSDateComponents startDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the year, month, day, hour, minute, second startDateComponents.Year = 2017; startDateComponents.Month = 09; startDateComponents.Day = 03; startDateComponents.Hour = 10; startDateComponents.Minute = 0; startDateComponents.Second = 0; //setting start time for the event NSDate startDate = calendar.DateFromComponents(startDateComponents); //setting end time for the event NSDate endDate = startDate.AddSeconds(2 * 60 * 60); // set moveto date to schedule schedule.MoveToDate(startDate); // Set the exception dates. var exceptionDate1 = startDate; var exceptionDate2 = startDate.AddSeconds(2 * 24 * 60 * 60); exceptionDate3 = startDate.AddSeconds(4 * 24 * 60 * 60); // Add Schedule appointment ScheduleAppointment recurrenceAppointment = new ScheduleAppointment(); recurrenceAppointment.Id = 1; recurrenceAppointment.StartTime = startDate; recurrenceAppointment.EndTime = endDate; recurrenceAppointment.Subject = (NSString)"Occurs Daily"; recurrenceAppointment.AppointmentBackground = UIColor.Blue; recurrenceAppointment.RecurrenceRule = (NSString)"FREQ=DAILY;COUNT=20"; recurrenceAppointment.RecurrenceExceptionDates = new System.Collections.ObjectModel.ObservableCollection <NSDate> { exceptionDate1, exceptionDate2, exceptionDate3 }; scheduleAppointmentCollection.Add(recurrenceAppointment); schedule.ItemsSource = scheduleAppointmentCollection; this.View.AddSubview(schedule); }
private void ReadData() { SqlConnection con = new SqlConnection(ConnectionString); string sql = "select * from ScheduleData"; con.Open(); SqlCommand cmd = new SqlCommand(sql, con); SqlDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { ScheduleAppointment item = new ScheduleAppointment(); item.UniqueID = (int)dr["UniqueID"]; item.Subject = (string)dr["Sub"]; item.StartTime = (DateTime)dr["StartTime"]; item.ReminderValue = (int)dr["ReminderValue"]; item.Reminder = false; item.Owner = (int)dr["Own"]; item.MarkerValue = (int)dr["MarkerValue"]; item.LocationValue = (string)dr["LocationValue"]; item.LabelValue = 0; item.EndTime = (DateTime)dr["EndDate"]; item.Content = (string)dr["Content"]; item.AllDay = false; item.Dirty = false; list.Add(item); } }
private void SfSchedule_ScheduleTappedEvent(object sender, CellTappedEventArgs e) { viewOptionLayout.OptionLayout.Visibility = ViewStates.Invisible; var schedule = (sender as SfSchedule); if ((e.ScheduleAppointment as ScheduleAppointment) != null) { SelectedAppointment = (e.ScheduleAppointment as ScheduleAppointment); indexOfAppointment = schedule.Appointments.IndexOf((e.ScheduleAppointment as ScheduleAppointment)); } else { SelectedAppointment = null; indexOfAppointment = -1; } if (schedule.ScheduleView == ScheduleView.MonthView) { schedule.ScheduleView = ScheduleView.DayView; schedule.MoveToDate = e.Calendar; } else { linearLayout.Visibility = ViewStates.Invisible; editor.EditorLayout.Visibility = ViewStates.Visible; editor.UpdateEditor((e.ScheduleAppointment as ScheduleAppointment), (e.Calendar as Calendar)); } }
//Creating appointments for ScheduleAppointmentCollection private void getAppointments() { appointmentCollection = new ScheduleAppointmentCollection(); setColors(); RandomNumbers(); setSubjects(); setStartTime(); setEndTime(); for (int i = 0; i < 10; i++) { var scheduleAppointment = new ScheduleAppointment(); scheduleAppointment.Color = Color.ParseColor(colorCollection[i]); scheduleAppointment.Subject = subjectCollection[i]; scheduleAppointment.StartTime = startTimeCollection[i]; scheduleAppointment.EndTime = endTimeCollection[i]; if (i == 4 || i == 9) { scheduleAppointment.IsAllDay = true; } appointmentCollection.Add(scheduleAppointment); } // Minimum Height Appointments for (int i = 0; i < 5; i++) { var scheduleAppointment = new ScheduleAppointment(); scheduleAppointment.Color = Color.ParseColor(colorCollection[i]); scheduleAppointment.Subject = minTimeSubjectCollection[i]; scheduleAppointment.StartTime = minStartTimeCollection[i]; scheduleAppointment.EndTime = minStartTimeCollection[i]; // Setting Mininmum Appointment Height for Schedule Appointments scheduleAppointment.MinHeight = 50; appointmentCollection.Add(scheduleAppointment); } }
public void UpdateEditor(ScheduleAppointment selectedAppointment, DateTime dateTime, SfSchedule schedule) { selected_appointment = null; if (selectedAppointment != null) { selected_appointment = (ScheduleAppointment)selectedAppointment; DateTime start_time = selected_appointment.StartTime; DateTime end_time = selected_appointment.EndTime; subject_text.Text = selected_appointment.Subject; location_text.Text = selected_appointment.Location; index_of_appointment = getIndexOfAppointment(selected_appointment, (Schedule.DataSource as ScheduleAppointmentCollection));; start_date_picker.Date = new DateTime(start_time.Year, start_time.Month, start_time.Day); start_time_picker.Time = new TimeSpan(start_time.Hour, start_time.Minute, start_time.Second); end_date_picker.Date = new DateTime(end_time.Year, end_time.Month, end_time.Day); end_time_picker.Time = new TimeSpan(end_time.Hour, end_time.Minute, end_time.Second); } else { subject_text.Text = ""; location_text.Text = ""; DateTime s_time = dateTime; //args.datetime;// start_date_picker.Date = new DateTime(s_time.Year, s_time.Month, s_time.Day); start_time_picker.Time = new TimeSpan(s_time.Hour, s_time.Minute, s_time.Second); // start_time_picker.Format = "12 hours"; end_date_picker.Date = new DateTime(s_time.Year, s_time.Month, s_time.Day); end_time_picker.Time = new TimeSpan(s_time.Hour + 1, s_time.Minute, s_time.Second); } start_date_picker.DateSelected += StartDatePickerDateSelected; end_date_picker.DateSelected += EndDatePickerDateSelected; start_time_picker.PropertyChanged += StartTimePickerPropertyChanged; end_time_picker.PropertyChanged += EndTimePickerPropertyChanged; //Date Label start_date_label.Text = start_date_picker.Date.ToString("MMMM dd, yyyy"); end_date_label.Text = end_date_picker.Date.ToString("MMMM dd, yyyy"); //Time Label if (end_time_picker.Time.Hours / 12 <= 0) { end_time_label.Text = end_time_picker.Time.ToString("") + " AM"; } else { var timePicker = (end_time_picker).Time; timePicker = new TimeSpan((end_time_picker).Time.Hours - 12, (end_time_picker).Time.Minutes, (end_time_picker).Time.Seconds); end_time_label.Text = timePicker.ToString("") + " PM"; } if (start_time_picker.Time.Hours / 12 <= 0) { start_time_label.Text = start_time_picker.Time.ToString("") + " AM"; } else { var time_picker = (start_time_picker).Time; time_picker = new TimeSpan((start_time_picker).Time.Hours - 12, (start_time_picker).Time.Minutes, (start_time_picker).Time.Seconds); start_time_label.Text = time_picker.ToString("") + " PM"; } }
public void UpdateEditor(ScheduleAppointment appointment, Calendar date) { SelectedAppointment = appointment; if (appointment != null) { subjectInput.Text = appointment.Subject.ToString(); locationInput.Text = appointment.Location; startDateName.Text = dateFormat.Format(appointment.StartTime.Time); startTimeName.Text = timeFormat.Format(appointment.StartTime.Time); endDateName.Text = dateFormat.Format(appointment.EndTime.Time); endTimeName.Text = timeFormat.Format(appointment.EndTime.Time); StartTime = appointment.StartTime; EndTime = appointment.EndTime; } else { subjectInput.Text = ""; startDateName.Text = dateFormat.Format(date.Time); startTimeName.Text = timeFormat.Format(date.Time) + ""; Calendar _endTime = (Calendar)date.Clone(); _endTime.Add(CalendarField.Hour, 1); endDateName.Text = dateFormat.Format(_endTime.Time); endTimeName.Text = timeFormat.Format(_endTime.Time) + ""; StartTime = date; EndTime = _endTime; } }
public async Task <IActionResult> Index(ScheduleAppointment form, string returnUrl) { ViewBag.SelectiveTab = "scheduleappointment"; if (ModelState.IsValid) { var userName = form.Email; if (User.Identity.IsAuthenticated) { userName = User.Identity.Name; } var newSchedule = new Customer { FirstName = form.FirstName, LastName = form.LastName, Address = form.Address, City = form.City, PhoneNumber = form.PhoneNumber, PostalCode = form.PostalCode, State = form.State, Email = form.Email, CreatedBy = userName, UpdatedBy = userName, DateCreated = DateTime.UtcNow, DateUpdated = DateTime.UtcNow, CustomerApplianceProblems = new List <CustomerApplianceProblem>() { new CustomerApplianceProblem() { CustomerApplianceTypeId = form.CustomerApplianceTypeId, CustomerApplianceBrandId = form.CustomerApplianceBrandId, Problem = form.Problem, DesiredScheduleTime = form.DesiredScheduleTime, ModelNumber = form.ModelNumber, ModelSerial = form.ModelSerial, CreatedBy = userName, DateCreated = DateTime.UtcNow, ProblemStatus = "NEW" } } }; //Update and Save Here _customerRepo.Add(newSchedule); _customerRepo.SaveAll(); //Send Email ViewBag.ScheduleConfirmed = "YES"; //send email string body = this.createEmailBody(form); await _emailSender.SendEmailAsync("", "from Schedule Appointment page", body); ModelState.Clear(); // Clear the form ViewBag.UserMessage = string.Format("Dear {0},{1}We appreciate you contacting us.{1} One of our colleagues will get back to you shortly.", form.FirstName, "\n"); //Notify Users return(Confirmation(form)); } return(View(form)); }
public async void BuscarSchedulesAsync() { try { IsBusy = true; Schedules = new ObservableCollection <ScheduleAppointment>(); Action = await actionRepository.GetAsync(Action.Id); var ex = await scheduleRepository.GetAppointmentsByIdActionAsync(Action.Id); for (int i = 0; i < ex.Count(); i++) { ScheduleAppointment appointment = new ScheduleAppointment(); appointment.Subject = "Fechado"; appointment.Color = ex.ElementAt(i).Cor; appointment.StartTime = ex.ElementAt(i).StartTime; appointment.EndTime = ex.ElementAt(i).EndTime; Schedules.Add(appointment); } IsBusy = false; } catch (Exception) { throw; } }
public async Task <IActionResult> Edit(int id, [Bind("scheduleAppointmentId,scheduleId,appointmentId")] ScheduleAppointment scheduleAppointment) { if (id != scheduleAppointment.scheduleAppointmentId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(scheduleAppointment); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ScheduleAppointmentExists(scheduleAppointment.scheduleAppointmentId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(scheduleAppointment)); }
/// <summary> /// initialize the appointments /// </summary> /// <param name="count">count value</param> private void IntializeAppoitments(int count) { for (int i = 0; i < count; i++) { ScheduleAppointment scheduleAppointment = new ScheduleAppointment(); scheduleAppointment.Color = this.colorCollection[i]; scheduleAppointment.Subject = this.teamManagement[i]; scheduleAppointment.StartTime = this.startTimeCollection[i]; scheduleAppointment.EndTime = this.endTimeCollection[i]; this.Appointments.Add(scheduleAppointment); } int allDayCount = 0; //// AllDay Appointment for (int i = 0; i < count; i++) { ScheduleAppointment allDayAppointment = new ScheduleAppointment(); allDayAppointment.Color = this.colorCollection[allDayCount]; allDayAppointment.Subject = this.allDayTeamManagement[allDayCount]; allDayAppointment.StartTime = this.startTimeCollection[i]; allDayAppointment.EndTime = this.endTimeCollection[i]; allDayAppointment.IsAllDay = true; this.Appointments.Add(allDayAppointment); allDayCount = allDayCount + 1; i = i + 1; } }
//Borrar Citas public async Task <ActionResult> Delete(int Id) { if (User.Identity.Name != null) { var user = await _userManager.FindByEmailAsync(User.Identity.Name); var administrador = user.Administrador; if (administrador == true) { TempData["hablitarUser"] = "******"; } } //------------------------------------------------------------------------------------------------------------- //Models ScheduleAppointment scheduleAppointmentList = null; using (var client = new HttpClient()) { client.BaseAddress = new Uri(BaseUrl); //Http Get var responseTask = client.GetAsync("api/ScheduleAppointments/" + Id.ToString()); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <ScheduleAppointment>(); readTask.Wait(); scheduleAppointmentList = readTask.Result; } } return(View(scheduleAppointmentList)); }
public AppointmentViewModel() { // Set the commands for Add/Remove the exception dates. this.SetUpCommands(); // Create the new recurrence exception dates. var exceptionDate = new DateTime(2017, 09, 07); var recExcepDate2 = new DateTime(2017, 09, 03); var recExcepDate3 = new DateTime(2017, 09, 05); //Adding schedule appointment in schedule appointment collection var recurrenceAppointment = new ScheduleAppointment() { Id = 1, StartTime = new DateTime(2017, 09, 01, 10, 0, 0), EndTime = new DateTime(2017, 09, 01, 12, 0, 0), Subject = "Occurs Daily", Color = Color.Blue, RecurrenceRule = "FREQ=DAILY;COUNT=20" }; // Add RecuurenceExceptionDates to appointment. recurrenceAppointment.RecurrenceExceptionDates = new ObservableCollection <DateTime>() { exceptionDate, recExcepDate2, recExcepDate3, }; //Adding schedule appointment in schedule appointment collection Appointments.Add(recurrenceAppointment); }
public AppointmentEditor(SfScheduler scheduler, ScheduleAppointment appointment, DateTime dateTime) { InitializeComponent(); GetTimeZone(); this.scheduler = scheduler; this.appointment = appointment; if (appointment != null) { this.Subject.Text = appointment.Subject; this.StartDatePicker.Value = appointment.StartTime.Date; this.EndDatePicker.Value = appointment.EndTime.Date; this.StartTimePicker.Value = appointment.StartTime; this.EndTimePicker.Value = appointment.EndTime; this.location.Text = appointment.Location; this.description.Text = appointment.Notes; this.allDay.IsChecked = appointment.IsAllDay; this.ReminderList.ItemsSource = (IList)appointment.Reminders; this.ReminderList.ItemContainerGenerator.StatusChanged += this.OnListViewItemGeneratorStatusChanged; this.timeZone.IsChecked = (appointment.StartTimeZone != null); if ((bool)this.timeZone.IsChecked) { this.TimeZoneMenu.Text = appointment.StartTimeZone.ToString(); } } else { this.StartDatePicker.Value = dateTime.Date; this.EndDatePicker.Value = dateTime.Date; this.StartTimePicker.Value = dateTime; this.EndTimePicker.Value = dateTime.AddHours(1); } }
private string createEmailBody(ScheduleAppointment model) { string body = string.Empty; var pathToFile = _env.WebRootPath + Path.DirectorySeparatorChar.ToString() + "templates" + Path.DirectorySeparatorChar.ToString() + "EmailTemplate" + Path.DirectorySeparatorChar.ToString() + "ScheduleAppointment.html"; body = System.IO.File.ReadAllText(pathToFile); body = body.Replace("{FirstName}", model.FirstName); //replacing the required things body = body.Replace("{LastName}", model.LastName); body = body.Replace("{Phone}", model.PhoneNumber); body = body.Replace("{Email}", model.Email); body = body.Replace("{Address}", model.Address); body = body.Replace("{City}", model.City); body = body.Replace("{PostalCode}", model.PostalCode); body = body.Replace("{State}", model.State); body = body.Replace("{DesiredScheduleTime}", model.DesiredScheduleTime.ToString("yyyy-MM-ddTHH:mm")); body = body.Replace("{ModelNumber}", model.ModelNumber); body = body.Replace("{ModelSerial}", model.ModelSerial); body = body.Replace("{Problem}", model.Problem); return(body); }
private void CreateResourceAppointments() { Random random = new Random(); DateTime date; DateTime dateFrom = DateTime.Now.AddYears(-1).AddDays(-20); DateTime dateTo = DateTime.Now.AddYears(1).AddDays(20); foreach (var resource in Employees) { for (date = dateFrom; date < dateTo; date = date.AddDays(1)) { ScheduleAppointment workDetails = new ScheduleAppointment(); workDetails.StartTime = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0); workDetails.EndTime = workDetails.StartTime.AddHours(1); workDetails.Subject = this.currentDayMeetings[random.Next(6)]; workDetails.AppointmentBackground = workDetails.Subject == "Work" ? new SolidColorBrush(Colors.Green) : (workDetails.Subject == "Off" ? new SolidColorBrush(Colors.Gray) : new SolidColorBrush(Colors.Red)); workDetails.IsAllDay = true; workDetails.ResourceIdCollection = new ObservableCollection <object> { (resource as Employee).ID }; this.Events.Add(workDetails); } } }
/// <summary> /// A static method that provides random data, not really a part of the implementations. /// </summary> /// <returns>A SimpleScheduleAppointmentList object holding sample data.</returns> //public static SimpleRecurringScheduleAppointmentList InitializeRandomData() public static SimpleScheduleAppointmentList InitializeRandomData() { //int tc = Environment.TickCount; //int tc = 26260100;// simple spread int tc = 28882701; // split the appointment across midnight & 3 items at 8am on 2 days ago //Console.WriteLine("Random seed: {0}", tc); Random r = new Random(tc); Random r1 = new Random(tc); // set the number of sample items you want in this list. //int count = r.Next(20) + 4; int count = 400;//1000;//200;//30; // SimpleRecurringScheduleAppointmentList masterList = new SimpleRecurringScheduleAppointmentList(); SimpleScheduleAppointmentList masterList = new SimpleScheduleAppointmentList(); DateTime now = DateTime.Now.Date; for (int i = 0; i < count; ++i) { ScheduleAppointment item = masterList.NewScheduleAppointment() as ScheduleAppointment; //int dayOffSet = 0; //int hourOffSet = 8 - r.Next(16); //int dayOffSet = 3 - r.Next(6); int dayOffSet = 30 - r.Next(60); //int dayOffSet = 100 - r.Next(200); int hourOffSet = 24 - r.Next(48); int len = 30 * (r.Next(4) + 1); item.StartTime = now.AddDays((double)dayOffSet).AddHours((double)hourOffSet);; item.EndTime = item.StartTime.AddMinutes((double)len); item.Subject = string.Format("subject{0}", i); item.Content = string.Format("content{0}", i); item.LabelValue = r1.Next(10) < 3 ? 0 : r1.Next(10); item.LocationValue = string.Format("location{0}", r1.Next(5)); item.ReminderValue = r1.Next(10) < 5 ? 0 : r1.Next(12); item.Reminder = r1.Next(10) > 1; item.AllDay = r1.Next(10) < 1; item.MarkerValue = r1.Next(4); item.Dirty = false; masterList.Add(item); } ////set explicit values if needed for testing... //masterList[142].Reminder = true; //masterList[142].ReminderValue = 9;// hrs; // 7;//3 hrs //DisplayList("Before Sort", masterList); masterList.SortStartTime(); //DisplayList("After Sort", masterList); return(masterList); }
private ObservableCollection <ScheduleAppointment> CreateAppointments() { NSDate today = new NSDate(); NSCalendar calendar = NSCalendar.CurrentCalendar; // Get the year, month, day from the date NSDateComponents components = calendar.Components( NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second components.Hour = 10; components.Minute = 0; components.Second = 0; NSDate startDate = calendar.DateFromComponents(components); // Get the year, month, day from the date NSDateComponents endDateComponents = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second endDateComponents.Hour = 12; endDateComponents.Minute = 0; endDateComponents.Second = 0; NSDate endDate = calendar.DateFromComponents(endDateComponents); ScheduleAppointment appointment = new ScheduleAppointment(); appointment.StartTime = startDate; appointment.EndTime = endDate; appointment.Subject = new NSString("Jeni's B'Day Celebration"); appointment.AppointmentBackground = UIColor.FromRGB(0xA2, 0xC1, 0x39); NSDateComponents components1 = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second components1.Hour = 11; components1.Minute = 0; components1.Second = 0; components1.Day = components1.Day + 1; NSDate startDate1 = calendar.DateFromComponents(components1); // Get the year, month, day from the date NSDateComponents endDateComponents1 = calendar.Components(NSCalendarUnit.Year | NSCalendarUnit.Month | NSCalendarUnit.Day, today); // Set the hour, minute, second endDateComponents1.Hour = 13; endDateComponents1.Minute = 30; endDateComponents1.Second = 0; endDateComponents1.Day = endDateComponents1.Day + 1; NSDate endDate1 = calendar.DateFromComponents(endDateComponents1); ScheduleAppointment appointment1 = new ScheduleAppointment(); appointment1.StartTime = startDate1; appointment1.EndTime = endDate1; appointment1.Subject = new NSString("Checkup"); appointment1.AppointmentBackground = UIColor.FromRGB(0xD8, 0x00, 0x73); ObservableCollection <ScheduleAppointment> appCollection = new ObservableCollection <ScheduleAppointment>(); appCollection.Add(appointment); appCollection.Add(appointment1); return(appCollection); }
/* * public string ColorPerSubject(string subject) * { * string color; * if (subject.Contains("Vet")) * color = "#ee42f4"; * * else if (subject.Contains("Haircut")) * color = Color.LightPink; * else if (subject.Contains("Medicine")) * color = Color.LightGray; * else if (subject.Contains("Buy dog food")) * color = Color.LightYellow; * else if (subject.Contains("Put food")) * color = Color.Maroon; * else if (subject.Contains("Put water")) * color = Color.Red; * else * color = Color.LightCoral; * * return color; * } */ #endregion #region Save public void saveAppointment() { ScheduleAppointment newAppointment = new ScheduleAppointment(); newAppointment = selected_appointment; SqliteConnectionSet.AppointmentCollection.Remove(selected_appointment); SqliteConnectionSet.AppointmentCollection.Add(newAppointment); }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); this.Save.Click -= this.OnSaveClicked; this.Cancel.Click -= this.OnCancelClicked; this.scheduler = null; this.appointment = null; }
async public void SaveButton_Clicked(object sender, EventArgs e) { Meeting meet; if (selected_appointment == null) { selected_appointment = new ScheduleAppointment(); meet = new Meeting(); } else { meet = await Schedule.FindAppointment(selected_appointment); } if (location_text.Text != null) { selected_appointment.Location = location_text.Text.ToString(); meet.Location = location_text.Text.ToString(); } if (subject_text.Text != null) { if (subject_text.Text.Equals("Vet") || subject_text.Text.Equals("Haircut") || subject_text.Text.Equals("Medicine")) { selected_appointment.Subject = subject_text.Text.ToString() + " For " + App.currentDog.DogName; } else { selected_appointment.Subject = subject_text.Text.ToString(); } meet.Subject = selected_appointment.Subject; } selected_appointment.StartTime = start_date_picker.Date.Add(start_time_picker.Time); selected_appointment.EndTime = end_date_picker.Date.Add(end_time_picker.Time); meet.From = selected_appointment.StartTime.ToString(); meet.To = selected_appointment.EndTime.ToString(); //Color color = ColorPerSubject(selected_appointment.Subject); //selected_appointment.Color = Color.Red; //meet.Color = color.ToString if (SqliteConnectionSet.isNewAppointment) { saveNewAppintment(selected_appointment); await SqliteConnectionSet._connection.InsertAsync(meet); SqliteConnectionSet._appointments.Add(meet); Schedule.AddNewMeetingToSchedule(meet); SqliteConnectionSet.isNewAppointment = false; } else { saveAppointment(); await SqliteConnectionSet._connection.UpdateAsync(meet); } this.IsVisible = false; SqliteConnectionSet.mainStack.Children[0].IsVisible = true; }
private void Schedule_CellTapped(object sender, CellTappedEventArgs e) { ScheduleAppointment schedule = e.Appointment as ScheduleAppointment; if (schedule != null) { _viewModel.VisualizeAppointments(schedule.Notes); } }
public EventInformation(ScheduleAppointment apt) { InitializeComponent(); //get the event information by id and display in the view LabelEventTitle.Text = "Subject: " + apt.Subject; LabelEventStartTime.Text = "Appointment Start: " + apt.StartTime.ToLocalTime().ToString(); LabelEventEndTime.Text = "Appointment End: " + apt.EndTime.ToLocalTime().ToString(); }
public IActionResult ScheduleAppointmentAddOrEdit([FromBody] ScheduleAppointmentModel model) { APIJsonResult result = new APIJsonResult(); result.Access = true; result.success = true; var currentUserToken = User.Claims.SingleOrDefault(x => x.Type == "UserRole") != null?User.Claims.SingleOrDefault(x => x.Type == "UserRole").Value : null; if (currentUserToken == null) { result.Msg.Add("Session Time Out"); result.success = false; result.Access = true; return(Ok(result)); } if (model == null) { result.Msg.Add("Model Null"); result.success = false; result.Access = true; return(Ok(result)); } if (model.Id == 0) { ScheduleAppointment scheduleAppointment = new ScheduleAppointment() { Notes = model.Notes, UserId = Convert.ToInt32(User.Claims.SingleOrDefault(x => x.Type == "UserId") != null ? User.Claims.SingleOrDefault(x => x.Type == "UserId").Value : null), VisitType = model.VisitType, Appointment = PublicFunctions.ConvertTimestampToDateTime(model.Appointment), DoctorId = model.DoctorId, Status = 1, }; _scheduleAppointment.Add(scheduleAppointment); _context.SaveChanges(); } else { var scheduleAppointment = _scheduleAppointment.Where(x => x.Id == model.Id).FirstOrDefault(); if (scheduleAppointment == null) { result.Msg.Add("Not found"); result.success = false; result.Access = true; return(Ok(result)); } scheduleAppointment.Notes = model.Notes; scheduleAppointment.VisitType = model.VisitType; scheduleAppointment.Appointment = PublicFunctions.ConvertTimestampToDateTime(model.Appointment); scheduleAppointment.DoctorId = model.DoctorId; _scheduleAppointment.Update(scheduleAppointment); _context.SaveChanges(); } return(Ok(result)); }
//creating RecurrsiveAppointments private void CreateRecurrsiveAppointments() { RecurssiveAppointmentCollection = new ScheduleAppointmentCollection(); //Recurrence Appointment 1 ScheduleAppointment alternativeDayAppointment = new ScheduleAppointment(); DateTime currentDate = DateTime.Now; DateTime startTime = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 9, 0, 0); DateTime endTime = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 10, 0, 0); alternativeDayAppointment.StartTime = startTime; alternativeDayAppointment.EndTime = endTime; alternativeDayAppointment.Color = Color.FromHex("#FFA2C139"); alternativeDayAppointment.Subject = "Occurs every 2 days"; alternativeDayAppointment.IsRecursive = true; RecurrenceProperties recurrencePropertiesForAlternativeDay = new RecurrenceProperties(); recurrencePropertiesForAlternativeDay.RecurrenceType = RecurrenceType.Daily; recurrencePropertiesForAlternativeDay.IsDailyEveryNDays = true; recurrencePropertiesForAlternativeDay.DailyNDays = 2; recurrencePropertiesForAlternativeDay.IsRangeRecurrenceCount = true; recurrencePropertiesForAlternativeDay.IsRangeNoEndDate = false; recurrencePropertiesForAlternativeDay.IsRangeEndDate = false; recurrencePropertiesForAlternativeDay.RangeRecurrenceCount = 10; recurrencePropertiesForAlternativeDay.RecurrenceRule = "FREQ=DAILY;COUNT=10;INTERVAL=2"; alternativeDayAppointment.RecurrenceRule = recurrencePropertiesForAlternativeDay.RecurrenceRule; RecurssiveAppointmentCollection.Add(alternativeDayAppointment); //Recurrence Appointment 2 ScheduleAppointment weeklyAppointment = new ScheduleAppointment(); DateTime startTime1 = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 11, 0, 0); DateTime endTime1 = new DateTime(currentDate.Year, currentDate.Month, currentDate.Day, 12, 0, 0); weeklyAppointment.StartTime = startTime1; weeklyAppointment.EndTime = endTime1; weeklyAppointment.Color = Color.FromHex("#FFD80073"); weeklyAppointment.Subject = "Occurs every monday"; weeklyAppointment.IsRecursive = true; RecurrenceProperties recurrencePropertiesForWeeklyAppointment = new RecurrenceProperties(); recurrencePropertiesForWeeklyAppointment.RecurrenceType = RecurrenceType.Weekly; recurrencePropertiesForWeeklyAppointment.IsRangeRecurrenceCount = true; recurrencePropertiesForWeeklyAppointment.WeeklyEveryNWeeks = 1; recurrencePropertiesForWeeklyAppointment.IsWeeklySunday = false; recurrencePropertiesForWeeklyAppointment.IsWeeklyMonday = true; recurrencePropertiesForWeeklyAppointment.IsWeeklyTuesday = false; recurrencePropertiesForWeeklyAppointment.IsWeeklyWednesday = false; recurrencePropertiesForWeeklyAppointment.IsWeeklyThursday = false; recurrencePropertiesForWeeklyAppointment.IsWeeklyFriday = false; recurrencePropertiesForWeeklyAppointment.IsWeeklySaturday = false; recurrencePropertiesForWeeklyAppointment.RangeRecurrenceCount = 10; recurrencePropertiesForWeeklyAppointment.RecurrenceRule = "FREQ=WEEKLY;COUNT=10;BYDAY=MO"; weeklyAppointment.RecurrenceRule = recurrencePropertiesForWeeklyAppointment.RecurrenceRule; RecurssiveAppointmentCollection.Add(weeklyAppointment); }
public AppointmentModel(ScheduleAppointment scheduleAppointment, List <Attendee> attendees, string requerencePattern) { _appointment = scheduleAppointment; Name = Name; StartTime = StartTime; EndTime = EndTime; Location = Location; RequerencePattern = requerencePattern; _attendees = attendees; }
private void Schedule_DoubleTapped(object sender, CellTappedEventArgs e) { //base.didSelectDate (schedule, selectedDate, appointments); scheduleEditor.Editor.Hidden = false; headerView.Hidden = true; schedule.Hidden = true; indexOfAppointment = -1; tableView.Hidden = true; if (e.ScheduleAppointment != null) { for (int i = 0; i < (schedule.ItemsSource as ObservableCollection <ScheduleAppointment>).Count; i++) { if ((schedule.ItemsSource as ObservableCollection <ScheduleAppointment>)[i] == e.ScheduleAppointment) { indexOfAppointment = int.Parse(i.ToString()); break; } } selectedAppointment = (e.ScheduleAppointment); scheduleEditor.label_subject.Text = selectedAppointment.Subject; scheduleEditor.label_location.Text = selectedAppointment.Location; String _sDate = DateTime.Parse((selectedAppointment.StartTime.ToString())).ToString(); scheduleEditor.button_startDate.SetTitle(_sDate, UIControlState.Normal); scheduleEditor.picker_startDate.SetDate(selectedAppointment.StartTime, true); String _eDate = DateTime.Parse((selectedAppointment.EndTime.ToString())).ToString(); scheduleEditor.button_endDate.SetTitle(_eDate, UIControlState.Normal); scheduleEditor.picker_endDate.SetDate(selectedAppointment.EndTime, true); scheduleEditor.allDaySwitch.On = selectedAppointment.IsAllDay; if (scheduleEditor.allDaySwitch.On) { scheduleEditor.Disablechild(); } else { scheduleEditor.EnableChild(); } scheduleEditor.Editor.EndEditing(true); } else { List <UIColor> colorCollection = new List <UIColor>(); colorCollection.Add(UIColor.FromRGB(0xA2, 0xC1, 0x39)); colorCollection.Add(UIColor.FromRGB(0xD8, 0x00, 0x73)); scheduleEditor.label_subject.Text = "Subject"; scheduleEditor.label_location.Text = "Location"; String _sDate = DateTime.Parse((e.Date.ToString())).ToString(); scheduleEditor.picker_startDate.SetDate(e.Date, true); scheduleEditor.button_startDate.SetTitle(_sDate, UIControlState.Normal); String _eDate = DateTime.Parse((e.Date.AddSeconds(3600).ToString())).ToString(); scheduleEditor.picker_endDate.SetDate(e.Date.AddSeconds(3600), true); scheduleEditor.button_endDate.SetTitle(_eDate, UIControlState.Normal); scheduleEditor.allDaySwitch.On = false; this.scheduleEditor.EnableChild(); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); LinearLayout linearLayout = new LinearLayout(this); linearLayout.Orientation = Orientation.Vertical; this.AddButton(linearLayout); //Creating an instance for SfSchedule Control SfSchedule schedule = new SfSchedule(this); schedule.ScheduleView = Com.Syncfusion.Schedule.Enums.ScheduleView.WeekView; // Creating an instance for schedule appointment Collection Calendar startTime = (Calendar)currentDate.Clone(); //setting start time for the event startTime.Set(2017, 08, 03, 10, 0, 0); Calendar endTime = (Calendar)currentDate.Clone(); //setting end time for the event endTime.Set(2017, 08, 03, 12, 0, 0); // move to date. schedule.MoveToDate = startTime; // Set exception dates. var exceptionDate1 = Calendar.Instance; exceptionDate1.Set(2017, 08, 03); var exceptionDate2 = Calendar.Instance; exceptionDate2.Set(2017, 08, 05); exceptionDate3 = Calendar.Instance; exceptionDate3.Set(2017, 08, 07); ScheduleAppointment recurrenceAppointment = new ScheduleAppointment(); recurrenceAppointment.Id = 1; recurrenceAppointment.StartTime = startTime; recurrenceAppointment.EndTime = endTime; recurrenceAppointment.Subject = "Daily Occurs"; recurrenceAppointment.Color = Color.Blue; recurrenceAppointment.RecurrenceRule = "FREQ=DAILY;COUNT=20"; recurrenceAppointment.RecurrenceExceptionDates = new ObservableCollection <Calendar> { exceptionDate1, exceptionDate2, exceptionDate3 }; scheduleAppointmentCollection.Add(recurrenceAppointment); //Adding schedule appointment collection to SfSchedule appointments schedule.ItemsSource = scheduleAppointmentCollection; linearLayout.AddView(schedule); SetContentView(linearLayout); }
public static void AddNewMeetingToSchedule(Meeting meet) { ScheduleAppointment appointment1 = new ScheduleAppointment(); appointment1.Location = meet.Location; appointment1.Subject = meet.Subject; appointment1.StartTime = Convert.ToDateTime(meet.From); appointment1.EndTime = Convert.ToDateTime(meet.To); //appointment1.Color = Color.FromHex(meet.Color); SqliteConnectionSet.AppointmentCollection.Add(appointment1); }
public async Task <IActionResult> Create([Bind("scheduleAppointmentId,scheduleId,appointmentId")] ScheduleAppointment scheduleAppointment) { if (ModelState.IsValid) { _context.Add(scheduleAppointment); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(scheduleAppointment)); }
private void IntializeAppoitments(int count) { for (int i = 0; i < count; i++) { ScheduleAppointment scheduleAppointment = new ScheduleAppointment(); scheduleAppointment.Color = color_collection[i]; scheduleAppointment.Subject = teamManagement[i]; scheduleAppointment.StartTime = start_time_collection[i]; scheduleAppointment.EndTime = end_time_collection[i]; Appointments.Add(scheduleAppointment); } }
public ScheduleAppointment MapTo(EventItem eventItem) { if (eventItem == null) { return null; } var scheduleAppointment = new ScheduleAppointment { Subject = eventItem.Title, StartTime = eventItem.StartsAt, EndTime = eventItem.EndsAt, Notes = eventItem.Description, Location = eventItem.Location, }; return scheduleAppointment; }