Adf.Web.Binding.DateTimePersister.Persist C# (CSharp) Method

Persist() public method

Persists the date of the specified System.Web.UI.WebControls.Calendar or Adf.Web.UI.DateTextBox to the specified property of the specified object.
public Persist ( object bindableObject, PropertyInfo pi, object control ) : void
bindableObject object The object where to persist.
pi System.Reflection.PropertyInfo The property of the object where to persist.
control object The or /// , the date of which is to persist.
return void
        public virtual void Persist(object bindableObject, PropertyInfo pi, object control)
        {
            // Persist Calender fields
            Calendar calendar = control as Calendar;
            if (calendar != null)
            {
                if (calendar.Enabled && calendar.Visible)
                {
                    PropertyHelper.SetValue(bindableObject, pi, calendar.SelectedDate, CultureInfo.CurrentUICulture);
                }
                return;
            }

            // Persist DatTime fields
            DateTextBox datetext = control as DateTextBox;
            if (datetext != null)
            {
                if (datetext.Enabled && datetext.Visible)
                {
                    PropertyHelper.SetValue(bindableObject, pi, datetext.Date, CultureInfo.CurrentUICulture);
                }
                return;
            }

            var smartdatetext = control as SmartDateTextBox;
            if (smartdatetext != null)
            {
                if (smartdatetext.Enabled && smartdatetext.Visible && !smartdatetext.ReadOnly)
                {
                    if (smartdatetext.IsValid)
                    {
                        PropertyHelper.SetValue(bindableObject, pi, smartdatetext.Date, CultureInfo.CurrentUICulture);
                    }
                    else
                    {
                        ValidationManager.AddError(pi, "Adf.Business.NotInstantiable", smartdatetext.Text, pi.Name);
                    }
                }
            }
        }
DateTimePersister