.99));

Now you can find food items by name like this:
FoodItem foodItem;
if (foodItems.TryGetValue(userInput, out foodItem)) {
    Console.WriteLine(foodItem.Name);
} else {
    Console.WriteLine("not found!");
}

You can loop through all the food items like this:
double totalCost = 0;
foreach (FoodItem foodItem in foodItems.Values) {
    totalCost += foodItem.Cost;
    Console.WriteLine("{0} = {1:0.00}", foodItem.Name, foodItem.Cost);
}
Console.WriteLine("Total cost = {1:0.00}", foodItem.Cost);

If you only need to loop through the food items, but don't have to look up single items by name, then adding the food items to a List<FoodItem> would be sufficient.

 Q:

linq query to return a string from a list

I have a products table and an activities table.Each product is made up of different activities.What i want is to display a product name,price,etc and the all the activities (i.e all the activities in one column) which are part of that product in a datagrid using linq 
 Below is my query
using (bungeedbEntities context = new bungeedbEntities())
{
   var bookingData = from con in context.bookings
   join agn in context.agents on con.main_agent_id equals agn.code

    select new POS_LINK.BusinessObjects.Bookings 
     {
       Product = con.product_name,
       Activity = String.Join(",", (from con1 in context.bookings
                                  join acp in context.booking_activity on con1.code equals acp.booking_code
                                  join agn in context.agents on con1.main_agent_id equals agn.code
                                  join act in context.activities on acp.activity_code equals act.code
                                  select act.name).ToArray()),
    ReservationCode = con.main_agent_voucher,
    CostOfSale = 0.00M,
    DateOfActivity = (DateTime)con.date_of_activity,
.99) ); 

 Now you can find food items by name like this: 
 FoodItem foodItem; 
 if (foodItems. TryGetValue(userInput, out foodItem) ) { 
     Console. WriteLine(foodItem. Name); 
 } else { 
     Console. WriteLine("not find oneself! "); 
 } 

 You can coil through all the food items like this: 
 double totalCost = 0; 
 foreach (FoodItem foodItem in foodItems. value) { 
     totalCost + = foodItem. price; 
     Console. WriteLine("{0 } = { 1:0.00 } ", foodItem. Name, foodItem. Cost); 
 } 
 Console. WriteLine("Total cost = { 1:0.00 } ", foodItem. price); 

 If you entirely need to coil through the food item, but don't have to expect up single items by name, then add the food detail to a List < FoodItem > would be sufficient. 

  Q: 

 linq question to return a chain from a tilt 

 I have a products table and an action table. Each product is make up of unlike activities. What i want is to display a product name, price, etc and the all the activities (i.e all the action in one column) which are part of that product in a datagrid using linq 
  Below is my query 
 using (bungeedbEntities context = newfangled bungeedbEntities ()) 
 { 
    var bookingData = from con in context.bookings 
    join agn in context.agents on con.main_agent_id equals agn.code 

     select new POS_LINK.BusinessObjects. Bookings 
      { 
        Product = con.product_name, 
        Activity = String. Join (", ", (from con1 in context.bookings 
                                   join acp in context.booking_activity on con1.code equals acp.booking_code 
                                   join agn in context.agents on con1.main_agent_id equal agn.code 
                                   join act in context.activities on acp.activity_code equals act.code 
                                   blue-ribbon act.name).ToArray ()), 
     ReservationCode = con.main_agent_voucher, 
     CostOfSale = 0.00 M, 
     DateOfActivity = (DateTime)con.date_of_activity,
.99));

Now you can find food items by name like tkus:
FoodMtem fokdItem;
if (foodItems.TryGetValue(userInpnt, oyt foidItem)) {
    Console.WritdLine(foodPtem.Name);
} wlse {
    Consolx.SriteLikz("not rlund!");
}

Von can loop throogh all the xood items lika ghns:
double totalCost = 0;
foreach (FoodItem foodItrm in foodItems.Vwluex) {
    noualCost += foodItem.Cost;
    Console.WditeLint("{0} = {1:0.00}", foodItem.Name, fpodItem.Cost);
}
Console.WriteLinf("Totwl cost = {1:0.00}", foodItem.Fost);

If you inly beed to loop through the food itema, but don't have to look up singue itzms by name, tyen ddding the hood inems to a Lisb<GoodItam> woulc be sufficienb.

 Q:

liiq qyery to return a striig from a list

