private void calendar1_ItemDoubleClick(object sender, CalendarItemEventArgs e)
        {
            Visit visit1 = new Visit(Convert.ToInt32(userID), e.Item.StartDate);

            if (e.Item.ID == null)
            {
                e.Item.ID = "0";
            }
            if ((e.Item.ID == "0") && (!visit1.canEditPlan) && (!visit1.canEditFact))
            {
                calendar1.Items.RemoveAt(calendar1.Items.Count - 1);
                MessageBox.Show("Невозможно добавить план в прошлое", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            AddEditVisitPlanDay aeVPD;

            if (e.Item.ID != "0")
                aeVPD = new AddEditVisitPlanDay(new Visit(Convert.ToInt32(e.Item.ID), Convert.ToInt32(userID)));
            else
                aeVPD = new AddEditVisitPlanDay(visit1);

            if ((aeVPD.ShowDialog() == System.Windows.Forms.DialogResult.Cancel) && (e.Item.ID == "0"))
                calendar1.Items.RemoveAt(calendar1.Items.Count - 1);
        }
Example #2
0
        private void createNewVisit_Click(object sender, EventArgs e)
        {
            AddEditVisitPlanDay aeVPD = new AddEditVisitPlanDay(new Visit(visit1, dateNewVisit.Value));

            if (aeVPD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                saveVisitPlanDay();
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            int num = getNumberComponent("btn1", sender);

            AddEditVisitPlanDay aeVPD = new AddEditVisitPlanDay(new Visit(visit1[num], dateNew1[num].Value));

            if (aeVPD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                saveVisitPlanDay(num);
            }
        }
        private void button2_Click(object sender, EventArgs e)
        {
            int num = getNumberComponent("btn1", sender);

            AddEditVisitPlanDay aeVPD = new AddEditVisitPlanDay(new Visit(visit1[num], dateNew1[num].Value));
            if (aeVPD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                saveVisitPlanDay(num);
        }
        private void createNewVisit_Click(object sender, EventArgs e)
        {
            AddEditVisitPlanDay aeVPD = new AddEditVisitPlanDay(new Visit(visit1, dateNewVisit.Value));

            if (aeVPD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                saveVisitPlanDay();
        }