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; } }