void find_eid()
        {
            // determine the path for the database file
            string dbPath = Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                "adodemo.db3");
            bool exists = File.Exists(dbPath);

            if (!exists)
            {
                Console.WriteLine("Creating database");
                // Need to create the database before seeding it with some data
                Mono.Data.Sqlite.SqliteConnection.CreateFile(dbPath);
            }

            SqliteConnection connection = new SqliteConnection("Data Source=" + dbPath);

            // Open the database connection and create table with data
            connection.Open();



            // query the database to prove data was inserted!
            var contents = connection.CreateCommand();

            if (Globals.useBarcodes == "1")
            {
                //contents.CommandText = "SELECT  E.ONO,E.XONDR,E.YPOL,E.BARCODE,E.KOD from EID E inner JOIN BARCODES B ON E.KOD=B.KOD   WHERE B.BARCODE like '%" + BARCODE.Text + "%' LIMIT 1 ; "; // +BARCODE.Text +"'";
                contents.CommandText = "SELECT  ONO,XONDR,YPOL,BARCODE,KOD from EID WHERE KOD IN (SELECT KOD FROM BARCODES WHERE BARCODE like '%" + BARCODE.Text + "%' LIMIT 1)  ; "; // +BARCODE.Text +"'";
            }
            else
            {
                contents.CommandText = "SELECT  ONO,XONDR,YPOL,BARCODE,KOD from EID WHERE KOD like '%" + BARCODE.Text + "%' LIMIT 1 ; "; // +BARCODE.Text +"'";
            }

            var r = contents.ExecuteReader();

            Console.WriteLine("Reading data");
            while (r.Read())
            {
                lper.Text  = r["ONO"].ToString(); // ****
                ltimh.Text = r["XONDR"].ToString();
                string ccc = r["XONDR"].ToString();

                lkode.Text    = r["KOD"].ToString();
                lbarcode.Text = r["BARCODE"].ToString(); // ***

                cc = cc + lbarcode.Text + ";";           // +lper.Text+";"+ltimh.Text+";"+
            }
            // r["ONO"].ToString();



            connection.Close();

            // System.Threading.Thread.Sleep(1000);


            BARCODE.Focus();
        }
示例#2
0
 public async void BarcodeUnique()
 {
     //if (App.Current.Properties["ManualBarcode"] != "" || App.Current.Properties["ManualBarcode"] != null)
     //{
     //    BARCODE = App.Current.Properties["ManualBarcode"].ToString();
     //}
     //else
     //{
     try
     {
         string     bra    = BARCODE.ToString();
         HttpClient client = new HttpClient();
         client.BaseAddress = new Uri(GlobalData.gblApiAdress);
         client.DefaultRequestHeaders.Accept.Add(
             new MediaTypeWithQualityHeaderValue("application/json"));
         client.Timeout = new TimeSpan(500000000000);
         HttpResponseMessage response = client.GetAsync("api/ItemAPI/BarCodeunique?barcode=" + bra + "").Result;
         if (response.IsSuccessStatusCode)
         {
             data = JsonConvert.DeserializeObject <ItemModel[]>(await response.Content.ReadAsStringAsync());
         }
         if (data.Length == 0)
         {
         }
         else
         {
             return;
         }
     }
     catch (Exception ex)
     {
         throw;
     }
     //}
 }