protected override void InitSchedule(NSchedule schedule) { DateTime today = DateTime.Today; DateTime startDate = new DateTime(today.Year, 1, 1); // Create an appointment which occurs per 3 hours NAppointment appointment = new NAppointment("Meeting", today, today.AddHours(2)); NRecurrenceHourlyRule rule = new NRecurrenceHourlyRule(); rule.StartDate = startDate; rule.Interval = 3; appointment.RecurrenceRule = rule; schedule.Appointments.Add(appointment); // Create an appointment which occurs every hour and categorize it appointment = new NAppointment("Talking", today, today.AddHours(0.5)); rule = new NRecurrenceHourlyRule(); rule.StartDate = startDate; rule.Interval = 1; appointment.RecurrenceRule = rule; appointment.Category = "Red"; schedule.Appointments.Add(appointment); // Swicth schedule to week view mode schedule.ViewMode = ENScheduleViewMode.Week; }
private void OnRadioGroupSelectedIndexChanged(NValueChangeEventArgs arg) { NSchedule schedule = m_ScheduleView.Content; NAppointment appointment = (NAppointment)schedule.Appointments[0]; int selectedIndex = (int)arg.NewValue; switch (selectedIndex) { case 0: appointment.RecurrenceRule = null; schedule.ViewMode = ENScheduleViewMode.Week; break; case 1: appointment.RecurrenceRule = CreateHourlyRule(); schedule.ViewMode = ENScheduleViewMode.Week; break; case 2: appointment.RecurrenceRule = CreateDailyRule(); schedule.ViewMode = ENScheduleViewMode.Week; break; case 3: appointment.RecurrenceRule = CreateWeeklyRule(); schedule.ViewMode = ENScheduleViewMode.Week; break; case 4: appointment.RecurrenceRule = CreateAbsoluteMonthlyRule(); schedule.ViewMode = ENScheduleViewMode.Month; break; case 5: appointment.RecurrenceRule = CreateRelativeMonthlyRule(); schedule.ViewMode = ENScheduleViewMode.Month; break; case 6: appointment.RecurrenceRule = CreateAbsoluteYearlyRule(); schedule.ViewMode = ENScheduleViewMode.Month; break; case 7: appointment.RecurrenceRule = CreateRelativeYearlyRule(); schedule.ViewMode = ENScheduleViewMode.Month; break; case 8: appointment.RecurrenceRule = CreateDailyRuleForOneMonth(); schedule.ViewMode = ENScheduleViewMode.Month; break; case 9: appointment.RecurrenceRule = CreateDailyRuleForFiveOccurrences(); schedule.ViewMode = ENScheduleViewMode.Month; break; } }
private void btnSave_Click(object sender, EventArgs e) { try { string rpta = ""; if (this.txtId.Text == string.Empty || pickerDate.Text == String.Empty) { MensajeError("Falta Ingresar algunos datos, serán remarcados"); errorIcono.SetError(txtId, "Ingrese un Nombre"); errorIcono.SetError(pickerDate, "Ingrese Apellidps"); } else { Console.WriteLine(Convert.ToString(this.pickerDate.Text)); rpta = NAppointment.Insert(Convert.ToString(this.pickerDate.Text), Convert.ToInt32(this.txtId.Text), this.txtComments.Text.Trim().ToUpper()); if (rpta.Equals("OK")) { this.MensajeOk("Se inserto de forma correcta el registro"); } else { this.MensajeError(rpta); } this.Limpiar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
protected override void InitSchedule(NSchedule schedule) { DateTime today = DateTime.Today; // Create a recurring appointment, which occurs every day NAppointment appointment = new NAppointment("Appointment", today.AddHours(12), today.AddHours(14)); NRecurrenceDailyRule rule = new NRecurrenceDailyRule(); rule.StartDate = new DateTime(2015, 1, 1); appointment.RecurrenceRule = rule; // Add the recurring appointment to the schedule schedule.Appointments.Add(appointment); // Change the time of the first appointment in the current week NAppointmentBase appChild = appointment.Occurrences[0]; appChild.Start = appChild.Start.AddHours(-2); appChild.End = appChild.End.AddHours(-2); // Change the subject of the second appointment appChild = appointment.Occurrences[1]; appChild.Subject = "Custom Subject"; // Change the category of the third appointment appChild = appointment.Occurrences[2]; appChild.Category = "Red"; // Delete the fourth appointment appointment.Occurrences.RemoveAt(3); }
private NAppointment CreateAppointment(string subject, DateTime start, DateTime end, string groupItem) { NAppointment appointment = new NAppointment(subject, start, end); appointment.Groups = new NAppointmentGroupCollection(); appointment.Groups.Add(new NAppointmentGroup("Activity", groupItem)); return(appointment); }
protected override void InitSchedule(NSchedule schedule) { DateTime today = DateTime.Today; NAppointment appointment = new NAppointment("Appoinment", today.AddHours(12), today.AddHours(14)); appointment.RecurrenceRule = CreateDailyRule(); schedule.Appointments.Add(appointment); }
protected override void InitSchedule(NSchedule schedule) { DateTime start = DateTime.Now; // Create an appointment NAppointment appointment = new NAppointment("Meeting", start, start.AddHours(2)); schedule.Appointments.Add(appointment); schedule.ScrollToTime(start.TimeOfDay); }
protected override void InitSchedule(NSchedule schedule) { DateTime today = DateTime.Today; schedule.ViewMode = ENScheduleViewMode.Day; // The categories of the schedule are stored in its Categories collections and by default are: // "Orange", "Red", "Blue", "Green", "Purple" and "Yellow" // You can either use these names (case sensitive), or obtain them from the Categories collection of the schedule // Create an appointment and associate it with the "Red" category NAppointment appointment = new NAppointment("Travel to Work", today.AddHours(6.5), today.AddHours(7.5)); appointment.Category = "Red"; schedule.Appointments.Add(appointment); // Create an appointment and associate it with the first category of the schedule appointment = new NAppointment("Meeting with John", today.AddHours(8), today.AddHours(10)); appointment.Category = schedule.Categories[0].Name; schedule.Appointments.Add(appointment); // Time markers are similar to categories with the diference that they only color the header of an appointment. // The time markers of a schedule are stored in its TimeMarkers collection and by default are: // "Free", "Tentative", "Busy" and "Out of Office" // You can either use these names (case sensitive), or obtain them from the TmieMarkers collection of the schedule // Create an appointment and assign the "Busy" time marker to it appointment = new NAppointment("Conference", today.AddHours(10.5), today.AddHours(11.5)); appointment.TimeMarker = "Busy"; schedule.Appointments.Add(appointment); // Create an appointment and assign the first time marker of the schedule to it appointment = new NAppointment("Lunch", today.AddHours(12), today.AddHours(14)); appointment.TimeMarker = schedule.TimeMarkers[0].Name; schedule.Appointments.Add(appointment); // Create an appointment and assign both a category and a time marker to it appointment = new NAppointment("News Reading", today.AddHours(12.5), today.AddHours(13.5)); appointment.Category = "Yellow"; appointment.TimeMarker = "Tentative"; schedule.Appointments.Add(appointment); // Add some more appointments schedule.Appointments.Add(new NAppointment("Video Presentation", today.AddHours(14.5), today.AddHours(15.5))); schedule.Appointments.Add(new NAppointment("Web Meeting", today.AddHours(16), today.AddHours(17))); schedule.Appointments.Add(new NAppointment("Travel back home", today.AddHours(17.5), today.AddHours(19))); schedule.Appointments.Add(new NAppointment("Family Dinner", today.AddHours(20), today.AddHours(21))); }
/// <summary> /// Adds some random appointments for the given date. /// </summary> /// <param name="appointments"></param> /// <param name="date"></param> private void AddRandomAppointments(NAppointmentCollection appointments, DateTime date) { for (int i = 0; i < AppointmentsPerDay; i++) { // Generate random subject string subject = AppointmentSubjects[m_Random.Next(0, AppointmentSubjects.Length)]; // Generate random start hour from 0 to 24 double startHour = m_Random.NextDouble() * 24; // Generate random duration from 0.5 to 2.5 hours double duration = 0.5 + m_Random.NextDouble() * 2; // Create and add the appointment NAppointment appointment = new NAppointment(subject, date.AddHours(startHour), date.AddHours(startHour + duration)); appointments.Add(appointment); } }
protected override void InitSchedule(NSchedule schedule) { // Rename the first predefined category schedule.Categories[0].Name = NLoc.Get("Renamed Category"); // Create and add some custom categories NCategory category1 = new NCategory(NLoc.Get("Custom Category 1"), NColor.Khaki); schedule.Categories.Add(category1); NCategory category2 = new NCategory(NLoc.Get("Custom Category 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange)); schedule.Categories.Add(category2); // Remove the second category schedule.Categories.RemoveAt(1); // Remove the category called "Green" NCategory categoryToRemove = schedule.Categories.FindByName(NLoc.Get("Green")); if (categoryToRemove != null) { schedule.Categories.Remove(categoryToRemove); } // Create and add some appointments DateTime start = DateTime.Now; NAppointment appointment1 = new NAppointment("Meeting 1", start, start.AddHours(2)); appointment1.Category = category1.Name; schedule.Appointments.Add(appointment1); NAppointment appointment2 = new NAppointment("Meeting 2", appointment1.End.AddHours(0.5), appointment1.End.AddHours(2.5)); appointment2.Category = category2.Name; schedule.Appointments.Add(appointment2); // Scroll the schedule to the start of the first appointment schedule.ScrollToTime(start.TimeOfDay); }
protected override void InitSchedule(NSchedule schedule) { // Rename the first predefined time marker schedule.TimeMarkers[0].Name = NLoc.Get("Renamed Time Marker"); // Create and add some custom time markers NTimeMarker timeMarker1 = new NTimeMarker(NLoc.Get("Custom Time Marker 1"), NColor.Khaki); schedule.TimeMarkers.Add(timeMarker1); NTimeMarker timeMarker2 = new NTimeMarker(NLoc.Get("Custom Time Marker 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange)); schedule.TimeMarkers.Add(timeMarker2); // Remove the second time marker schedule.TimeMarkers.RemoveAt(1); // Remove the time marker called "Busy" NTimeMarker timeMarkerToRemove = schedule.TimeMarkers.FindByName(NLoc.Get("Busy")); if (timeMarkerToRemove != null) { schedule.TimeMarkers.Remove(timeMarkerToRemove); } // Create and add some appointments DateTime start = DateTime.Now; NAppointment appointment1 = new NAppointment("Meeting 1", start, start.AddHours(2)); appointment1.TimeMarker = timeMarker1.Name; schedule.Appointments.Add(appointment1); NAppointment appointment2 = new NAppointment("Meeting 2", appointment1.End.AddHours(0.5), appointment1.End.AddHours(2.5)); appointment2.TimeMarker = timeMarker2.Name; schedule.Appointments.Add(appointment2); // Scroll the schedule to the start of the first appointment schedule.ScrollToTime(start.TimeOfDay); }
protected override void InitSchedule(NSchedule schedule) { schedule.ViewMode = ENScheduleViewMode.Day; // Create an old appointment DateTime oldStart = DateTime.Now.AddHours(-3); NAppointment oldAppointment = new NAppointment("Old Meeting", oldStart, oldStart.AddHours(2)); oldAppointment.Notification = TimeSpan.Zero; schedule.Appointments.Add(oldAppointment); // Create an appointment and assign a notification 10 minutes before its start DateTime newStart = DateTime.Now.AddMinutes(10); NAppointment newAppointment = new NAppointment("New Meeting", newStart, newStart.AddHours(2)); newAppointment.Notification = TimeSpan.FromMinutes(10); schedule.Appointments.Add(newAppointment); // Scroll the schedule to the current hour schedule.ScrollToTime(TimeSpan.FromHours(Math.Floor((double)oldStart.Hour))); // Configure the schedule view to check for pending notifications every 60 seconds m_ScheduleView.NotificationCheckInterval = 60; }
private void btnEliminar_Click(object sender, EventArgs e) { try { DialogResult Opcion; Opcion = MessageBox.Show("Realmente desea eliminar registros", "Despacho Valles", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (Opcion == DialogResult.OK) { string Codigo; string Rpta = ""; foreach (DataGridViewRow row in dataListado.Rows) { if (Convert.ToBoolean(row.Cells[0].Value)) { Codigo = Convert.ToString(row.Cells[1].Value); Rpta = NAppointment.Delete(Convert.ToInt32(Codigo)); if (Rpta.Equals("OK")) { this.MensajeOk("se elimino correctamete el registro"); } else { this.MensajeError(Rpta); } } } this.Mostar(); } } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } }
//metodo buscar por fecha private void BuscarNombre() { this.dataListado.DataSource = NAppointment.SearchDate(Convert.ToString(this.pickerSearch.Text)); this.OcultarColumnas(); lbltotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }
//metodo mostrar private void Mostar() { this.dataListado.DataSource = NAppointment.SearchDate(DateTime.Today.ToString()); this.OcultarColumnas(); lbltotal.Text = "Total de Registros: " + Convert.ToString(dataListado.Rows.Count); }