static AgendaAppointment CreateAgendaAppointment(SchedulerStorage storage, Appointment sourceAppointment, DateTime startDate, string startTime, string endTime) { AgendaAppointment agendaAppointment = new AgendaAppointment(); agendaAppointment.AgendaDate = startDate; agendaAppointment.AgendaDescription = sourceAppointment.Description; agendaAppointment.AgendaSubject = sourceAppointment.Subject; if (startTime == "" && endTime == "") { agendaAppointment.AgendaDuration = "All Day"; } else if (startTime == "" && endTime != "") { agendaAppointment.AgendaDuration = "Till: " + endTime; } else if (startTime != "" && endTime == "") { agendaAppointment.AgendaDuration = "From: " + startTime; } else { agendaAppointment.AgendaDuration = String.Format("{0} - {1}", startTime, endTime); } agendaAppointment.AgendaLocation = sourceAppointment.Location; agendaAppointment.AgendaStatus = storage.Appointments.Statuses[sourceAppointment.StatusId];; agendaAppointment.AgendaLabel = storage.GetLabelColor(sourceAppointment.LabelId); agendaAppointment.SourceAppointment = sourceAppointment; return(agendaAppointment); }
private void gridViewAppointments_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e) { GridView currentView = sender as GridView; if (!currentView.IsGroupRow(e.RowHandle)) { AgendaAppointment currentAppointment = (sender as GridView).GetRow(e.RowHandle) as AgendaAppointment; e.Appearance.BackColor = currentAppointment.AgendaLabel; } }
private void gridViewAppointments_DoubleClick(object sender, EventArgs e) { GridView currentView = sender as GridView; if (!currentView.IsGroupRow(currentView.FocusedRowHandle)) { AgendaViewMenuBuilder.Scheduler = OwnerScheduler; AgendaAppointment agendaAppointment = currentView.GetRow(currentView.FocusedRowHandle) as AgendaAppointment; AgendaViewMenuBuilder.CurrentAppointment = agendaAppointment.SourceAppointment; AgendaViewMenuBuilder.ViewControl = this; AgendaViewMenuBuilder.OnOpenCurrentAppointment(null, null); } }
private void gridViewAppointments_CustomDrawCell(object sender, RowCellCustomDrawEventArgs e) { GridView view = sender as GridView; if (e.RowHandle == view.FocusedRowHandle) { if (!view.IsGroupRow(e.RowHandle)) { AgendaAppointment currentAppointment = (sender as GridView).GetRow(e.RowHandle) as AgendaAppointment; e.Appearance.BackColor = GetLightenColor(currentAppointment.AgendaLabel, 0.1); } } }
private void gridViewAppointments_PopupMenuShowing(object sender, DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventArgs e) { if (e.HitInfo.HitTest == DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitTest.RowCell) { GridView currentView = sender as GridView; AgendaAppointment agendaAppointment = currentView.GetRow(e.HitInfo.RowHandle) as AgendaAppointment; AgendaViewMenuBuilder.GenerateContextMenu(this, e.Menu, OwnerScheduler, agendaAppointment.SourceAppointment); } if (e.HitInfo.HitTest == DevExpress.XtraGrid.Views.Grid.ViewInfo.GridHitTest.EmptyRow) { if (e.Menu == null) { e.Menu = new DevExpress.XtraGrid.Menu.GridViewMenu(sender as GridView); } AgendaViewMenuBuilder.GenerateContextMenu(this, e.Menu, OwnerScheduler, null); } }