public Product[] ProductSearch(Session session, string search)
 {
     if (session.Value == "N/A")
     {
         return(specials.Where(s => s.EANBarcode == search || s.Name.Contains(search)).ToArray());
     }
     else
     {
         var             client = new Tesco.SOAPServiceSoapClient();
         int             pageCount, prodCount;
         Tesco.Product[] products;
         client.ProductSearch(sessions[session.Value], search, false, 1, out products, out pageCount, out prodCount);
         return
             ((specials
               .Where(s => s.EANBarcode == search || s.Name.Contains(search))
               .Concat(products.Select(p =>
                                       new Product
         {
             EANBarcode = p.EANBarcode,
             ImagePath = p.ImagePath,
             Name = p.Name,
             Price = p.Price
         }))).ToArray());
     }
 }
示例#2
0
 public Product[] ProductSearch(Session session, string search)
 {
   if (session.Value == "N/A")
   {
     return specials.Where(s => s.EANBarcode == search || s.Name.Contains(search)).ToArray();
   }
   else
   {
     var client = new Tesco.SOAPServiceSoapClient();
     int pageCount, prodCount;
     Tesco.Product[] products;
     client.ProductSearch(sessions[session.Value], search, false, 1, out products, out pageCount, out prodCount);
     return
       (specials
         .Where(s => s.EANBarcode == search || s.Name.Contains(search))
         .Concat(products.Select(p =>
           new Product
           {
             EANBarcode = p.EANBarcode,
             ImagePath = p.ImagePath,
             Name = p.Name,
             Price = p.Price
           }))).ToArray();
   }
 }
示例#3
0
 public Session Login(string email, string password, string developerKey, string applicationKey)
 {
   try
   {
     var client = new Tesco.SOAPServiceSoapClient();
     Tesco.Session session;
     client.Login(email, password, developerKey, applicationKey, out session);
     var key = Guid.NewGuid().ToString();
     sessions[key] = session;
     return new Session { Value = key };
   }
   catch
   {
     return new Session { Value = "N/A" };
   }
 }
 public Session Login(string email, string password, string developerKey, string applicationKey)
 {
     try
     {
         var           client = new Tesco.SOAPServiceSoapClient();
         Tesco.Session session;
         client.Login(email, password, developerKey, applicationKey, out session);
         var key = Guid.NewGuid().ToString();
         sessions[key] = session;
         return(new Session {
             Value = key
         });
     }
     catch
     {
         return(new Session {
             Value = "N/A"
         });
     }
 }