示例#1
0
 // using: handle IDisposible correctly
 public string GetContractNo(DateTime contractDate)
 {
     string result = "";
     using (var FastII = new FastIIEntities())
     {
         var query = from b in FastII.ArHeaders
                     where b.ContractDt == contractDate
                     select b;
         foreach (var contract in query)
         {
             result += contract.ContractNo + "\r\n";
         }
     }
     return result;
 }
示例#2
0
 // join
 // ?
 public string GetContractNoAndBalance(DateTime contractDate)
 {
     string result = "";
     using (var FastII = new FastIIEntities())
     {
         var query = from header in FastII.ArHeaders
                         join mastfl in FastII.ArMastfls on header.ContractNo equals mastfl.ContractNo
                     where header.ContractDt == contractDate
                     select new { header.ContractNo, mastfl.CurBal } ;
         foreach (var contract in query)
         {
             result += contract.ContractNo + ":" + contract.CurBal?.ToString("c") + "\r\n";
         }
     }
     return result;
 }