예제 #1
0
        /// <summary>
        /// Handles the <see cref="CustomValidator.ServerValidate"/> event of the <c>UniqueNameValidator</c> control.
        /// </summary>
        /// <param name="source">The source of the event.</param>
        /// <param name="args">The <see cref="ServerValidateEventArgs"/> instance containing the event data.</param>
        protected void UniqueNameValidator_ServerValidate(object source, ServerValidateEventArgs args)
        {
            var gridItem          = Engage.Utility.FindParentControl <GridDataItem>((CustomValidator)source);
            var appointmentTypeId = gridItem.ItemIndex >= 0 ? (int)gridItem.OwnerTableView.DataKeyValues[gridItem.ItemIndex]["Id"] : -1;

            args.IsValid = !AppointmentTypeCollection.Load(this.ModuleId).Any(appointmentType => appointmentType.Id != appointmentTypeId && appointmentType.Name.Equals(args.Value, StringComparison.CurrentCultureIgnoreCase));
        }
예제 #2
0
 /// <summary>
 /// Handles the NeedDataSource event of the AppointmentTypesGrid control.
 /// </summary>
 /// <param name="source">The source of the event.</param>
 /// <param name="e">The <see cref="Telerik.Web.UI.GridNeedDataSourceEventArgs"/> instance containing the event data.</param>
 private void AppointmentTypesGridNeedDataSource(object source, GridNeedDataSourceEventArgs e)
 {
     this.AppointmentTypesGrid.DataSource = AppointmentTypeCollection.Load(this.ModuleId).Select(
         appointmentType => new
     {
         appointmentType.Id,
         Name = Utility.GetLocalizedAppointmentTypeName(appointmentType.Name)
     });
 }
예제 #3
0
        /// <summary>
        /// Sets up the controls on the form.
        /// </summary>
        private void SetupControl()
        {
            this.RequestorEmailFormatValidator.ValidationExpression = Engage.Utility.EmailRegEx;

            this.StartDateTimePicker.Skin = this.EndDateTimePicker.Skin = ModuleSettings.CalendarSkin.GetValueAsStringFor(this);
            Utility.LocalizeDateTimePicker(this.StartDateTimePicker);
            Utility.LocalizeDateTimePicker(this.EndDateTimePicker);

            this.RegionDropDownList.DataTextField  = "Text";
            this.RegionDropDownList.DataValueField = "EntryId";
            this.RegionDropDownList.DataSource     = new ListController().GetListEntryInfoCollection("Region");
            this.RegionDropDownList.DataBind();
            this.RegionDropDownList.Items.Insert(0, new ListItem(Localization.GetString("StateDefaultText.Text", this.LocalResourceFile), string.Empty));

            this.AppointmentTypeDropDownList.DataSource = from appointmentType in AppointmentTypeCollection.Load(this.ModuleId)
                                                          select new
            {
                appointmentType.Id,
                Name = Utility.GetLocalizedAppointmentTypeName(appointmentType.Name)
            };

            this.AppointmentTypeDropDownList.DataTextField  = "Name";
            this.AppointmentTypeDropDownList.DataValueField = "Id";
            this.AppointmentTypeDropDownList.DataBind();

            this.RequestorPhoneTypeDropDownList.DataSource = Enum.GetNames(typeof(PhoneType));
            this.RequestorPhoneTypeDropDownList.DataBind();
            this.RequestorPhoneTypeDropDownList.Items.Remove(PhoneType.None.ToString());
            Dnn.Utility.LocalizeListControl(this.RequestorPhoneTypeDropDownList, this.LocalSharedResourceFile);

            this.RequestorAltPhoneTypeDropDownList.DataSource = Enum.GetNames(typeof(PhoneType));
            this.RequestorAltPhoneTypeDropDownList.DataBind();
            this.RequestorAltPhoneTypeDropDownList.SelectedValue = PhoneType.None.ToString();
            Dnn.Utility.LocalizeListControl(this.RequestorAltPhoneTypeDropDownList, this.LocalSharedResourceFile);

            this.GenderDropDownList.DataSource = Enum.GetNames(typeof(GroupGender));
            this.GenderDropDownList.DataBind();
            Dnn.Utility.LocalizeListControl(this.GenderDropDownList, this.LocalSharedResourceFile);

            this.PresenterDropDownList.Items.Clear();
            this.PresenterDropDownList.Items.Add(new ListItem(Localization.GetString(true.ToString(CultureInfo.InvariantCulture), this.LocalResourceFile), true.ToString(CultureInfo.InvariantCulture)));
            this.PresenterDropDownList.Items.Add(new ListItem(Localization.GetString(false.ToString(CultureInfo.InvariantCulture), this.LocalResourceFile), false.ToString(CultureInfo.InvariantCulture)));

            // TODO: Once we support .NET 3.5, replace this with TimeZoneInfo.GetSystemTimeZones
            Localization.LoadTimeZoneDropDownList(
                this.TimeZoneDropDownList,
                CultureInfo.CurrentCulture.Name,
                ((int)Dnn.Utility.GetUserTimeZoneOffset(this.UserInfo, this.PortalSettings).TotalMinutes).ToString(CultureInfo.InvariantCulture));

            this.RoomTextBox.Text       = Localization.GetString("RoomDefaultText.Text", this.LocalResourceFile);
            this.PostalCodeTextBox.Text = Localization.GetString("PostalCodeDefaultText.Text", this.LocalResourceFile);
        }