Advertisement
Guest User

Untitled

a guest
Oct 28th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. public partial class Data_Header
  5. {
  6. public Data_Header()
  7. {
  8. this.Data_Lines = new HashSet<Data_Lines>();
  9. }
  10.  
  11. public int DataHeaderID { get; set; }
  12. public System.Guid CmpWwn { get; set; }
  13. public System.Guid CntId { get; set; }
  14. public System.DateTime DeliveryDate { get; set; }
  15. public Nullable<int> DeliveryMethod_SysDeliveryMethodsID { get; set; }
  16. public System.DateTime DueDate { get; set; }
  17.  
  18. public virtual Sys_DeliveryMethods Sys_DeliveryMethods { get; set; }
  19. public virtual vw_cicmpy vw_cicmpy { get; set; }
  20. public virtual ICollection<Data_Lines> Data_Lines { get; set; }
  21. }
  22.  
  23. public class RequiredGuidAttribute : RequiredAttribute
  24. {
  25. public override bool IsValid(object value)
  26. {
  27. var guid = CastToGuidOrDefault(value);
  28.  
  29. return !Equals(guid, default(Guid));
  30. }
  31.  
  32. private static Guid CastToGuidOrDefault(object value)
  33. {
  34. try
  35. {
  36. return (Guid)value;
  37. }
  38. catch (Exception e)
  39. {
  40. if (e is InvalidCastException || e is NullReferenceException) return default(Guid);
  41. throw;
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement