private void frmCalendar_Load(object sender, EventArgs e) { _dbManager.DataSource = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "\\Personal TV Organiser" + "\\db.sqlite"; _dbManager.InitializeConnection(); _dbManager.OpenConnection(); _episodes = _dbManager.GetEpisodesWithDates(false); _dbManager.CloseConnection(); foreach (Episode episode in _episodes.Values) { DateTime startDate = episode.FirstAired; if (episode.TimeAirs > Convert.ToDateTime("01/01/0001")) { string airDate = episode.FirstAired.ToString("dd MMM yyyy"); string airTime = episode.TimeAirs.ToString("HH:mm"); startDate = Convert.ToDateTime(airDate + " " + airTime); } DateTime endDate = episode.Runtime <= 0 ? startDate.AddHours(1) : startDate.AddMinutes(episode.Runtime); CalendarItem calendarItem = new CalendarItem(calendar1, startDate, endDate, episode.ToString()); calendarItem.Tag = episode.EpisodeID; if (episode.Watched) { calendarItem.ApplyColor(Color.FromArgb(0, 192, 192, 192)); } else if (episode.FirstAired <= DateTime.Now) { calendarItem.ApplyColor(Color.FromArgb(0, 255, 0, 0)); } _items.Add(episode.EpisodeID, calendarItem); } calendar1.MaximumFullDays = 7; SetCalendarView(); lblMonth.Text = DateTime.Today.ToString("MMMM yyyy"); lineShape1.X2 = Width - calendar1.Width - 35; }
private void LoadingCalendar(string type) { _items.Clear(); List <ItemInfo> lst = new List <ItemInfo>(); string state = ""; string Q = ""; if (string.IsNullOrEmpty(UserID)) { Q = "SELECT * FROM schedule WHERE `date` >= '" + fromDate + "' AND `date` <= '" + toDate + "' "; } else { Q = "SELECT * FROM schedule WHERE `date` >= '" + fromDate + "' AND `date` <= '" + toDate + "' AND userID = '" + UserID + "'"; } //List<Schedule> events = Schedule.List(Q); foreach (Schedule e in GenericCollection.schedules) { string user = ""; try { user = GenericCollection.users.Where(r => r.Id == e.UserID).First().Name; } catch { } string cus = ""; //Customer.Select(e.CustomerID).Name; try { cus = GenericCollection.customers.Where(r => r.Id == e.CustomerID).First().Name; } catch { } //try //{ CalendarItem cal = new CalendarItem(calendar1, Convert.ToDateTime(e.Starts), Convert.ToDateTime(e.Ends), cus + " C/O " + user + " $" + e.Cost + " " + e.Details); Image img = Helper.Base64ToImage(GenericCollection.customers.Where(r => r.Id == e.CustomerID).First().Image.Replace('"', ' ').Trim()); System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(img); Bitmap bps = new Bitmap(bmp, 30, 30); Image dstImage = Helper.CropToCircle(bps, Color.White); cal.Image = dstImage; //cal.ImageAlign = CalendarItemImageAlign.East; cal.Tag = e.Id; if (e.Status == "Paid") { cal.ApplyColor(Color.LightGreen); } if (e.Status == "Pending") { cal.ApplyColor(Color.Orange); } if (e.Status == "Cancelled") { cal.ApplyColor(Color.IndianRed); } _items.Add(cal); //} //catch { } } PlaceItems(); UserID = ""; }
private void LoadingCalendarLite() { _items.Clear(); List <ItemInfo> lst = new List <ItemInfo>(); string state = ""; List <Events> events = new List <Events>(Global._events); if (!String.IsNullOrEmpty(departmentCbx.Text)) { events.Clear(); events = Global._events.Where(k => k.Department.Contains(departmentCbx.Text)).ToList(); } if (!String.IsNullOrEmpty(clinicCbx.Text)) { events.Clear(); events = Global._events.Where(k => k.Clinic.Contains(clinicCbx.Text)).ToList(); } if (!String.IsNullOrEmpty(practitionerTxt.Text)) { events.Clear(); events = Global._events.Where(k => k.Users.Contains(practitionerTxt.Text)).ToList(); } foreach (Events e in events) { CalendarItem cal = new CalendarItem(calendar1, Convert.ToDateTime(e.Starts), Convert.ToDateTime(e.Ends), e.Patient + " ATT: " + e.Users + "\r\n CONTACT " + e.Contact + " EMAIL:" + e.Email + e.Details); if (e.Priority == " ") { state = "none"; } else { state = e.Priority; } if (state == "Medium") { cal.ApplyColor(Color.LightGreen); } if (state == "Low") { cal.ApplyColor(Color.CornflowerBlue); } if (state == "High") { cal.ApplyColor(Color.Salmon); } if (state == "none") { cal.ApplyColor(Color.LightSeaGreen); } _items.Add(cal); // t.Rows.Add(new object[] { Reader.GetString(0), Helper.ImageFolder + Reader.GetString(8), b, Reader.GetString(2), Reader.GetString(3), Reader.GetString(7), Reader.GetString(5), Reader.GetString(9), Reader.GetString(14) + "", Reader.GetString(6), "" + Reader.GetString(13) + "" }); } PlaceItems(); }
public void UpdateCalendarEvent(CalendarEvent calendarEvent) { CalendarItem calendarItem = calendarItems.FirstOrDefault(x => x.DatabaseEntityID == calendarEvent.ID); if (calendarItem != null) { UpdateDurations(false, calendarItem.StartDate, calendarItem.EndDate); calendarItem.Text = calendarEvent.Summary; calendarItem.Description = calendarEvent.Details; calendarItem.StartDate = calendarEvent.StartDate; calendarItem.EndDate = calendarEvent.EndDate; calendarItem.ApplyColor(Color.FromArgb( calendarEvent.CalendarEventColor.R, calendarEvent.CalendarEventColor.G, calendarEvent.CalendarEventColor.B)); UpdateDurations(calendarEvent.StartDate, calendarEvent.EndDate, true); if (calendarSynchronizer.UpdateEvent(calendarItem, ezkoController)) { //TODO: MessageBox? } else { BasicMessagesHandler.ShowInformationMessage("Nepodarilo sa aktualizovať udalosť " + calendarEvent.Summary + " v Google kalendári."); } ShowItems(); } else { //TODO: ? } }
private void CalendarHome_Load(object sender, EventArgs e) { if (ItemsFile.Exists) { List <ItemInfo> lst = new List <ItemInfo>(); XmlSerializer xml = new XmlSerializer(lst.GetType()); using (Stream s = ItemsFile.OpenRead()) { lst = xml.Deserialize(s) as List <ItemInfo>; } foreach (ItemInfo item in lst) { CalendarItem cal = new CalendarItem(calendar1, item.StartDateFunction, item.EndDateFunction, item.FunctionName); if (!(item.R == 0 && item.G == 0 && item.B == 0)) { cal.ApplyColor(Color.FromArgb(item.A, item.R, item.G, item.B)); } _items.Add(cal); } // PlaceItems(); } }
public CalendarEvent(int id, CalendarItem item, ScheduleType type, string details) { this.id = id; this.item = item; this.type = type; this.details = details; if (type == ScheduleType.Unspecified) { item.ApplyColor(Color.FromArgb(181, 230, 29)); } else if (type == ScheduleType.Appointment) { item.ApplyColor(Color.FromArgb(255, 127, 39)); } else { item.ApplyColor(Color.FromArgb(112, 146, 190)); } }
public void AddItem(ItemInfo item) { CalendarItem cal = new CalendarItem(calendar1, item.StartTime, item.EndTime, item.Text); if (!(item.R == 0 && item.G == 0 && item.B == 0)) { cal.ApplyColor(Color.FromArgb(item.A, item.R, item.G, item.B)); } _items.Add(cal); //PlaceItems(); }
public EventSearch(FSRESTAURANT.EVENT_HEADERDataTable dt) { InitializeComponent(); this.dt = dt; DockContent dc = new DockContent(); dc.Controls.Add(monthView1); monthView1.Dock = DockStyle.Fill; dc.DockPanel = dockPanel1; dc.DockState = DockState.DockLeftAutoHide; dockPanel1.AllowEndUserDocking = false; dockPanel1.ActiveAutoHideContent = dc; dockPanel1.Controls.Add(EventCalendar); dockPanel1.Dock = DockStyle.Fill; EventCalendar.Dock = DockStyle.Fill; foreach (FSRESTAURANT.EVENT_HEADERRow item in dt) { TimeSpan ts = item.EVENT_STOP.Subtract(item.EVENT_START); CalendarItem ci = new CalendarItem(EventCalendar, item.EVENT_START, ts, item.EVENT_NAME); ci.Tag = item.EVENT_ID.ToString(); if (item.EVENT_STATUS == "Y") { ci.ApplyColor(Color.LightGreen); } else { if (item.EVENT_STOP < DateTime.Now) { ci.ApplyColor(Color.Black); } else { ci.ApplyColor(Color.DarkCyan); } } _items.Add(ci); } PlaceItems(); }
private void Form1_Load(object sender, EventArgs e) { CalendarItem cal = new CalendarItem(calendar1, item.StartTime, item.EndTime, item.Text); if (!(item.R == 0 && item.G == 0 && item.B == 0)) { cal.ApplyColor(Color.FromArgb(item.A, item.R, item.G, item.B)); } _items.Add(cal); PlaceItems(); }
private void AddCalendarEntry(DateTime _start, DateTime _end, Color color, String Text, object tag) { DateTime start, end; start = new DateTime(_start.Year, _start.Month, _start.Day, 0, 0, 0); end = new DateTime(_end.Year, _end.Month, _end.Day, 23, 59, 59); CalendarItem ci = new CalendarItem(calendarView, start, end, Text); ci.ApplyColor(color); ci.Tag = tag; if (start <= calendarView.Days[calendarView.Days.Length - 1].Date && calendarView.Days[0].Date <= end) { calendarView.Items.Add(ci); } }
private void AnaForm_Load(object sender, EventArgs e) { ShowForm(); timer1.Interval = 1000; timer1.Start(); saatGoster(); calendar1.TimeUnitsOffset = -16; lbltarih.Text = DateTime.Now.ToShortDateString(); this.Text = "** Önal Kuaför ve Güzellik Salonu ** www.onalkuafor.com.tr"; //NotifyIcon başlıyor. onalKuafor.ShowBalloonTip(2000, "Önal Kuaför Programı", "Hoşgeldiniz...", ToolTipIcon.Info); if (DateTime.Now.DayOfWeek.ToString() == "Friday") { timer1.Start(); } //Ajanda if (ItemsFile.Exists) { List <ItemInfo> lst = new List <ItemInfo>(); XmlSerializer xml = new XmlSerializer(lst.GetType()); using (Stream s = ItemsFile.OpenRead()) { lst = xml.Deserialize(s) as List <ItemInfo>; } foreach (ItemInfo item in lst) { CalendarItem cal = new CalendarItem(calendar1, item.StartTime, item.EndTime, item.Text); if (!(item.R == 0 && item.G == 0 && item.B == 0)) { cal.ApplyColor(Color.FromArgb(item.A, item.R, item.G, item.B)); } _items.Add(cal); } PlaceItems(); } }
private void loadCalendar() { CompteActuel.populateForcastOperations(); calReminder.Items.Clear(); var today = mthCalReminder.SelectionStart; var numberOfDaysInMonth = DateTime.DaysInMonth(today.Year, today.Month); var startOfMonth = new DateTime(today.Year, today.Month, 1); var endOfMonth = new DateTime(today.Year, today.Month, numberOfDaysInMonth); //Filter only reminder operations that fit the calendar var ops = ReminderOperation.filterOperation(CompteActuel.ForecastOperations, startOfMonth, endOfMonth); calReminder.SetViewRange(startOfMonth, endOfMonth); foreach (var item in ops) { var cal = new CalendarItem(calReminder, item.Date, item.Date, item.Budget); cal.ApplyColor(Color.FromName(CompteActuel.Budgets[item.Budget].ToKnownColor().ToString())); calReminder.Items.Add(cal); } }
private void Form1_Load(object sender, EventArgs e) //讀取DB資料 { if (ItemsFile.Exists) { var q = dbContext.Caleadar; List <ItemInfo> lst = new List <ItemInfo>(); foreach (var x in q) { ItemInfo info = new ItemInfo() { CaleadarID = x.CaleadarID, EmployeeID = (int)x.EmployeeID, StartTime = (DateTime)x.StartTime, EndTime = (DateTime)x.EndTime, Text = x.Text, A = (int)x.A, R = (int)x.R, G = (int)x.G, B = (int)x.B, }; lst.Add(info); } foreach (ItemInfo item in lst) { CalendarItem cal = new CalendarItem(calendar1, item.StartTime, item.EndTime, item.Text); if (!(item.R == 0 && item.G == 0 && item.B == 0)) { cal.ApplyColor(Color.FromArgb(item.A, item.R, item.G, item.B)); } _items.Add(cal); } PlaceItems(); } }
/// <summary>Handles the LoadItems event of the calendar1 control.</summary> private void calendar1_LoadItems(object sender, CalendarLoadEventArgs e) { var start = monthView1.SelectionStart; var end = monthView1.SelectionEnd; foreach (var student in Person.GetActiveStudents()) { var schedule = Schedule.GetScheduleFromStudentId(student.PersonID); var dayOfWeek = (DayOfWeek)schedule.DayOfTheWeek; var scheduleDays = Schedule.GetDayOfWeekDatesBetween(start, end, dayOfWeek); var timeSpan = schedule.TimeOfDay.Value; foreach (var scheduleDay in scheduleDays) { var span = new TimeSpan(0, 0, 30, 0, 0); var dt = scheduleDay.Date + timeSpan; var calendarItem = new CalendarItem(calendar1, dt, span, student.FirstLast); calendarItem.ApplyColor(Color.DarkTurquoise); calendar1.Items.Add(calendarItem); } } }
private void listTable_SelectedIndexChanged(object sender, EventArgs e) { EventCalendar.Items.Clear(); _items.Clear(); foreach (FSRESTAURANT.EVENT_BOOKINGRow item in dt) { try { if (listTable.SelectedValue.ToString() == item.TABLE_ID) { TimeSpan ts = item.BOOKING_STOP.Subtract(item.BOOKING_START); CalendarItem ci = new CalendarItem(EventCalendar, item.BOOKING_START, ts, MainForm.FS.EVENT_PENJUALAN.FindByEVENT_PENJUALAN_ID(item.EVENT_PENJUALAN_ID).PELANGGAN_RESTAURANTRow.PELANGGAN_NAME); ci.Tag = item.EVENT_BOOKING_ID; _items.Add(ci); ci.ForeColor = Color.Crimson; ci.ApplyColor(Color.Chocolate); } } catch { } } PlaceItems(); }
private void AñadirItemsCalendario() { itemsCitas.Clear();//Limpia la lista global de ítems itemsCitas2.Clear(); oCalendario.Items.Clear();//Limpia los ítems del calendario oCalendario2.Items.Clear(); //Limpia los arreglos oArregloTextoRecordatorios.Clear(); oArregloTagRecordatorios.Clear(); oArregloResumenRecordatorios.Clear(); string NombrePaciente = ""; string NombreDoctor = ""; DataSet ds = Program.oPersistencia.ejecutarSQLListas("Select * from Citas", "Citas"); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { #region Selecciona el nombre del paciente DataSet ds2 = Program.oPersistencia.ejecutarSQLListas("Select nombre, apellidos from Paciente where num_expediente = " + dr[1].ToString().Trim(), "Pacientes"); if (ds2 != null) { if (ds2.Tables[0].Rows.Count > 0) { foreach (DataRow dr2 in ds2.Tables[0].Rows) { NombrePaciente = dr2[0].ToString().Trim() + " " + dr2[1].ToString().Trim(); break; } } else { NombrePaciente = dr[12].ToString().Trim(); } } ds2.Dispose(); #endregion #region Selecciona el nombre del doctor DataSet ds3 = Program.oPersistencia.ejecutarSQLListas("Select nombre from Empleados where id_emp = " + dr[2].ToString().Trim(), "Doctores"); if (ds3 != null) { if (ds3.Tables[0].Rows.Count > 0) { foreach (DataRow dr3 in ds3.Tables[0].Rows) { NombreDoctor = dr3[0].ToString().Trim(); break; } } } ds3.Dispose(); #endregion string Descripcion = ""; Descripcion = "El paciente: " + NombrePaciente + " tiene establecida una cita con el doctor: " + NombreDoctor + " el día: " + Convert.ToDateTime(dr[3]).ToLongDateString() + " a las " + Convert.ToDateTime(dr[3]).ToLongTimeString() + " por motivos de " + dr[5].ToString().Trim(); string Resumen = NombrePaciente + " (" + dr[5].ToString() + ").";//"Cita programada con el doctor " + NombreDoctor + " a las " + Convert.ToDateTime(dr[3]).ToLongTimeString(); CalendarItem oItemCalendario = new CalendarItem(oCalendario); CalendarItem oItemCalendario2 = new CalendarItem(oCalendario2); oItemCalendario.StartDate = Convert.ToDateTime(dr[3]); oItemCalendario.EndDate = Convert.ToDateTime(dr[4]); oItemCalendario2.StartDate = Convert.ToDateTime(dr[3]); oItemCalendario2.EndDate = Convert.ToDateTime(dr[4]); oArregloTextoRecordatorios.Add(Descripcion.Trim()); oArregloTagRecordatorios.Add(dr[0].ToString().Trim()); oArregloResumenRecordatorios.Add(Resumen.Trim()); oItemCalendario.Tag = dr[0].ToString().Trim(); oItemCalendario2.Tag = dr[0].ToString().Trim(); if (dr[9].ToString() == "Alta") { oItemCalendario.Image = recursos.Alta; oItemCalendario.ApplyColor(Color.Red); oItemCalendario.ImageAlign = CalendarItemImageAlign.East; oItemCalendario.ForeColor = Color.Black; oItemCalendario2.Image = recursos.Alta; oItemCalendario2.ApplyColor(Color.Red); oItemCalendario2.ImageAlign = CalendarItemImageAlign.East; oItemCalendario2.ForeColor = Color.Black; } else if (dr[9].ToString() == "Media") { oItemCalendario.Image = recursos.Media; oItemCalendario.ApplyColor(Color.Yellow); oItemCalendario.ImageAlign = CalendarItemImageAlign.East; oItemCalendario.ForeColor = Color.Black; oItemCalendario2.Image = recursos.Media; oItemCalendario2.ApplyColor(Color.Yellow); oItemCalendario2.ImageAlign = CalendarItemImageAlign.East; oItemCalendario2.ForeColor = Color.Black; } else if (dr[9].ToString() == "Normal") { oItemCalendario.Image = recursos.Normal; oItemCalendario.ImageAlign = CalendarItemImageAlign.East; oItemCalendario.ForeColor = Color.Black; //No se aplica color para que quede el color por defecto. oItemCalendario2.Image = recursos.Normal; oItemCalendario2.ImageAlign = CalendarItemImageAlign.East; oItemCalendario2.ForeColor = Color.Black; } //oItemCalendario2 = oItemCalendario; itemsCitas.Add(oItemCalendario); itemsCitas2.Add(oItemCalendario2); } ColocarItems(); ColocarItems2(); } } ds.Dispose(); }
private void PlaceItemsInCalendarView() { foreach (object e in calendarEntries.Entries) { if (e is BacnetDate) { BacnetDate bd = (BacnetDate)e; if (bd.IsPeriodic) { foreach (CalendarDay dt in calendarView.Days) { if (bd.IsAFittingDate(dt.Date)) { AddCalendarEntry(dt.Date, dt.Date, Color.Blue, "Periodic", bd); } } } else { AddCalendarEntry(bd.toDateTime(), bd.toDateTime(), Color.Green, "", bd); } } else if (e is BacnetDateRange) { BacnetDateRange bdr = (BacnetDateRange)e; DateTime start, end; if (bdr.startDate.year != 255) { start = new DateTime(bdr.startDate.year + 1900, bdr.startDate.month, bdr.startDate.day, 0, 0, 0); } else { start = DateTime.MinValue; } if (bdr.endDate.year != 255) { end = new DateTime(bdr.endDate.year + 1900, bdr.endDate.month, bdr.endDate.day, 23, 59, 59); } else { end = DateTime.MaxValue; } CalendarItem ci = new CalendarItem(calendarView, start, end, ""); ci.ApplyColor(Color.Yellow); ci.Tag = bdr; if (start <= calendarView.Days[calendarView.Days.Length - 1].Date && calendarView.Days[0].Date <= end) { calendarView.Items.Add(ci); } } else { BacnetweekNDay bwnd = (BacnetweekNDay)e; foreach (CalendarDay dt in calendarView.Days) { if (bwnd.IsAFittingDate(dt.Date)) { AddCalendarEntry(dt.Date, dt.Date, Color.Red, "Periodic", bwnd); } } } } }
private void AñadirItemsCalendario() { if (TxtNombre.Text.Trim() != "" || textBox1.Text.Trim() != "") { itemsCitas.Clear(); //Limpia la lista global de ítems oCalendario.Items.Clear(); //Limpia los ítems del calendario //Limpia los arreglos oArregloTextoRecordatorios.Clear(); oArregloTagRecordatorios.Clear(); oArregloResumenRecordatorios.Clear(); string NombrePaciente = ""; string NombreDoctor = ""; string sqlConsulta = ""; if (opcionSeleccionada == 0) { sqlConsulta = "Select * from Citas where num_expediente = " + TxtNumExpediente.Text.Trim(); } else if (opcionSeleccionada == 1) { sqlConsulta = "Select * from Citas where nombre_paciente like '%" + textBox1.Text.Trim() + "%'"; } DataSet ds = Program.oPersistencia.ejecutarSQLListas(sqlConsulta.Trim(), "Citas"); if (ds != null) { if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { NombrePaciente = TxtNombre.Text.Trim(); #region Selecciona el nombre del doctor DataSet ds3 = Program.oPersistencia.ejecutarSQLListas("Select nombre from Empleados where id_emp = " + dr[2].ToString().Trim(), "Doctores"); if (ds3 != null) { if (ds3.Tables[0].Rows.Count > 0) { foreach (DataRow dr3 in ds3.Tables[0].Rows) { NombreDoctor = dr3[0].ToString().Trim(); break; } } } ds3.Dispose(); #endregion string Descripcion = ""; Descripcion = "El paciente: " + NombrePaciente + " tiene establecida una cita con el doctor: " + NombreDoctor + " el día: " + Convert.ToDateTime(dr[3]).ToLongDateString() + " a las " + Convert.ToDateTime(dr[3]).ToLongTimeString() + " por motivos de " + dr[5].ToString().Trim(); string Resumen = "Cita programada con el doctor " + NombreDoctor + " a las " + Convert.ToDateTime(dr[3]).ToLongTimeString(); CalendarItem oItemCalendario = new CalendarItem(oCalendario); oItemCalendario.StartDate = Convert.ToDateTime(dr[3]); oItemCalendario.EndDate = Convert.ToDateTime(dr[4]); oArregloTextoRecordatorios.Add(Descripcion.Trim()); oArregloTagRecordatorios.Add(dr[0].ToString().Trim()); oArregloResumenRecordatorios.Add(Resumen.Trim()); oItemCalendario.Tag = dr[0].ToString().Trim(); if (dr[9].ToString() == "Alta") { oItemCalendario.Image = recursos.Alta; oItemCalendario.ApplyColor(Color.Red); oItemCalendario.ImageAlign = CalendarItemImageAlign.East; oItemCalendario.ForeColor = Color.Black; } else if (dr[9].ToString() == "Media") { oItemCalendario.Image = recursos.Media; oItemCalendario.ApplyColor(Color.Yellow); oItemCalendario.ImageAlign = CalendarItemImageAlign.East; oItemCalendario.ForeColor = Color.Black; } else if (dr[9].ToString() == "Normal") { oItemCalendario.Image = recursos.Normal; oItemCalendario.ImageAlign = CalendarItemImageAlign.East; oItemCalendario.ForeColor = Color.Black; //No se aplica color para que quede el color por defecto. } itemsCitas.Add(oItemCalendario); } ColocarItems(); } } ds.Dispose(); } }