private void calendar1_ItemTextEdited(object sender, CalendarItemCancelEventArgs e) { CalendarItem currentItem = (CalendarItem)e.Item; TodoCalendarPosition position = (TodoCalendarPosition)currentItem.Tag; position.Text = currentItem.Text; }
private void calendar1_ItemCreated(object sender, CalendarItemCancelEventArgs e) { if (e.Item.Text == "") { MessageBox.Show("No Information"); return; } if (patientTxt.Text == "") { MessageBox.Show("Please select the patient"); return; } _items.Add(e.Item); string priority = "Medium"; if (!String.IsNullOrEmpty(priorityCbx.Text)) { priority = priorityCbx.Text; } string ID = Guid.NewGuid().ToString(); var start = Convert.ToDateTime(e.Item.Date).ToString("yyyy-MM-dd") + "T" + Convert.ToDateTime(e.Item.Date).ToString("HH:mm:ss"); var end = Convert.ToDateTime(e.Item.EndDate).ToString("yyyy-MM-dd") + "T" + Convert.ToDateTime(e.Item.EndDate).ToString("HH:mm:ss"); _event = new Events(ID, Helper.CleanString(e.Item.Text), start, end, practitionerTxt.Text, patientTxt.Text, DateTime.Now.Date.ToString("yyyy-MM-dd"), patientID, "due", userID, Convert.ToDateTime(e.Item.Date).ToString("yyyy-MM-dd"), "false", priority, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "f", contact, email, departmentCbx.Text, clinicCbx.Text, Helper.orgID); Global._events.Add(_event); string Query2 = "INSERT INTO events (id, details, starts, ends, users, patient, created, patientID, status, userID, dated,notif,priority, sync,cal,contact,email) VALUES ('" + ID + "','" + Helper.CleanString(e.Item.Text) + "','" + start + "','" + end + "','" + practitionerTxt.Text + "','" + patientTxt.Text + "','" + DateTime.Now.Date.ToString("yyyy-MM-dd") + "','" + patientID + "','due','" + userID + "','" + Convert.ToDateTime(e.Item.Date).ToString("yyyy-MM-dd") + "','false','" + priority + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','f','" + contact + "','" + email + "');"; DBConnect.Execute(Query2); MessageBox.Show("Information saved" + start + " to" + end); }
private void calendar1_ItemCreated(object sender, CalendarItemCancelEventArgs e) { SuspendRefreshFromTaskList = true; bool success = taskPlugin.AddSubTask(e.Item.Text, e.Item.StartDate, e.Item.EndDate); if (!success) { e.Cancel = true; } SuspendRefreshFromTaskList = false; }
private void calendar1_ItemCreating(object sender, CalendarItemCancelEventArgs e) { if (Application.OpenForms["NewAppointment"] as NewAppointment == null && thisPatientID == 0) { NewAppointment newAppointment = new NewAppointment(e.Item, thisProviderID, calendar1, this); newAppointment.Show(); } if (Application.OpenForms["NewAppointmentFromPatientView"] as NewAppointmentFromPatientView == null && thisPatientID != 0) { NewAppointmentFromPatientView newAppointment = new NewAppointmentFromPatientView(thisPatientID, thisProviderID, e.Item, calendar1, _items, this, this.patientHome); newAppointment.Show(); } }
private void calendarView_ItemCreated(object sender, CalendarItemCancelEventArgs e) { if ((e.Item.StartDate.Year == e.Item.EndDate.Year) && (e.Item.StartDate.Month == e.Item.EndDate.Month) && (e.Item.StartDate.Day == e.Item.EndDate.Day)) { BacnetDate newbd = new BacnetDate((byte)(e.Item.StartDate.Year - 1900), (byte)e.Item.StartDate.Month, (byte)e.Item.StartDate.Day); listEntries.Items.Add(newbd); calendarEntries.Entries.Add(newbd); } else { BacnetDateRange newbdr = new BacnetDateRange(); newbdr.startDate = new BacnetDate((byte)(e.Item.StartDate.Year - 1900), (byte)e.Item.StartDate.Month, (byte)e.Item.StartDate.Day); newbdr.endDate = new BacnetDate((byte)(e.Item.EndDate.Year - 1900), (byte)e.Item.EndDate.Month, (byte)e.Item.EndDate.Day); listEntries.Items.Add(newbdr); calendarEntries.Entries.Add(newbdr); } SetCalendarDisplayDate(CalendarStartRequested); }
private void calendar1_ItemDeleting(object sender, CalendarItemCancelEventArgs e) { Visit visit1 = new Visit(Convert.ToInt32(e.Item.ID), userID); if (!visit1.canEditPlan) { MessageBox.Show("Невозможно удалить план в прошлом", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; return; } if ((visit1.CommRD != "") && (globalData.UserAccess > 4)) { MessageBox.Show("С комментариями руководителя нельзя удалить план", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Warning); e.Cancel = true; } else { visit1.Delete(); globalData.update = true; } }
private void calendar1_ItemCreating(object sender, CalendarItemCancelEventArgs e) { e.Cancel = true; }
private void calendarView_ItemCreated(object sender, CalendarItemCancelEventArgs e) { }
private void calendar1_ItemCreated(object sender, CalendarItemCancelEventArgs e) { _items.Add(e.Item); }
protected virtual void OnItemCreated(CalendarItemCancelEventArgs e) { if (ItemCreated != null) { ItemCreated(this, e); } }
void oCalendario2_ItemCreated(object sender, CalendarItemCancelEventArgs e) { itemsCitas2.Add(e.Item);//Agregamos los ítems al calendario }
void calendar_ItemCreated(object sender, CalendarItemCancelEventArgs e) { LoadCalendarView(); }
private void calendar1_ItemCreated(object sender, CalendarItemCancelEventArgs e) => _items.Add(new TaskItem(e.Item));
/// <summary> /// Finalizes editing the <see cref="EditModeItem"/>. /// </summary> /// <param name="cancel">Value indicating if edition of item should be canceled.</param> public void FinalizeEditMode(bool cancel) { if (!EditMode || EditModeItem == null || _finalizingEdition) return; _finalizingEdition = true; string cancelText = _editModeItem.Text; CalendarItem itemBuffer = _editModeItem; _editModeItem = null; CalendarItemCancelEventArgs evt = new CalendarItemCancelEventArgs(itemBuffer); if(!cancel) itemBuffer.Text = TextBox.Text.Trim(); if (TextBox != null) { TextBox.Visible = false; Controls.Remove(TextBox); TextBox.Dispose(); } if(_editModeItem != null) Invalidate(itemBuffer); _textBox = null; if (_creatingItem) { OnItemCreated(evt); } else { OnItemEdited(evt); } if (evt.Cancel) { itemBuffer.Text = cancelText; } _creatingItem = false; _finalizingEdition = false; if (State == CalendarState.EditingItemText) { SetState(CalendarState.Idle); } }
/// <summary> /// Creates a new item on the current selection. /// If there's no selection, this will be ignored. /// </summary> /// <param name="itemText">Text of the item</param> /// <param name="editMode">If <c>true</c> activates the edit mode so user can edit the text of the item.</param> public void CreateItemOnSelection(string itemText, bool editMode) { if (SelectedElementEnd == null || SelectedElementStart == null) return; CalendarTimeScaleUnit unitEnd = SelectedElementEnd as CalendarTimeScaleUnit; CalendarDayTop dayTop = SelectedElementEnd as CalendarDayTop; CalendarDay day = SelectedElementEnd as CalendarDay; TimeSpan duration = unitEnd != null ? unitEnd.Duration : new TimeSpan(23, 59, 59); CalendarItem item = new CalendarItem(this); DateTime dstart = SelectedElementStart.Date; DateTime dend = SelectedElementEnd.Date; if (dend.CompareTo(dstart) < 0) { DateTime dtmp = dend; dend = dstart; dstart = dtmp; } item.StartDate = dstart; item.EndDate = dend.Add(duration); item.Text = itemText; CalendarItemCancelEventArgs evtA = new CalendarItemCancelEventArgs(item); OnItemCreating(evtA); if (!evtA.Cancel) { Items.Add(item); if (editMode) { _creatingItem = true; ActivateEditMode(item); } } }
/// <summary> /// Activates the edit mode on the specified item /// </summary> /// <param name="item"></param> public void ActivateEditMode(CalendarItem item) { CalendarItemCancelEventArgs evt = new CalendarItemCancelEventArgs(item); if (!_creatingItem) { OnItemEditing(evt); } if (evt.Cancel) { return; } _editModeItem = item; TextBox = new CalendarTextBox(this); TextBox.KeyDown += new KeyEventHandler(TextBox_KeyDown); TextBox.LostFocus += new EventHandler(TextBox_LostFocus); Rectangle r = item.Bounds; r.Inflate(-2, -2); TextBox.Bounds = r; TextBox.BorderStyle = BorderStyle.None; TextBox.Text = item.Text; TextBox.Multiline = true; Controls.Add(TextBox); TextBox.Visible = true; TextBox.Focus(); TextBox.SelectionStart = TextBox.Text.Length; SetState(CalendarState.EditingItemText); }
/// <summary> /// Deletes the currently selected item /// </summary> private void DeleteSelectedItems() { Stack<CalendarItem> toDelete = new Stack<CalendarItem>(); foreach (CalendarItem item in Items) { if (item.Selected) { CalendarItemCancelEventArgs evt = new CalendarItemCancelEventArgs(item); OnItemDeleting(evt); if (!evt.Cancel) { toDelete.Push(item); } } } if (toDelete.Count > 0) { while (toDelete.Count > 0) { CalendarItem item = toDelete.Pop(); Items.Remove(item); OnItemDeleted(new CalendarItemEventArgs(item)); } Renderer.PerformItemsLayout(); } }
protected virtual void OnItemEditing(CalendarItemCancelEventArgs e) { if (ItemTextEditing != null) { ItemTextEditing(this, e); } }
void calendar_ItemCreating(object sender, CalendarItemCancelEventArgs e) { bool morning; if (_topClick.HasValue) { morning = _topClick.Value ? true : false; } else { e.Cancel = true; return; } string teacherText; string subjectText; string roomText; string promotionText; bool? isIl = null; string additionnalText = ""; #region Filter switch switch (CurrentPeriod.CurrentUcFilter) { case "ucPromotion1": teacherText = ucPromotion1.teacherComboBox.Text; subjectText = ucPromotion1.subjectComboBox.Text; roomText = ucPromotion1.roomComboBox.Text; promotionText = ucPromotion1.promotionComboBox.Text; additionnalText = ucPromotion1.texBoxAddText.Text; if (ucPromotion1.sectorComboBox.Text == "IL") { isIl = true; } else if (ucPromotion1.sectorComboBox.Text == "SR") { isIl = false; } break; case "ucRoom1": teacherText = ucRoom1.teacherComboBox.Text; subjectText = ucRoom1.subjectComboBox.Text; roomText = ucRoom1.roomComboBox.Text; promotionText = ucRoom1.promotionComboBox.Text; additionnalText = ucRoom1.texBoxAddText.Text; if (ucRoom1.sectorComboBox.Text == "IL") { isIl = true; } else if (ucRoom1.sectorComboBox.Text == "SR") { isIl = false; } break; case "ucTeacher1": teacherText = ucTeacher1.teacherComboBox.Text; subjectText = ucTeacher1.subjectComboBox.Text; roomText = ucTeacher1.roomComboBox.Text; promotionText = ucTeacher1.promotionComboBox.Text; additionnalText = ucTeacher1.texBoxAddText.Text; if (ucTeacher1.sectorComboBox.Text == "IL") { isIl = true; } else if (ucTeacher1.sectorComboBox.Text == "SR") { isIl = false; } break; default: throw new ArgumentException("Current filter is not set up properly"); } #endregion bool conflict = isAffectationConflict(e.Item.StartDate.Date, isIl, morning, teacherText, subjectText, roomText, promotionText); if (conflict) { e.Cancel = true; return; } else { #region Temporary CalendarItem Creation bool isAddText = false; if (additionnalText != String.Empty) { isAddText = true; } Teacher teacher = CurrentPeriod.ListTeachers.Where(t => t.Name == teacherText).SingleOrDefault(); Subject subject = CurrentPeriod.ListSubjects.Where(s => s.Name == subjectText).Single(); Room room = CurrentPeriod.ListRooms.Where(r => r.Name == roomText).Single(); List <Promotion> promotions = CurrentPeriod.ListPromotion.Where(p => p.Name == promotionText).ToList(); Slot newSlot; if (isAddText) { newSlot = new Slot(e.Item.StartDate, morning, room, subject, teacher, promotions, isIl, additionnalText); } else { newSlot = new Slot(e.Item.StartDate, morning, room, subject, teacher, promotions, isIl); } bool roomConflict = IsRoomAffectationConflict(newSlot); if (roomConflict) { e.Cancel = true; return; } CurrentPeriod.addSlot(newSlot); #endregion } _topClick = null; }
private void calendar1_ItemTextEdited(object sender, CalendarItemCancelEventArgs e) { SuspendRefreshFromTaskList = true; ((MapNode)e.Item.Tag).Text = e.Item.Text; SuspendRefreshFromTaskList = false; }
void oCalendario2_ItemDeleting(object sender, CalendarItemCancelEventArgs e) { //Cancelamos la eliminación de los ítems directamente desde el calendario mediante la tecla DEL o SUPR e.Cancel = true; }
private void calendar1_ItemCreated(object sender, CalendarItemCancelEventArgs e) { //CalendarItem currentItem = (CalendarItem)e.Item; //currentItem.Tag = AddCalendarItemToCalendar(currentItem); }
void oCalendario2_ItemCreating(object sender, CalendarItemCancelEventArgs e) { e.Cancel = true; }
private void calendar_ItemTextEdited(object sender, CalendarItemCancelEventArgs e) { e.Item.IsSynchronized = false; }