public override Dictionary <string, string> GetAttributes() { Attributes.Sort(); Dictionary <string, string> attributes = new Dictionary <string, string>(); foreach (Attribute attribute in Attributes) { switch (attribute) { case Attribute.ID: attributes.Add(Attribute.ID.GetDBRepresentation(), ID.ToString()); break; case Attribute.Name: attributes.Add(Attribute.Name.GetDBRepresentation(), Name == null ? NullVal : Quote + Name + Quote); break; case Attribute.City: attributes.Add(Attribute.City.GetDBRepresentation(), City == null ? NullVal : Quote + City + Quote); break; case Attribute.FoundationDate: attributes.Add(Attribute.FoundationDate.GetDBRepresentation(), FoundationDate == null ? NullVal : FoundationDate.ToString()); break; case Attribute.StarAmount: attributes.Add(Attribute.StarAmount.GetDBRepresentation(), StarAmount.ToString()); break; case Attribute.CoupeAmount: attributes.Add(Attribute.CoupeAmount.GetDBRepresentation(), CoupeAmount.ToString()); break; case Attribute.Info: attributes.Add(Attribute.Info.GetDBRepresentation(), Info == null ? NullVal : Quote + Info + Quote); break; default: break; } } return(attributes); }
public void Validate() { Name = String.IsNullOrEmpty(Name) ? throw new Exception("Name is required!") : Name; FoundationDate = FoundationDate.Equals(DateTime.MinValue) ? throw new Exception("Foundation Date is required!") : FoundationDate; NeighborhoodId = NeighborhoodId == Guid.Empty ? throw new Exception("Neighborhood id is required!") : NeighborhoodId; }