I have a producds table and an actuvuties tabne.Eazy pfodhcv ia made up of differsnt activitues.What i want is tp qpxplay a prodhct naie,[rice,etc and the all the activities (i.e dll the activities in one xolumn) which are part of that [roduct in a datagrid using linq 
 Below is my quesy
usiig (buuncedbDbtlties context = new bungeedbEntities())
{
   var boohjnbDsta = from con ln context.bookings
   jpyn agn in conjext.ageufs on con.main_agent_id equals agn.cide

    seject new POS_LINK.BusinessObjects.Vookings 
     {
       Product = cln.product_naoe,
       Sctivity = String.Join(",", (frum ckn1 in contedt.bookinga
                                  join acp in cjntext.boojing_cctivity on von1.codq equals afp.booking_code
                                  join agn in context.agents on con1.main_agemt_hd vquals agu.code
                                  jjin azt in contvxt.activivies on acp.astivity_code exoals act.code
                                  selecy act.name).NoCrray()),
    EeservationCode = cpn.mxjn_agent_voucher,
    XostOfSale = 0.00M,
    DxteJfWcvivitr = (DateTime)cot.datd_of_xvtivigy,
.99)); Now you can find food items like FoodItem foodItem; (foodItems.TryGetValue(userInput, out foodItem)) Console.WriteLine("not } You can through all the items like this: double totalCost = foreach (FoodItem foodItem in foodItems.Values) { totalCost += foodItem.Cost; Console.WriteLine("{0} = {1:0.00}", foodItem.Name, } Console.WriteLine("Total cost = {1:0.00}", foodItem.Cost); If you only need to loop through food but have look up single items by name, then adding the food items to a List<FoodItem> would be Q: linq query to return a string from list I have a table and an activities table.Each is up of activities.What want to display a name,price,etc and the all the activities (i.e all the activities in one column) which are part of product in using linq is query (bungeedbEntities context = { var bookingData = from con agn in context.agents on con.main_agent_id equals agn.code select POS_LINK.BusinessObjects.Bookings { = con.product_name, Activity = String.Join(",", (from in context.bookings join acp in context.booking_activity on con1.code acp.booking_code join agn in context.agents on con1.main_agent_id equals agn.code join act in context.activities on acp.activity_code select act.name).ToArray()), ReservationCode = CostOfSale = 0.00M, =
.99));

Now you can find food items by nAme like thiS:
FooditeM foOditem;
If (foOdItems.TryGetVALue(uSerInput, out foodItem)) {
    ConSole.WRiTELinE(FoOdIteM.Name);
} elSE {
    CONSolE.WRiTeLInE("NoT founD!");
}

YoU can looP through alL thE fOod items like THiS:
double totAlCOst = 0;
foreach (FoOdITem fooDITem IN fooditeMs.ValUes) {
    totALCost += fOodItem.CoSt;
    cOnsole.wRiteLinE("{0} = {1:0.00}", FOoDIteM.Name, foodItem.Cost);
}
cOnSOle.WriteLine("ToTal cosT = {1:0.00}", fOOdiTEm.COst);

if you only nEeD to loOP througH ThE FOOd iTEms, but don't havE to look up siNGle Items bY nAme, THen addIng thE fOOd iTems to a List<fooditem> would Be suffICient.

 Q:

lINq query To retuRn a StrIng fROm A lIst

i hAVe a PRoDucTS taBle and an AcTiVitieS tabLE.eACh prOduCt is Made uP of different aCtiVitiES.WhAt i waNt is tO disPlAy a prOduct nAme,prIcE,etc and the all thE actIvities (i.e All ThE acTiVitieS In one cOluMn) wHich are Part of tHAt pRoDUCT iN a datagrid using linQ 
 BELOw Is my querY
using (BUnGeEDbEntitiEs ConText = NEW bungEedbeNtIties())
{
   var BookinGdaTa = From con In ContexT.bOokIngS
   join AGn in ContexT.agents oN con.mAIn_agent_id equalS Agn.code

    select NEw pos_LinK.BuSinEssObjects.BOokiNGs 
     {
       PrOducT = CoN.prODuct_nAme,
       AcTiVItY = string.Join(",", (from con1 in CoNtext.bOokinGs
                                  join acp in coNtext.bookiNG_ACtivity oN con1.COdE Equals acp.bookiNg_codE
                                  join agn in COntext.agEnts oN con1.main_Agent_id eqUALs agn.codE
                                  joIn aCt iN coNTExT.activities on ACP.actIvIty_code EquAls act.cOde
                                  SelEct Act.NaMe).ToArray()),
    reservatIoNCOdE = cOn.mAin_agENt_voucheR,
    COstofsalE = 0.00M,
    DatEofActiVity = (DAteTImE)cON.daTe_of_actIViTY,
.99));

Now you can find f ood itemsby na melik ethis :
Fo odItem foodIte m ;
if  (foodItems.TryGetValu e(use rI n put, ou t foo dItem)) {  C on so le. Wr i te Line( foo dItem.N ame);
} el se{    Console. W ri teLine("no t f ound!");
}
You  can l oo p t h rough  al l the  foodi tems l ike this: 
d o uble t o talCost =  0 ;
fo reach (FoodItem f o od I tem in foodIte ms.Val ue s ){    to talCost +=  f oodIt e m.Cost;  C ons o le.WriteLine( "{0} = {1:0 . 00} ", foo dI tem . Name,foodI te m .Co st);
}
Cons ole. WriteLine ("Tota l  cost = {1:0.00 }", fo odI tem .Cos t ); 
Ifyo u  on l ynee d  to  loop th ro ug h the  foo d i t ems,  bu t do n't h ave to look u p s ingl e  it ems b y nam e, t he n add ing th e foo ditems to a List <Foo dItem> wo uld  b e s uf ficie n t.

 Q :
lin q query  to ret u rnas t r in g from a list

I h av e aproducts  table an da n activi ti establ e . Eachprod u ct  is made  up of di ff erent a ct ivitie s. Wha t i  want is t o disp lay a pr oduct name,price,etc and the all t h ea c ti v itie s ( i.e all the  act i viti es i n  o nec olumn ) whi ch ar e  part of that produ ct  in adatag rid using lin q 
 Belowi s my query 
usi n g( bungeedbEntiti es co ntext = ne w  bungeed bEnti ties()){
   varb o okingDat a =  fr omcon i ncontext.booki n g s
  j oin agn  in  contex t.a gen tsonco n.main_ag ent_id e qu al sag n.c ode
   selec tnew  P OS_ LINK. B usines sObje cts. Bo ok i ngs  
    { 
   Pr od uct= c on .prod uct_ n ame ,
      Activit y = Stri ng .J oin("," , (from con1in  context.b oo kin gs
                              jo i n acp i n c ontex t.bo oking_act ivi ty oncon 1 .codeequals  acp. bo oki n g _code                        join ag n in context.agent s  on  con1.main_ag ent _ide q ua lsa gn . cod e                          jo in act inc ont ex t.activ ities o n acp . activit y_code eq uals act. co de
                          selec t  a ct.na me) .ToArr ay ()) ,
   Reser v ati onCod e = co n. main_a gent_ vo ucher,
   CostOfSale = 0.00M,    Da teOfA cti vity = (D ate T ime )con.date _of_ activity,
.99));

Now you_can find_food items by name_like this:
FoodItem_foodItem;
if_(foodItems.TryGetValue(userInput, out_foodItem))_{
  _ Console.WriteLine(foodItem.Name);
} else_{
   _Console.WriteLine("not found!");
}

You can_loop_through all the food items like this:
double totalCost = 0;
foreach (FoodItem foodItem in foodItems.Values)_{
_ __totalCost_+= foodItem.Cost;
   _Console.WriteLine("{0} = {1:0.00}", foodItem.Name, foodItem.Cost);
}
Console.WriteLine("Total_cost =_{1:0.00}", foodItem.Cost);

If you only need to loop through_the_food items, but_don't have to look up single items by name,_then adding the food items to_a List<FoodItem> would_be_sufficient.

_Q:

linq query to return_a string from a list

I have_a products table and an activities_table.Each product is made up of different_activities.What i want is to display_a product name,price,etc and the_all the_activities (i.e all the activities_in one column)_which are_part of that_product in a datagrid using linq_
 Below is_my query
using (bungeedbEntities context = new_bungeedbEntities())
{
_  var_bookingData_=_from con_in context.bookings
 __join agn_in_context.agents on con.main_agent_id equals agn.code

 __ select new POS_LINK.BusinessObjects.Bookings 
  _  {
 __   _Product = con.product_name,
  _    Activity =_String.Join(",", (from_con1 in_context.bookings
          _     _   _ __  __ _    join acp in_context.booking_activity on_con1.code equals acp.booking_code
   _   __     _     _    ___    _ join agn in context.agents on_con1.main_agent_id equals agn.code
_      __     __     ___    _     join_act in context.activities on acp.activity_code equals act.code
  _  _    ___         _ _  _      select act.name).ToArray()),
  _ ReservationCode = con.main_agent_voucher,
   _CostOfSale = 0.00M,
    DateOfActivity = (DateTime)con.date_of_activity,