Exemple #1
0
    public override void DataBind()
    {
        base.DataBind();
        AppointmentFormTemplateContainer container = (AppointmentFormTemplateContainer)Parent;

        Appointment             apt = container.Appointment;
        IAppointmentStorageBase appointmentStorage = container.Control.Storage.Appointments;
        IAppointmentLabel       label  = appointmentStorage.Labels.GetById(apt.LabelKey);
        IAppointmentStatus      status = appointmentStorage.Statuses.GetById(apt.StatusKey);

        edtLabel.SelectedIndex  = appointmentStorage.Labels.IndexOf(label);
        edtStatus.SelectedIndex = appointmentStorage.Statuses.IndexOf(status);

        PopulateResourceEditors(apt, container);

        chkRecurrence.Visible = container.ShouldShowRecurrence;
        //AppointmentRecurrenceForm1.Visible = container.ShouldShowRecurrence;

        if (container.Appointment.HasReminder)
        {
            cbReminder.Value    = container.Appointment.Reminder.TimeBeforeStart.ToString();
            chkReminder.Checked = true;
        }
        else
        {
            cbReminder.ClientEnabled = false;
        }

        btnOk.ClientSideEvents.Click     = container.SaveHandler;
        btnCancel.ClientSideEvents.Click = container.CancelHandler;
        btnDelete.ClientSideEvents.Click = container.DeleteHandler;
    }
    public override void DataBind()
    {
        base.DataBind();

        AppointmentFormTemplateContainer container = (AppointmentFormTemplateContainer)Parent;
        Appointment             apt = container.Appointment;
        IAppointmentStorageBase appointmentStorage = container.Control.Storage.Appointments;
        IAppointmentLabel       label  = appointmentStorage.Labels.GetById(apt.LabelKey);
        IAppointmentStatus      status = appointmentStorage.Statuses.GetById(apt.StatusKey);

        edtLabel.ValueType      = apt.LabelKey.GetType();
        edtLabel.SelectedIndex  = appointmentStorage.Labels.IndexOf(label);
        edtStatus.ValueType     = apt.StatusKey.GetType();
        edtStatus.SelectedIndex = appointmentStorage.Statuses.IndexOf(status);

        PopulateResourceEditors(apt, container);

        BindSubjectCombobox();
        cbSubject.Value   = container.Subject;
        tbCustomInfo.Text = container.Appointment.CustomFields["ApptCustomInfo"] != null ? container.Appointment.CustomFields["ApptCustomInfo"].ToString() : "";

        AppointmentRecurrenceForm1.Visible = container.ShouldShowRecurrence;

        if (apt.HasReminder)
        {
            cbReminder.Value    = apt.Reminder.TimeBeforeStart.ToString();
            chkReminder.Checked = true;
        }
        else
        {
            cbReminder.ClientEnabled = false;
        }

        if (TimeZonesEnabled)
        {
            cbTimeZone.DataSource = TimeZoneInfo.GetSystemTimeZones();
            cbTimeZone.ValueField = "Id";
            cbTimeZone.TextField  = "DisplayName";
            cbTimeZone.DataBind();
            cbTimeZone.Value   = container.TimeZoneId;
            cbTimeZone.Enabled = apt.Type == AppointmentType.Normal || apt.Type == AppointmentType.Pattern;
        }

        //btnOk.ClientSideEvents.Click = container.SaveHandler;
        btnCancel.ClientSideEvents.Click = container.CancelHandler;
        btnDelete.ClientSideEvents.Click = container.DeleteHandler;
        JSProperties.Add("cpHasExceptions", apt.HasExceptions);
        //btnDelete.Enabled = !container.IsNewAppointment;
    }