Linked But Not Linked Table Structure

BitLost

Active member
Joined
Dec 10, 2016
Messages
35
Programming Experience
Beginner
I am really lost on how to even look up help on this.

I have a few tables Client, Site and Waterbody. These are fine and all great. But I have added a new table Quote Request.

The issue is a quote request may include a client and if it does it may contain a site and if it does it may contain a water body...but then again may not contain any of these.

I am wondering how to structure this. If I do:

C#:
[COLOR=blue]public[/COLOR] [COLOR=blue]int[/COLOR] QuoteRequestID { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Request Date"[/COLOR])]
        [COLOR=blue]public[/COLOR] [COLOR=#2b91af]DateTime[/COLOR] RDate { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Client"[/COLOR])]
        [COLOR=blue]public[/COLOR] [COLOR=blue]int[/COLOR]? ClientID { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Site"[/COLOR])]
        [COLOR=blue]public[/COLOR] [COLOR=blue]int[/COLOR]? SiteID { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Waterbody"[/COLOR])]
        [COLOR=blue]public[/COLOR] [COLOR=blue]int[/COLOR]? WaterBodyID { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Requested by"[/COLOR])]
        [COLOR=blue]public[/COLOR] [COLOR=blue]string[/COLOR] Requested { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Contact Detail"[/COLOR])]
        [COLOR=blue]public[/COLOR] [COLOR=blue]string[/COLOR] ConDetail { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [[COLOR=#2b91af]Required[/COLOR]]
        [[COLOR=#2b91af]StringLength[/COLOR](500, MinimumLength = 15)]
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Quote Request Description"[/COLOR])]
        [COLOR=blue]public[/COLOR] [COLOR=blue]string[/COLOR] QDescription { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
       [COLOR=green]// [Display(Name ="Any Documentation, Drawings, Specification")][/COLOR]
      [COLOR=green]//  public IFormFile Documents { get; set; }[/COLOR]
 
      [COLOR=green]//  [Display(Name ="Photos for Quote")][/COLOR]
      [COLOR=green]//  public IFormFile Pictures { get; set; }[/COLOR]
 
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Is there a Budget?"[/COLOR])]
 
        [COLOR=blue]public[/COLOR] [COLOR=blue]double[/COLOR]? Budget { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [[COLOR=#2b91af]Display[/COLOR](Name =[COLOR=#a31515]"Closing Date"[/COLOR])]
        [COLOR=blue]public[/COLOR] [COLOR=#2b91af]DateTime[/COLOR] CloseDate { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [COLOR=green]//public int? QuoteID { get; set; }[/COLOR]
 
        [COLOR=blue]public[/COLOR] [COLOR=#2b91af]Client[/COLOR] Client { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [COLOR=blue]public[/COLOR] [COLOR=#2b91af]Site[/COLOR] Site { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [COLOR=blue]public[/COLOR] [COLOR=#2b91af]WaterBody[/COLOR] WaterBody { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }
 
        [COLOR=blue]public[/COLOR] [COLOR=#2b91af]Quote[/COLOR] Quote { [COLOR=blue]get[/COLOR]; [COLOR=blue]set[/COLOR]; }

Then client, site and waterbody are required on creating a new record. But I want them optional.

I am also concerned that if I unbind the table and leave these as simply numbers I may not be able to attach the record to the Client View or the Site View and so on.

Am I overthinking? Should I simply unbind then query on the ClientID when in Client View for example?
 
Back
Top Bottom