Beispiel #1
0
 private void PushProductHash()
 {
     while (true)
     {
         try
         {
             if (this.lstCompany == null || lstCompany.Count == 0)
             {
                 var       redisDatabase  = this.connectionMutilexer.GetDatabase(3);
                 var       productAdapter = new ProductAdapter(new SqlDb(QT.Entities.Server.ConnectionString));
                 DataTable tbl            = productAdapter.GetListHashCompanyID();
                 foreach (DataRow row in tbl.Rows)
                 {
                     this.Invoke(new Action(() =>
                     {
                         lblPageHash.Text = row["Domain"].ToString();;
                     }));
                     PushHashNameOfProduct(Convert.ToInt64(row["ID"]), Convert.ToString(row["Domain"]), productAdapter, redisDatabase);
                 }
             }
             else
             {
                 var redisDatabase  = this.connectionMutilexer.GetDatabase(3);
                 var productAdapter = new ProductAdapter(new SqlDb(QT.Entities.Server.ConnectionString));
                 foreach (var item in lstCompany)
                 {
                     PushHashNameOfProduct(item, "", productAdapter, redisDatabase);
                 }
                 this.Invoke(new Action(() =>
                 {
                     label1.Text = "Success";
                 }));
                 break;
             }
         }
         catch (ThreadAbortException ex)
         {
             return;
         }
         catch (Exception ex1)
         {
             Thread.Sleep(1000);
         }
     }
 }