Esempio n. 1
0
            public override void VisitAttribute(AttributeSyntax node)
            {
                var name = node.Name.ToString();

                if (name == "JSInternalFunction")
                {
                    JSInternalFunctionMethods.Add((MethodDeclarationSyntax)node.Parent.Parent);
                }
                else if (name == "JSCallFunction")
                {
                    JSCallFunctionMethods.Add((MethodDeclarationSyntax)node.Parent.Parent);
                    if (node.ArgumentList != null)
                    {
                        throw new InvalidOperationException("Arguments are not supported for [JSCallFunction].");
                    }
                }
                else if (name == "JSConstructorFunction")
                {
                    JSConstructorFunctionMethods.Add((MethodDeclarationSyntax)node.Parent.Parent);
                    if (node.ArgumentList != null)
                    {
                        throw new InvalidOperationException("Arguments are not supported for [JSConstructorFunction].");
                    }
                }
                else if (name == "JSProperty")
                {
                    JSProperties.Add((PropertyDeclarationSyntax)node.Parent.Parent);
                }
                else if (name == "JSField")
                {
                    JSFields.Add((FieldDeclarationSyntax)node.Parent.Parent);
                }
            }
    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);

        AppointmentRecurrenceForm1.Visible = container.ShouldShowRecurrence;

        if (apt.HasReminder)
        {
            cbReminder.Value    = apt.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;
        JSProperties.Add("cpHasExceptions", apt.HasExceptions);
        //btnDelete.Enabled = !container.IsNewAppointment;
    }
    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;
    }