/// <exclude/>
 public override void FieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e)
 {
     if (e.NewValue == null || e.NewValue is int)
     {
     }
     else if (e.NewValue is string)
     {
         DateTime val;
         if (DateTime.TryParse((string)e.NewValue, sender.Graph.Culture, System.Globalization.DateTimeStyles.None, out val))
         {
             TimeSpan span = new TimeSpan(val.Hour, val.Minute, val.Second);
             e.NewValue = (int)span.TotalSeconds;
         }
         else
         {
             e.NewValue = null;
         }
     }
     else if (e.NewValue is DateTime)
     {
         DateTime val  = (DateTime)e.NewValue;
         TimeSpan span = new TimeSpan(val.Hour, val.Minute, val.Second);
         e.NewValue = (int)span.TotalSeconds;
     }
 }
        protected virtual void AttributeFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e, PXFieldState state, string attributeName, int iField)
        {
            if (!_IsActive)
            {
                return;
            }

            string newValue = e.NewValue as string;

            if (newValue != null)
            {
                if (state.DataType == typeof(bool))
                {
                    bool value;
                    if (bool.TryParse(newValue, out value))
                    {
                        e.NewValue = value;
                    }
                }
                if (state.DataType == typeof(DateTime))
                {
                    DateTime dt;
                    if (DateTime.TryParse(newValue, CultureInfo.InvariantCulture, DateTimeStyles.None, out dt))
                    {
                        e.NewValue = dt;
                    }
                }
            }
        }
Beispiel #3
0
		public override void SubstituteKeyFieldUpdating(PXCache sender, PXFieldUpdatingEventArgs e)
		{
			if (object.Equals(EmptyComponentCD, e.NewValue))
			{
				e.NewValue = DRScheduleDetail.EmptyComponentID;
			}
			else
				base.SubstituteKeyFieldUpdating(sender, e);
		}