Need to fetch the default Production Calendar from Company table

Hello. I know I’m probably going to feel silly when I learn the answer to this one, but sometimes I just have to “set my pride to the side”. :smirk:

I have a good working Data Directive for OrderHed that will assist with calculating the Request Date and a few other things. One of the requirements is to pull the Non-work Days from ProdCalDay, and I currently have it hard-coded to “MASI”. I would like to enhance this to read the value in Company.CalendarID, but I am getting an error when adding the following code to set my variable:

var companyRow = (from ccRow in Db.Company
  where ccRow.Company == Session.CompanyID 
  select ccRow).FirstOrDefault();
string dfltCal = companyRow.CalendarID;

The error message reads as follows:

CS1061 ‘Company’ does not contain a definition for ‘Company’ and no accessible extension method ‘Company’ accepting a first argument of type ‘Company’ could be found (are you missing a using directive or an assembly reference?)

I try adding an Assembly Reference to Erp.Contracts.BO.Company, but this didn’t seem to help.

Any ideas what I might be overlooking here?

@tonygardner It is odd, but compiled when I did a Ctrl+space it showed Company1 rather than Company when I pasted your code into a DD on OrderHed.

When the column has the same name as the table, you have to use ccRow.Company1 instead of ccRow.Company

Thank you, Greg and TobyLai. That certainly resolved the problem. Much appreciated!