void DoiCalendarExport(string outFileName) { DateTime now = DateTime.Now.Date; // Exporting 3 days only. AppointmentBaseCollection appointments = schedulerStorage1.GetAppointments(new TimeInterval(now, now.AddDays(3))); iCalendarExporter exporter = new iCalendarExporter(schedulerStorage1, appointments); exporter.CustomPropertyIdentifier = CustomPropertySignature; exporter.AppointmentExporting += new AppointmentExportingEventHandler(OnExportAppointment); using (FileStream fs = new FileStream(outFileName, FileMode.Create)) { try { exporter.Export(fs); iCalendarFileName = outFileName; } catch (Exception e) { MessageBox.Show(e.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); iCalendarFileName = ""; } } }
public static void scheduler_CustomDrawNavigationButton(object sender, DevExpress.XtraScheduler.CustomDrawObjectEventArgs e) { NavigationButtonNext navButton = e.ObjectInfo as NavigationButtonNext; SchedulerControl scheduler = sender as SchedulerControl; SchedulerStorage storage = scheduler.Storage as SchedulerStorage; // Do not count by resources. if (scheduler.GroupType != SchedulerGroupType.None) { return; } if (navButton != null && scheduler != null && storage != null) { // Count appointments within the interval used by the Next navigation button. AppointmentBaseCollection apts = scheduler.Storage.Appointments.Items; TimeSpan aptSearchInterval = scheduler.OptionsView.NavigationButtons.AppointmentSearchInterval; DateTime lastVisibleTime = scheduler.ActiveView.GetVisibleIntervals().Last().End; int aptCount = apts.Where(a => (a.Start > lastVisibleTime) && (a.Start < lastVisibleTime.Add(aptSearchInterval))).Count(); navButton.DisplayTextItem.Text = String.Format("Next {0} appointments", aptCount); } }
private AppointmentBaseCollection GetFilteredAppointments(TimeInterval interval) { AppointmentBaseCollection aptCollection = OwnerScheduler.Storage.GetAppointments(interval); AppointmentBaseCollection copyCollection = new AppointmentBaseCollection(); for (int i = 0; i < aptCollection.Count; i++) { if (aptCollection[i].Type != AppointmentType.Occurrence) { copyCollection.Add(aptCollection[i]); } else { if (!copyCollection.Contains(aptCollection[i].RecurrencePattern)) { copyCollection.Add(aptCollection[i].RecurrencePattern); } } } return(copyCollection); }
private static void scheduler_CustomDrawAppointmentBackground(object sender, CustomDrawObjectEventArgs e) { SchedulerControl scheduler = sender as SchedulerControl; AppointmentViewInfo viewInfo = (e.ObjectInfo as DevExpress.XtraScheduler.Drawing.AppointmentViewInfo); Appointment apt = viewInfo.Appointment; AppointmentBaseCollection allAppointments = scheduler.ActiveView.GetAppointments(); AppointmentConflictsCalculator aCalculator = new AppointmentConflictsCalculator(allAppointments); TimeInterval visibleInterval = scheduler.ActiveView.GetVisibleIntervals().Interval; bool isConflict = aCalculator.CalculateConflicts(apt, visibleInterval).Count != 0; // Paint conflict appointments with a red and white hatch brush. if (isConflict) { Rectangle rect = e.Bounds; Brush brush = e.Cache.GetSolidBrush(scheduler.DataStorage.Appointments.Labels.GetById(apt.LabelKey).GetColor()); e.Cache.FillRectangle(brush, rect); rect.Inflate(-3, -3); using (var _hatchBrush = new HatchBrush(HatchStyle.WideUpwardDiagonal, Color.Red, Color.White)) e.Cache.FillRectangle(_hatchBrush, rect); e.Handled = true; } }
void UpdateSchedulerSelection(AppointmentBaseCollection appointments) { if (appointments.Count <= 0) { return; } SchedulerViewBase view = schedulerControl1.ActiveView; view.SelectAppointment(appointments[0]); schedulerControl1.BeginUpdate(); try { for (int i = 1; i < appointments.Count; i++) { view.AddAppointmentSelection(appointments[i]); } } finally { schedulerControl1.EndUpdate(); } }
public static object GenerateAgendaAppointmentCollection(SchedulerStorage storage) { AppointmentBaseCollection sourceAppointments = storage.GetAppointments(SelectedInterval); BindingList <AgendaAppointment> agendaAppointments = new BindingList <AgendaAppointment>(); foreach (Appointment appointment in sourceAppointments) { TimeInterval currentDayInterval = new TimeInterval(appointment.Start.Date, appointment.Start.Date.AddDays(1)); string startTime = ""; string endTime = ""; if (currentDayInterval.Contains(appointment.End)) { startTime = currentDayInterval.Start == appointment.Start ? "" : appointment.Start.TimeOfDay.ToString(@"hh\:mm"); endTime = currentDayInterval.End == appointment.End ? "" : appointment.End.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, startTime, endTime)); } else { startTime = currentDayInterval.Start == appointment.Start ? "" : appointment.Start.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, startTime, "")); while (true) { currentDayInterval = new TimeInterval(currentDayInterval.End, currentDayInterval.End.AddDays(1)); if (currentDayInterval.Contains(appointment.End)) { endTime = currentDayInterval.End == appointment.End ? "" : appointment.End.TimeOfDay.ToString(@"hh\:mm"); agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, "", endTime)); break; } else { agendaAppointments.Add(CreateAgendaAppointment(storage, appointment, currentDayInterval.Start, "", "")); } } } } return(agendaAppointments); }
private float CalcCurrentTotals(TimeInterval interval, Resource resource) { AppointmentBaseCollection apts = this.schedulerStorage1.GetAppointments(interval); float total = 0.0F; ResourceBaseCollection resources = new ResourceBaseCollection(); resources.Add(resource); ResourcesAppointmentsFilter filter = new ResourcesAppointmentsFilter(resources); filter.Process(apts); foreach (Appointment apt in (AppointmentBaseCollection)filter.DestinationCollection) { if (apt.CustomFields["CustomPrice"] != null) { float customprice; float.TryParse(apt.CustomFields["CustomPrice"].ToString(), out customprice); total = total + customprice; } } return(total); }
private void schedulerControl1_EditAppointmentFormShowing(object sender, DevExpress.XtraScheduler.AppointmentFormEventArgs e) { Appointment apt = e.Appointment; AppointmentBaseCollection appList = ssWorkingDays.GetAppointments(apt.Start, apt.End); if (appList.Count == 0) { apt.AllDay = true; apt.Subject = lbWorkingDay.DisplayName; apt.LabelId = Working; ssWorkingDays.Appointments.Add(apt); _clsCalTypeData.saveDateInfo(CalendarCode, apt.Start, true); } else { if (appList[0].LabelId == Working) { appList[0].LabelId = NonWorking; appList[0].Subject = lbNonWorkingDay.DisplayName; //_clsCalTypeData.saveDateInfo(CalendarCode, appList[0].Start, true); _clsCalTypeData.saveDateInfo(CalendarCode, appList[0].Start, false); } else { appList[0].LabelId = Working; appList[0].Subject = lbWorkingDay.DisplayName; //_clsCalTypeData.saveDateInfo(CalendarCode, appList[0].Start, false); _clsCalTypeData.saveDateInfo(CalendarCode, appList[0].Start, true); } } scWorkingNonWorking.Refresh(); e.Handled = true; }
private SuperToolTip GetToolTipInfo(CalendarHitInfo chi) { SuperToolTip sTooltip1 = new SuperToolTip(); AppointmentBaseCollection abc = schedulerStorage2.GetAppointments(chi.HitDate, chi.HitDate.AddDays(1)); ToolTipTitleItem titleItem1 = new ToolTipTitleItem(); //titleItem1.Text = "Date: " + date; // Create a tooltip item that represents the SuperTooltip's contents. ToolTipItem item1 = new ToolTipItem(); item1.Image = Image.FromFile("untitled.bmp"); //SchedulerTooltip.Properties.Resources.untitled; // Add the tooltip items to the SuperTooltip. sTooltip1.Items.Add(titleItem1); sTooltip1.Items.Add(item1); foreach (Appointment apt in abc) { titleItem1.Text += apt.Subject + " "; item1.Text += String.Format("({0}-{1})\n", apt.Start, apt.End); } return(sTooltip1); }
static AppointmentBaseCollection DivideApointments(Appointment sourceApt) { DayIntervalCollection daysCollection = new DayIntervalCollection(); daysCollection.Add(new TimeInterval(sourceApt.Start, sourceApt.End)); AppointmentBaseCollection dividedApts = new AppointmentBaseCollection(); foreach (TimeInterval day in daysCollection) { Appointment dailyApt = sourceApt.Copy(); dailyApt.Start = day.Start.Date; dailyApt.End = day.End.Date; dailyApt.AllDay = true; dividedApts.Add(dailyApt); } AdjustStart(dividedApts, sourceApt); AdjustEnd(dividedApts, sourceApt); return(dividedApts); }
protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); ListView listView = View as ListView; DetailView detailView = View as DetailView; if (listView != null) { IObjectSpace os = Application.CreateObjectSpace(); listView.CollectionSource.CriteriaApplied += (o, e) => { // Предварительная загрузка расписаний докторов var collectionSB = (CollectionSourceBase)o; if (collectionSB.Criteria != null) { var events = new List <DoctorEvent>(os.GetObjects <DoctorEvent>(collectionSB.Criteria[FILTERKEY])); eventsDict = events.ToDictionary(de => de.Oid, de => de); } }; SchedulerListEditor listEditor = ((ListView)View).Editor as SchedulerListEditor; if (listEditor != null) { SchedulerControl scheduler = listEditor.SchedulerControl; if (scheduler != null) { // Кастомизация надписи в расписании доктора scheduler.InitAppointmentDisplayText += (o, e) => { Guid guid = (Guid)e.Appointment.Id; if (eventsDict.ContainsKey(guid)) { var doctorEvent = eventsDict[guid]; e.Text = doctorEvent != null && doctorEvent.Pacient != null ? doctorEvent.Pacient.FullName : string.Empty; } }; #region Кастомизация Тултипа расписания доктора // https://documentation.devexpress.com/WindowsForms/118551/Controls-and-Libraries/Scheduler/Visual-Elements/Scheduler-Control/Appointment-Flyout scheduler.OptionsView.ToolTipVisibility = ToolTipVisibility.Always; scheduler.OptionsCustomization.AllowDisplayAppointmentFlyout = false; scheduler.ToolTipController = new ToolTipController(); scheduler.ToolTipController.ToolTipType = ToolTipType.SuperTip; scheduler.ToolTipController.BeforeShow += (o, e) => { var toolTipController = (ToolTipController)o; AppointmentViewInfo aptViewInfo = null; try { aptViewInfo = (AppointmentViewInfo)toolTipController.ActiveObject; } catch { return; } if (aptViewInfo == null) { return; } Guid guid = (Guid)aptViewInfo.Appointment.Id; if (!eventsDict.ContainsKey(guid)) { // В словаре нет ключа т.к. расписание было только что создано var events = new List <DoctorEvent>(ObjectSpace.GetObjects <DoctorEvent>(listView.CollectionSource.Criteria[FILTERKEY])); eventsDict = events.ToDictionary(de => de.Oid, de => de); } DoctorEvent doctorEvent = eventsDict[guid]; // Вид талона (метка) AppointmentLabel label = scheduler.Storage.Appointments.Labels.GetById(doctorEvent.Label); StringBuilder sb = new StringBuilder(); sb.AppendLine(string.Format("Время: с {0:HH:mm} по {1:HH:mm}", doctorEvent.StartOn, doctorEvent.EndOn)); sb.AppendLine(string.Format("Пациент: {0}", doctorEvent.Pacient != null ? doctorEvent.Pacient.FullName : null)); sb.AppendLine(string.Format("Кем создано: {0}", doctorEvent.CreatedBy != null ? doctorEvent.CreatedBy.FullName : null)); sb.AppendLine(string.Format("Кто записал: {0}", doctorEvent.EditedBy != null ? doctorEvent.EditedBy.FullName : null)); sb.AppendLine(string.Format("Вид талона: {0}", label.DisplayName)); if (doctorEvent.Pacient != null) { sb.AppendLine(string.Format("Источник записи: {0}", CaptionHelper.GetDisplayText(doctorEvent.SourceType))); } SuperToolTip SuperTip = new SuperToolTip(); SuperToolTipSetupArgs args = new SuperToolTipSetupArgs(); args.Contents.Text = sb.ToString(); args.Contents.Font = new Font("Times New Roman", 11); SuperTip.Setup(args); e.SuperTip = SuperTip; }; #endregion // Кастомизация коллекции меток var storage = scheduler.Storage; IAppointmentLabelStorage labelStorage = storage.Appointments.Labels; FillLabelStorage(labelStorage); #region Кастомизация всплывающего меню на расписании врача DoctorEvent recordedEvent = null; VisitCase visitCase = null; // Всплывающее меню на расписании врача scheduler.PopupMenuShowing += (o, e) => { Pacient pacient = listView.Tag as Pacient; AppointmentBaseCollection appoinments = (o as SchedulerControl).SelectedAppointments; Appointment appoinment = appoinments.Count == 1 ? appoinments[0] : null; if (appoinment == null) { return; } Guid key = (Guid)appoinment.Id; DoctorEvent dEvent = appoinment != null && eventsDict.ContainsKey(key) ? eventsDict[key] : null; if (e.Menu.Id != DevExpress.XtraScheduler.SchedulerMenuItemId.AppointmentMenu) { return; } if (pacient != null && dEvent.Pacient == null & recordedEvent == null && dEvent.StartOn > DateTime.Now) { e.Menu.Items.Insert(0, new SchedulerMenuItem("Записать пациента", (o_, e_) => { IObjectSpace dEventObjectSpace = XPObjectSpace.FindObjectSpaceByObject(dEvent); dEvent.Pacient = dEventObjectSpace.GetObject(pacient); dEventObjectSpace.CommitChanges(); // Обновление списочного представления listView.CollectionSource.Reload(); // Расписание на которое записан пациент recordedEvent = dEvent; // Создание посещения для пациента visitCase = VisitCase.CreateVisitCase(dEventObjectSpace, dEventObjectSpace.GetObject(pacient), dEvent.AssignedTo, dEvent.StartOn); dEventObjectSpace.CommitChanges(); })); } else if (dEvent != null && dEvent.Pacient != null) { e.Menu.Items.Insert(0, new SchedulerMenuItem("Отменить запись", (o_, e_) => { IObjectSpace dEventObjectSpace = XPObjectSpace.FindObjectSpaceByObject(dEvent); dEvent.Pacient = null; dEventObjectSpace.CommitChanges(); // Обновление списочного представления listView.CollectionSource.Reload(); // Отмена записи пациента на выбранное расписание if (recordedEvent != null && recordedEvent.Oid == dEvent.Oid) { recordedEvent = null; } if (visitCase != null) { dEventObjectSpace.Delete(visitCase); dEventObjectSpace.CommitChanges(); } })); } }; #endregion // Кастомизация цвета фона расписания: // Если выбранный пациент уже записан, то цвет расписания окрашивается в светло-розовый. // Если в расписании записан другой пациент, то цвет расписания окрашивается в морковный. scheduler.AppointmentViewInfoCustomizing += (o_, e_) => { Pacient pacient = listView.Tag as Pacient; if (pacient != null) { Guid guid = (Guid)e_.ViewInfo.Appointment.Id; if (eventsDict.ContainsKey(guid) && eventsDict[guid].Pacient != null) { e_.ViewInfo.Appearance.BackColor = eventsDict[guid].Pacient.Oid == pacient.Oid ? Color.FromArgb(255, 192, 192) : Color.FromArgb(255, 128, 0); } } }; } } } else if (detailView != null) { // Кастомизация коллекции меток foreach (SchedulerLabelPropertyEditor pe in ((DetailView)View).GetItems <SchedulerLabelPropertyEditor>()) { if (pe.Control != null) { ISchedulerStorage storage = ((AppointmentLabelEdit)pe.Control).Storage; IAppointmentLabelStorage labelStorage = storage.Appointments.Labels; FillLabelStorage(labelStorage); } } } }
SchedulerDragData GetDragData(GridView view) { int[] selection = view.GetSelectedRows(); if (selection == null) return null; AppointmentBaseCollection appointments = new AppointmentBaseCollection(); int count = selection.Length; for (int i = 0; i < count; i++) { int rowIndex = selection[i]; Appointment apt = schedulerStorage1.CreateAppointment(AppointmentType.Normal); apt.Subject = "Programación de Visita Cliente " + (string)view.GetRowCellValue(rowIndex, "NombreCliente"); apt.LabelId = (int)Entidades.Enums.Enums.VisitaEstadoVista.Pendiente; // (int)view.GetRowCellValue(rowIndex, "Severity"); apt.StatusId = 0; // (int)view.GetRowCellValue(rowIndex, "Priority"); apt.Duration = new TimeSpan(0, 1, 0, 0); // TimeSpan.FromHours((int)view.GetRowCellValue(rowIndex, "Duration")); apt.Description = "Visita Cliente " + (string)view.GetRowCellValue(rowIndex, "NombreCliente"); IdClienteDraw = (Int64)view.GetRowCellValue(rowIndex, "Id"); appointments.Add(apt); } return new SchedulerDragData(appointments, 0); }
private void TIME_SHEET_ROBOT_EKLE(string _MUSTERI_KODU, DateTime myDTStart, DateTime myDTEnd, bool _OGLEN_TATILI) { TimeSpan ixt = myDTEnd - myDTStart; DateTime DTStart = myDTStart; if (_OGLEN_TATILI) { SqlConnection myConnectionTable = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB.ToString()); myConnectionTable.Open(); for (int i = 1; i <= ixt.Days; i++) { DateTime dt = DTStart; if (DTStart == myDTEnd) { break; } if (dt.DayOfWeek == DayOfWeek.Saturday) { dt = DTStart = DTStart.AddDays(1); i++; } if (dt.DayOfWeek == DayOfWeek.Sunday) { dt = DTStart = DTStart.AddDays(1); i++; } AppointmentBaseCollection selectedApts = schedulerControls.SelectedAppointments; Appointment apt = this.schedulerControls.Storage.CreateAppointment(AppointmentType.Normal); using (SqlCommand myCmd = new SqlCommand()) { string SQL = " SELECT * FROM dbo.ADM_TATILER WHERE (StartDate >= CONVERT(DATETIME, @StartDate, 102)) AND (EndDate <= CONVERT(DATETIME, @EndDate, 102)) "; myCmd.Parameters.Add("@StartDate", dt.ToString("yyyy-MM-dd 09:00:00", DateTimeFormatInfo.InvariantInfo)); myCmd.Parameters.Add("@EndDate", dt.ToString("yyyy-MM-dd 18:00:00", DateTimeFormatInfo.InvariantInfo)); myCmd.CommandText = SQL.ToString(); myCmd.Connection = myConnectionTable; SqlDataReader myReader = myCmd.ExecuteReader(); while (myReader.Read()) { dt = DTStart = DTStart.AddDays(1); i++; } myReader.Close(); } using (SqlCommand myCmd = new SqlCommand()) { myCmd.CommandText = " INSERT INTO dbo.TODO_TIME_SHEET ( StartDate,EndDate , Subject, Location, Description, MAIL_ADRESI ,SIRKET_KODU,ONAY_DIREKTOR )" + " Values (@StartDate,@EndDate , @Subject, @Location, @Description,@MAIL_ADRESI,@SIRKET_KODU,@ONAY_DIREKTOR) "; myCmd.Parameters.Add("@StartDate", SqlDbType.SmallDateTime); myCmd.Parameters["@StartDate"].Value = dt.ToString("yyyy-MM-dd 09:00:00", DateTimeFormatInfo.InvariantInfo); myCmd.Parameters.Add("@EndDate", SqlDbType.SmallDateTime); myCmd.Parameters["@EndDate"].Value = dt.ToString("yyyy-MM-dd 12:00:00", DateTimeFormatInfo.InvariantInfo); myCmd.Parameters.Add("@Subject", SqlDbType.NVarChar); myCmd.Parameters["@Subject"].Value = _MUSTERI_KODU.ToString(); myCmd.Parameters.Add("@Location", SqlDbType.NVarChar); myCmd.Parameters["@Location"].Value = _GLOBAL_PARAMETERS._KULLANICI_MAIL; myCmd.Parameters.Add("@Description", SqlDbType.NVarChar); myCmd.Parameters["@Description"].Value = _MUSTERI_KODU; myCmd.Parameters.Add("@MAIL_ADRESI", SqlDbType.NVarChar); myCmd.Parameters["@MAIL_ADRESI"].Value = _GLOBAL_PARAMETERS._KULLANICI_MAIL; myCmd.Parameters.Add("@SIRKET_KODU", SqlDbType.NVarChar); myCmd.Parameters["@SIRKET_KODU"].Value = _GLOBAL_PARAMETERS._SIRKET_KODU; myCmd.Parameters.Add("@ONAY_DIREKTOR", SqlDbType.NVarChar); myCmd.Parameters["@ONAY_DIREKTOR"].Value = CMBX_DIREKTOR_LIST.EditValue.ToString(); myCmd.Connection = myConnectionTable; myCmd.ExecuteNonQuery(); } using (SqlCommand myCmd = new SqlCommand()) { myCmd.CommandText = " INSERT INTO dbo.TODO_TIME_SHEET ( StartDate,EndDate , Subject, Location, Description, MAIL_ADRESI ,SIRKET_KODU,ONAY_DIREKTOR )" + " Values (@StartDate,@EndDate , @Subject, @Location, @Description,@MAIL_ADRESI,@SIRKET_KODU,@ONAY_DIREKTOR) "; myCmd.Parameters.Add("@StartDate", SqlDbType.SmallDateTime); myCmd.Parameters["@StartDate"].Value = dt.ToString("yyyy-MM-dd 12:00:00", DateTimeFormatInfo.InvariantInfo); myCmd.Parameters.Add("@EndDate", SqlDbType.SmallDateTime); myCmd.Parameters["@EndDate"].Value = dt.ToString("yyyy-MM-dd 13:00:00", DateTimeFormatInfo.InvariantInfo); myCmd.Parameters.Add("@Subject", SqlDbType.NVarChar); myCmd.Parameters["@Subject"].Value = "Öğlen Tatili"; myCmd.Parameters.Add("@Location", SqlDbType.NVarChar); myCmd.Parameters["@Location"].Value = _GLOBAL_PARAMETERS._KULLANICI_MAIL; myCmd.Parameters.Add("@Description", SqlDbType.NVarChar); myCmd.Parameters["@Description"].Value = "Öğlen Tatili"; myCmd.Parameters.Add("@MAIL_ADRESI", SqlDbType.NVarChar); myCmd.Parameters["@MAIL_ADRESI"].Value = _GLOBAL_PARAMETERS._KULLANICI_MAIL; myCmd.Parameters.Add("@SIRKET_KODU", SqlDbType.NVarChar); myCmd.Parameters["@SIRKET_KODU"].Value = _GLOBAL_PARAMETERS._SIRKET_KODU; myCmd.Parameters.Add("@ONAY_DIREKTOR", SqlDbType.NVarChar); myCmd.Parameters["@ONAY_DIREKTOR"].Value = CMBX_DIREKTOR_LIST.EditValue.ToString(); myCmd.Connection = myConnectionTable; myCmd.ExecuteNonQuery(); } using (SqlCommand myCmd = new SqlCommand()) { myCmd.CommandText = " INSERT INTO dbo.TODO_TIME_SHEET ( StartDate,EndDate , Subject, Location, Description, MAIL_ADRESI ,SIRKET_KODU,ONAY_DIREKTOR )" + " Values (@StartDate,@EndDate , @Subject, @Location, @Description,@MAIL_ADRESI,@SIRKET_KODU,@ONAY_DIREKTOR) "; myCmd.Parameters.Add("@StartDate", SqlDbType.SmallDateTime); myCmd.Parameters["@StartDate"].Value = dt.ToString("yyyy-MM-dd 13:00:00", DateTimeFormatInfo.InvariantInfo); myCmd.Parameters.Add("@EndDate", SqlDbType.SmallDateTime); myCmd.Parameters["@EndDate"].Value = dt.ToString("yyyy-MM-dd 18:00:00", DateTimeFormatInfo.InvariantInfo); myCmd.Parameters.Add("@Subject", SqlDbType.NVarChar); myCmd.Parameters["@Subject"].Value = _MUSTERI_KODU.ToString(); myCmd.Parameters.Add("@Location", SqlDbType.NVarChar); myCmd.Parameters["@Location"].Value = _GLOBAL_PARAMETERS._KULLANICI_MAIL; myCmd.Parameters.Add("@Description", SqlDbType.NVarChar); myCmd.Parameters["@Description"].Value = _MUSTERI_KODU; myCmd.Parameters.Add("@MAIL_ADRESI", SqlDbType.NVarChar); myCmd.Parameters["@MAIL_ADRESI"].Value = _GLOBAL_PARAMETERS._KULLANICI_MAIL; myCmd.Parameters.Add("@SIRKET_KODU", SqlDbType.NVarChar); myCmd.Parameters["@SIRKET_KODU"].Value = _GLOBAL_PARAMETERS._SIRKET_KODU; myCmd.Parameters.Add("@ONAY_DIREKTOR", SqlDbType.NVarChar); myCmd.Parameters["@ONAY_DIREKTOR"].Value = CMBX_DIREKTOR_LIST.EditValue.ToString(); myCmd.Connection = myConnectionTable; myCmd.ExecuteNonQuery(); } dt = DTStart = DTStart.AddDays(1); } myConnectionTable.Close(); } else { for (int i = 1; i <= ixt.Days; i++) { DateTime dt = DTStart; if (DTStart == myDTEnd) { break; } if (dt.DayOfWeek == DayOfWeek.Saturday) { dt = DTStart = DTStart.AddDays(1); i++; } if (dt.DayOfWeek == DayOfWeek.Sunday) { dt = DTStart = DTStart.AddDays(1); i++; } AppointmentBaseCollection selectedApts = schedulerControls.SelectedAppointments; Appointment apt = this.schedulerControls.Storage.CreateAppointment(AppointmentType.Normal); SqlConnection myConnectionTable = new SqlConnection(_GLOBAL_PARAMETERS._CONNECTIONSTRING_MDB.ToString()); myConnectionTable.Open(); SqlCommand myCmd = new SqlCommand(); myCmd.CommandText = " INSERT INTO dbo.TODO_TIME_SHEET ( StartDate,EndDate , Subject, Location, Description, MAIL_ADRESI ,SIRKET_KODU,ONAY_DIREKTOR )" + " Values (@StartDate,@EndDate , @Subject, @Location, @Description,@MAIL_ADRESI,@SIRKET_KODU,@ONAY_DIREKTOR) "; myCmd.Parameters.Add("@StartDate", SqlDbType.SmallDateTime); myCmd.Parameters["@StartDate"].Value = dt.ToString("yyyy-MM-dd 09:00:00", DateTimeFormatInfo.InvariantInfo); myCmd.Parameters.Add("@EndDate", SqlDbType.SmallDateTime); myCmd.Parameters["@EndDate"].Value = dt.ToString("yyyy-MM-dd 18:00:00", DateTimeFormatInfo.InvariantInfo); myCmd.Parameters.Add("@Subject", SqlDbType.NVarChar); myCmd.Parameters["@Subject"].Value = _MUSTERI_KODU.ToString(); myCmd.Parameters.Add("@Location", SqlDbType.NVarChar); myCmd.Parameters["@Location"].Value = _GLOBAL_PARAMETERS._KULLANICI_MAIL; myCmd.Parameters.Add("@Description", SqlDbType.NVarChar); myCmd.Parameters["@Description"].Value = _MUSTERI_KODU; myCmd.Parameters.Add("@MAIL_ADRESI", SqlDbType.NVarChar); myCmd.Parameters["@MAIL_ADRESI"].Value = _GLOBAL_PARAMETERS._KULLANICI_MAIL; myCmd.Parameters.Add("@SIRKET_KODU", SqlDbType.NVarChar); myCmd.Parameters["@SIRKET_KODU"].Value = _GLOBAL_PARAMETERS._SIRKET_KODU; myCmd.Parameters.Add("@ONAY_DIREKTOR", SqlDbType.NVarChar); myCmd.Parameters["@ONAY_DIREKTOR"].Value = CMBX_DIREKTOR_LIST.EditValue.ToString(); myCmd.Connection = myConnectionTable; myCmd.ExecuteNonQuery(); myCmd.Connection.Close(); dt = DTStart = DTStart.AddDays(1); } } }
protected void ASPxScheduler1_AppointmentsChanged(object sender, PersistentObjectsEventArgs e) { //Delete Schedule DevExpress.XtraScheduler.Internal.Implementations.AppointmentInstance AppointmentInstance = (DevExpress.XtraScheduler.Internal.Implementations.AppointmentInstance)e.Objects[0]; DeleteSchedule objSchedule = new DeleteSchedule(); objSchedule.Index = 0; if (AppointmentInstance.Type == AppointmentType.Normal) { objSchedule.AppointmentID = Convert.ToInt32(AppointmentInstance.Id); } else if (AppointmentInstance.Type == AppointmentType.Pattern) { objSchedule.AppointmentID = Convert.ToInt32(AppointmentInstance.RecurrencePattern.Id); } switch (AppointmentInstance.Type) { case AppointmentType.ChangedOccurrence: break; case AppointmentType.DeletedOccurrence: case AppointmentType.Pattern: objSchedule.Index = -1; billSysDeleteBO.DeleteEventSchedular(objSchedule); break; case AppointmentType.Normal: // billSysDeleteBO.DeleteEventSchedular(objSchedule); break; case AppointmentType.Occurrence: break; default: break; } if (AppointmentInstance.Type == AppointmentType.Pattern) { OccurrenceCalculator oc = OccurrenceCalculator.CreateInstance(AppointmentInstance.RecurrenceInfo); TimeInterval ttc = new TimeInterval(AppointmentInstance.RecurrenceInfo.Start, AppointmentInstance.RecurrenceInfo.End.Add(AppointmentInstance.Duration)); AppointmentBaseCollection appts = oc.CalcOccurrences(ttc, AppointmentInstance); foreach (Appointment item in appts) { int index = item.RecurrenceIndex; #region Data insert to TXN_CALENDAR try { ArrayList objAdd; Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender(); objAdd = new ArrayList(); objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(AppointmentInstance.CustomFields[0].ToString())); objAdd.Add(item.Start); objAdd.Add(item.Start.Hour + "." + item.Start.Minute); objAdd.Add(AppointmentInstance.Description); objAdd.Add(AppointmentInstance.CustomFields[2]); objAdd.Add("TY000000000000000003"); objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); objAdd.Add(AppointmentInstance.Start.ToString("tt", CultureInfo.InvariantCulture)); int endMin = Convert.ToInt32(item.End.Minute); int endHr = Convert.ToInt32(item.End.Hour); string endTime = item.End.Hour + "." + item.End.Minute; if (endMin >= 60) { endMin = endMin - 60; endHr = endHr + 1; if (endHr > 12) { endHr = endHr - 12; if (AppointmentInstance.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } else if (endHr == 12) { if (AppointmentInstance.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } } objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString()); objAdd.Add(item.End.ToString("tt", CultureInfo.InvariantCulture)); objAdd.Add(AppointmentInstance.StatusKey); objAdd.Add(item.CustomFields["VISIT_TYPE_ID"]); objAdd.Add(AppointmentInstance.Id); objAdd.Add(index); _bill_Sys_Calender.SaveEventFromSchedular(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString()); index++; } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } #endregion } return; } else if (AppointmentInstance.Type == AppointmentType.Normal) { string[] clientData = AppointmentInstance.Location.Split(new char[] { '-' }); Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender(); int index = 0; if (clientData[2].Trim() != "null") { if (_bill_Sys_Calender.CHECKVISIT_FOR_APPOINTMENT(Convert.ToInt32(AppointmentInstance.Id), index, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID)) { #region Data Update to TXN_CALENDAR try { ArrayList objAdd; objAdd = new ArrayList(); objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2])); objAdd.Add(AppointmentInstance.Start); objAdd.Add(AppointmentInstance.Start.Hour + "." + AppointmentInstance.Start.Minute); objAdd.Add(AppointmentInstance.Description); objAdd.Add(clientData[1]); objAdd.Add("TY000000000000000003"); objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); objAdd.Add(AppointmentInstance.Start.ToString("tt", CultureInfo.InvariantCulture)); int endMin = Convert.ToInt32(AppointmentInstance.End.Minute); int endHr = Convert.ToInt32(AppointmentInstance.End.Hour); string endTime = AppointmentInstance.End.Hour + "." + AppointmentInstance.End.Minute; if (endMin >= 60) { endMin = endMin - 60; endHr = endHr + 1; if (endHr > 12) { endHr = endHr - 12; if (AppointmentInstance.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } else if (endHr == 12) { if (AppointmentInstance.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } } objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString()); objAdd.Add(AppointmentInstance.End.ToString("tt", CultureInfo.InvariantCulture)); objAdd.Add(AppointmentInstance.StatusKey); objAdd.Add(clientData[0]); objAdd.Add(AppointmentInstance.Id); objAdd.Add(index); objAdd.Add(AppointmentInstance.Id); _bill_Sys_Calender.UPDATEEventByAppointmentId(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString()); index++; } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } #endregion } else { #region Data insert to TXN_CALENDAR try { ArrayList objAdd; objAdd = new ArrayList(); objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2])); objAdd.Add(AppointmentInstance.Start); objAdd.Add(AppointmentInstance.Start.Hour + "." + AppointmentInstance.Start.Minute); objAdd.Add(AppointmentInstance.Description); objAdd.Add(clientData[1]); objAdd.Add("TY000000000000000003"); objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); objAdd.Add(AppointmentInstance.Start.ToString("tt", CultureInfo.InvariantCulture)); int endMin = Convert.ToInt32(AppointmentInstance.End.Minute); int endHr = Convert.ToInt32(AppointmentInstance.End.Hour); string endTime = AppointmentInstance.End.Hour + "." + AppointmentInstance.End.Minute; if (endMin >= 60) { endMin = endMin - 60; endHr = endHr + 1; if (endHr > 12) { endHr = endHr - 12; if (AppointmentInstance.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } else if (endHr == 12) { if (AppointmentInstance.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } } objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString()); objAdd.Add(AppointmentInstance.End.ToString("tt", CultureInfo.InvariantCulture)); objAdd.Add(0); objAdd.Add(clientData[0]); objAdd.Add(AppointmentInstance.Id); objAdd.Add(index); _bill_Sys_Calender.SaveEventFromSchedular(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString()); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } #endregion } } } else if (AppointmentInstance.Type == AppointmentType.DeletedOccurrence) { //Deleted code in TXN_CALENDER_EVENTS //DeleteSchedule objSchedule = new DeleteSchedule(); //objSchedule.Index = apt.RecurrenceIndex; //objSchedule.AppointmentID = Convert.ToInt32(apt.RecurrencePattern.Id); //billSysDeleteBO.DeleteEventSchedular(objSchedule); //return; } else if (AppointmentInstance.Type == AppointmentType.ChangedOccurrence) { string[] clientData = AppointmentInstance.Location.Split(new char[] { '-' }); int index = AppointmentInstance.RecurrenceIndex; #region Data Update to TXN_CALENDAR try { ArrayList objAdd; Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender(); objAdd = new ArrayList(); objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2])); objAdd.Add(AppointmentInstance.Start); objAdd.Add(AppointmentInstance.Start.Hour + "." + AppointmentInstance.Start.Minute); objAdd.Add(AppointmentInstance.Description); objAdd.Add(clientData[1]); objAdd.Add("TY000000000000000003"); objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); objAdd.Add(AppointmentInstance.Start.ToString("tt", CultureInfo.InvariantCulture)); int endMin = Convert.ToInt32(AppointmentInstance.End.Minute); int endHr = Convert.ToInt32(AppointmentInstance.End.Hour); string endTime = AppointmentInstance.End.Hour + "." + AppointmentInstance.End.Minute; if (endMin >= 60) { endMin = endMin - 60; endHr = endHr + 1; if (endHr > 12) { endHr = endHr - 12; if (AppointmentInstance.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } else if (endHr == 12) { if (AppointmentInstance.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } } objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString()); objAdd.Add(AppointmentInstance.End.ToString("tt", CultureInfo.InvariantCulture)); objAdd.Add(AppointmentInstance.StatusKey); objAdd.Add(clientData[0]); objAdd.Add(AppointmentInstance.RecurrencePattern.Id); objAdd.Add(index); objAdd.Add(AppointmentInstance.Id); _bill_Sys_Calender.UPDATEEventByAppointmentId(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString()); index++; } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } #endregion } }
public static object GenerateListViewAppointmentCollection(AppointmentStorage storage, AppointmentBaseCollection sourceAppointments, DayOfWeek dayOfWeek) { BindingList <ListViewAppointment> listViewAppointments = new BindingList <ListViewAppointment>(); foreach (Appointment appointment in sourceAppointments) { listViewAppointments.Add(CreateListViewAppointment(storage, appointment, dayOfWeek)); } return(listViewAppointments); }
private int CountAppointmentsByCriteria(SchedulerHeader rh, TimeInterval visTime) { AppointmentBaseCollection col = schedulerControl1.ActiveView.GetAppointments().FindAll(delegate(Appointment apt) { return((apt.ResourceIds.Contains(rh.Resource.Id) || (Object.Equals(apt.ResourceId, ResourceEmpty.Id))) && (visTime.Contains(new TimeInterval(apt.Start, apt.End)))); }); return(col.Count); }
protected void ASPxScheduler1_AppointmentsInserted(object sender, DevExpress.XtraScheduler.PersistentObjectsEventArgs e) { //Task.Factory.StartNew(() => //{ Appointment apt = (Appointment)e.Objects[0]; string[] clientData = apt.Location.Split(new char[] { '-' }); if (clientData[2].Trim() != "null") { if (apt.Type == AppointmentType.Pattern) { OccurrenceCalculator oc = OccurrenceCalculator.CreateInstance(apt.RecurrenceInfo); TimeInterval ttc = new TimeInterval(apt.RecurrenceInfo.Start, apt.RecurrenceInfo.End.Add(apt.Duration)); AppointmentBaseCollection appts = oc.CalcOccurrences(ttc, apt); foreach (Appointment item in appts) { int index = item.RecurrenceIndex; #region Data insert to TXN_CALENDAR try { ArrayList objAdd; Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender(); objAdd = new ArrayList(); objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2])); objAdd.Add(item.Start); objAdd.Add(item.Start.Hour + "." + item.Start.Minute); objAdd.Add(apt.Description); objAdd.Add(clientData[1]); objAdd.Add("TY000000000000000003"); objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); objAdd.Add(apt.Start.ToString("tt", CultureInfo.InvariantCulture)); int endMin = Convert.ToInt32(item.End.Minute); int endHr = Convert.ToInt32(item.End.Hour); string endTime = item.End.Hour + "." + item.End.Minute; if (endMin >= 60) { endMin = endMin - 60; endHr = endHr + 1; if (endHr > 12) { endHr = endHr - 12; if (apt.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } else if (endHr == 12) { if (apt.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } } objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString()); objAdd.Add(item.End.ToString("tt", CultureInfo.InvariantCulture)); objAdd.Add(apt.StatusId); objAdd.Add(clientData[0]); objAdd.Add(apt.Id); objAdd.Add(index); _bill_Sys_Calender.SaveEventFromSchedular(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString()); index++; } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } #endregion } return; } else if (apt.Type == AppointmentType.Normal) { #region Data insert to TXN_CALENDAR try { ArrayList objAdd; Bill_Sys_Calender _bill_Sys_Calender = new Bill_Sys_Calender(); objAdd = new ArrayList(); objAdd.Add(_bill_Sys_Calender.GetCaseIDByPatient(clientData[2])); objAdd.Add(apt.Start); objAdd.Add(apt.Start.Hour + "." + apt.Start.Minute); objAdd.Add(apt.Description); objAdd.Add(clientData[1]); objAdd.Add("TY000000000000000003"); objAdd.Add(((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID); objAdd.Add(apt.Start.ToString("tt", CultureInfo.InvariantCulture)); int endMin = Convert.ToInt32(apt.End.Minute); int endHr = Convert.ToInt32(apt.End.Hour); string endTime = apt.End.Hour + "." + apt.End.Minute; if (endMin >= 60) { endMin = endMin - 60; endHr = endHr + 1; if (endHr > 12) { endHr = endHr - 12; if (apt.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } else if (endHr == 12) { if (apt.End.Hour != 12) { if (endTime == "AM") { endTime = "PM"; } else if (endTime == "PM") { endTime = "AM"; } } } } objAdd.Add(endHr.ToString().PadLeft(2, '0').ToString() + "." + endMin.ToString().PadLeft(2, '0').ToString()); objAdd.Add(apt.End.ToString("tt", CultureInfo.InvariantCulture)); objAdd.Add(0); objAdd.Add(clientData[0]); objAdd.Add(apt.Id); objAdd.Add(0); _bill_Sys_Calender.SaveEventFromSchedular(objAdd, ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID.ToString()); } catch (Exception ex) { Elmah.ErrorSignal.FromCurrentContext().Raise(ex); } #endregion return; } else if (apt.Type == AppointmentType.DeletedOccurrence) { //Deleted code in TXN_CALENDER_EVENTS DeleteSchedule objSchedule = new DeleteSchedule(); objSchedule.Index = apt.RecurrenceIndex; objSchedule.AppointmentID = Convert.ToInt32(apt.RecurrencePattern.Id); billSysDeleteBO.DeleteEventSchedular(objSchedule); return; } else if (apt.Type == AppointmentType.ChangedOccurrence) { return; } } }
private void FillConflictedAppointmentsCollection(AppointmentBaseCollection conflicts, TimeInterval interval, AppointmentBaseCollection collection, Appointment currApt) { for (int i = 0; i < collection.Count; i++) { Appointment apt = collection[i]; if (new TimeInterval(apt.Start, apt.End).IntersectsWith(interval) & !(apt.Start == interval.End || apt.End == interval.Start)) { string local_usado = apt.CustomFields["Local"].ToString(); try { mia.local_a_usar = currApt.CustomFields["Local"].ToString(); } catch { } if ((apt != currApt) && (local_usado == mia.local_a_usar)) { conflicts.Add(apt); toolTipController1.ShowHint("Horario y Lugar Ocupado.", Form_squedul.MousePosition); } } if (apt.Type == AppointmentType.Pattern) { FillConflictedAppointmentsCollection(conflicts, interval, apt.GetExceptions(), currApt); } } }
private void InitializeGridControlAppointments() { AppointmentBaseCollection sourceAppointmentCollection = GetFilteredAppointments(new TimeInterval(DateTime.MinValue, DateTime.MaxValue)); GridControlAppointments.DataSource = ListViewDataGenerator.GenerateListViewAppointmentCollection(OwnerScheduler.Storage.Appointments, sourceAppointmentCollection, OwnerScheduler.FirstDayOfWeek); }
public override string GetTimeScaleHeaderCaption(TimeScaleHeader header) { //Return MyBase.GetTimeScaleHeaderCaption(header) if (header.Scale is ShiftsTimeScaleFixedInterval) { double assignedPeople = 0; if (Provider.Storage == null) { return(""); } AppointmentBaseCollection scheduledProduction = Provider.Storage.GetAppointments(header.Interval); //INSTANT C# NOTE: There is no C# equivalent to VB's implicit 'once only' variable initialization within loops, so the following variable declaration has been placed prior to the loop: double assignedQuantity = 0; //INSTANT C# NOTE: There is no C# equivalent to VB's implicit 'once only' variable initialization within loops, so the following variable declaration has been placed prior to the loop: //double assignedQuantity = 0; foreach (Appointment productionSchedule in scheduledProduction) { if (productionSchedule.CustomFields["People"] != null) { // Dim assignedQuantity As Double double.TryParse(productionSchedule.CustomFields["People"].ToString(), out assignedQuantity); assignedPeople += assignedQuantity; } if (productionSchedule.CustomFields["MachineOperator"] != null) { // Dim assignedQuantity As Double double.TryParse(productionSchedule.CustomFields["MachineOperator"].ToString(), out assignedQuantity); assignedPeople += assignedQuantity; } } string caption = base.GetTimeScaleHeaderCaption(header); DateTime today = header.Interval.Start; DateTime tomorrow = header.Interval.Start.Date.AddDays(1); string productionDay = string.Empty; if (today != DateTime.MinValue) { if (header.Interval.End <= new DateTime(today.Year, today.Month, today.Day, 9, 0, 0)) { productionDay = string.Format("{0}. ", today.AddDays(-1).ToString("ddd")); } else { productionDay = string.Format("{0}. ", today.ToString("ddd")); } } if (today >= new DateTime(today.Year, today.Month, today.Day, 1, 0, 0) && header.Interval.End <= new DateTime(today.Year, today.Month, today.Day, 9, 0, 0)) { caption = string.Format("{0}Shift 3", productionDay); } else if (today >= new DateTime(today.Year, today.Month, today.Day, 9, 0, 0) && header.Interval.End <= new DateTime(today.Year, today.Month, today.Day, 17, 0, 0)) { caption = string.Format("{0}Shift 1", productionDay); } else if (today >= new DateTime(today.Year, today.Month, today.Day, 17, 0, 0) && header.Interval.End <= new DateTime(tomorrow.Year, tomorrow.Month, tomorrow.Day, 1, 0, 0)) { caption = string.Format("{0}Shift 2", productionDay); } caption = string.Format("{0} - People\\Operators Assigned {1}", caption, assignedPeople); return(caption); } else { return(base.GetTimeScaleHeaderCaption(header)); } }
private bool IsIntersectingWithAnotherAppointment(DevExpress.XtraScheduler.Appointment appointment, DevExpress.XtraScheduler.ResourceIdCollection resourceIdCollection) { AppointmentBaseCollection abc = schedulerStorage1.GetAppointments(appointment.Start, appointment.End); return(abc.Count > 0? true:false); }
SchedulerDragData GetDragData(GridView view) { int[] selection = view.GetSelectedRows(); if (selection == null) { return(null); } AppointmentBaseCollection appointments = new AppointmentBaseCollection(); int count = selection.Length; for (int i = 0; i < count; i++) { int rowIndex = selection[i]; MyTask myTask = view.GetRow(rowIndex) as MyTask; //imposto una variabile a livello //di modulo per il richiamo alle successive azioni postdragdrop if (Properties.Settings.Default.Main_RenewActivityAfterDragDrop || Properties.Settings.Default.Main_MarkActivityCompletedafterDragDrop) { _draggedTask = myTask; } else { _draggedTask = null; } if (myTask == null) { break; } Appointment apt = schedulerStorage1.CreateAppointment(AppointmentType.Normal); apt.AllDay = false; if (schedulerControl1.ActiveViewType != SchedulerViewType.Day && schedulerControl1.ActiveViewType != SchedulerViewType.WorkWeek) { AppointmentDateValidator v = AppointmentUtils.GetProposedDate(apt.Start); apt.Start = v.StartDate; apt.End = v.EndDate; } else { apt.Duration = TimeSpan.FromHours(0.5); } apt.Subject = myTask.Subject; //apt.LabelId = (int)view.GetRowCellValue(rowIndex, "Severity"); //apt.StatusId = (int)view.GetRowCellValue(rowIndex, "Priority"); //WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource r = new ResourceHandler().GetAll()[0] as WIN.SCHEDULING_APPLICATION.DOMAIN.ComboElements.Resource; ////apt.ResourceId = r.Id; //if (schedulerControl1.GroupType == SchedulerGroupType.None) // apt.SetValue(schedulerStorage1, "Resource", r); apt.SetValue(schedulerStorage1, "Label", new LabelHandler().GetAll()[0]); if (myTask.Customer != null) { apt.SetValue(schedulerStorage1, "Customer", myTask.Customer); Customer c = myTask.Customer; apt.Location = string.Format("{0} {1} {2}", c.Residenza.Via, c.Residenza.Cap, c.Residenza.Comune.Descrizione); if (string.IsNullOrEmpty(myTask.Description)) { apt.Description = c.OtherDataSummary; } } if (!string.IsNullOrEmpty(myTask.Description)) { apt.Description = myTask.Description; } appointments.Add(apt); } return(new SchedulerDragData(appointments, 0)); }