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);
}
}
}
}