private void simpleButtonUpdateProduct_Click(object sender, EventArgs e) { Wait.Show("Đang cập nhật dữ liệu " + shopNameTextEdit.Text); try { long idcompany = Common.Obj2Int64(companyIdWSSTextEdit.Text); QT.Entities.Company company = new QT.Entities.Company(idcompany); string shopname = shopNameTextEdit.Text; string accesstoken = accessTokenTextEdit.Text; List <QT.Entities.Product> ListProducts = GetProductFromBizweb(shopname, accesstoken, company); CompanyFunctions companyFunctions = new CompanyFunctions(); var cancelUpdateDataFeedTokenSource = new CancellationTokenSource(); companyFunctions.UpdateProductsToSql(company, ListProducts, cancelUpdateDataFeedTokenSource); #region Public Cửa hàng long idbizweb = Common.Obj2Int64(companyIdBizwebTextEdit.Text); company_BizwebTableAdapter.UpdateIsPublic(true, idbizweb); #endregion } catch (Exception ex) { MessageBox.Show("ERROR " + ex.Message); } Wait.Close(); }
private void UpdateProductBizweb(CompanyFunctions companyFunctions, long idWebsosanh) { DBBizTableAdapters.Company_BizwebTableAdapter bizwebTableAdapter = new DBBizTableAdapters.Company_BizwebTableAdapter(); bizwebTableAdapter.Connection.ConnectionString = connectionString; DBBiz.Company_BizwebDataTable bizwebTable = new DBBiz.Company_BizwebDataTable(); try { bizwebTableAdapter.FillBy_IDWSS(bizwebTable, idWebsosanh); if (bizwebTable.Rows.Count > 0) { QT.Entities.Company company = new QT.Entities.Company(idWebsosanh); if (company.Name.ToLower() == "not in database") { Log.ErrorFormat("BIZWEB : ID received in RabbitMQ not in Company... ID = {0} ", idWebsosanh); } else { string shopname = bizwebTable.Rows[0]["ShopName"].ToString(); string accesstoken = bizwebTable.Rows[0]["AccessToken"].ToString(); List <QT.Entities.Product> ListProducts = QT.Moduls.Bizweb.frmSettingBizwebs.GetProductFromBizweb(shopname, accesstoken, company); Log.InfoFormat("Get {0} product of Company {1}, ID = {2}", ListProducts.Count, company.Domain, company.ID); var cancelUpdateDataFeedTokenSource = new CancellationTokenSource(); companyFunctions.UpdateProductsToSql(company, ListProducts, cancelUpdateDataFeedTokenSource); } } else { Log.ErrorFormat("BIZWEB: ID received in RabbitMQ not in Company_Bizweb... ID = {0}", idWebsosanh); } } catch (Exception ex) { Log.Error("BIZWEB ERROR : ", ex); } }
private void UpdateProductButton_Click(object sender, EventArgs e) { Wait.Show("Đang cập nhật dữ liệu " + shopNameTextEdit.Text); try { long idcompany = Common.Obj2Int64(companyIdWSSSpinEdit.Text); QT.Entities.Company company = new QT.Entities.Company(idcompany); string shopname = shopNameTextEdit.Text; string accesstoken = accessTokenTextEdit.Text; List <QT.Entities.Product> ListProducts = GetProductFromHaravan(shopname, accesstoken, company); labelControlMessage.Text = string.Format("Get {0} product!", ListProducts.Count); CompanyFunctions companyFunctions = new CompanyFunctions(); var cancelUpdateDataFeedTokenSource = new CancellationTokenSource(); companyFunctions.UpdateProductsToSql(company, ListProducts, cancelUpdateDataFeedTokenSource); #region Public Cửa hàng long idharavan = Common.Obj2Int64(companyIdHaravanSpinEdit.Text); company_HaravanTableAdapter.UpdateIsPublic(true, idharavan); #endregion } catch (Exception ex) { MessageBox.Show("ERROR " + ex.Message); } Wait.Close(); }
private void UpdateProductHaravan(CompanyFunctions companyFunctions, long idWebsosanh) { //Log.Info(string.Format("Nhan message {0}", idWebsosanh)); DBHarTableAdapters.Company_HaravanTableAdapter haravanAdapter = new DBHarTableAdapters.Company_HaravanTableAdapter(); haravanAdapter.Connection.ConnectionString = connectionString; DBHar.Company_HaravanDataTable haravanTable = new DBHar.Company_HaravanDataTable(); try { haravanAdapter.FillBy_IDWSS(haravanTable, idWebsosanh); if (haravanTable.Rows.Count > 0) { QT.Entities.Company company = new QT.Entities.Company(idWebsosanh); if (company.Name.ToLower() == "not in database") { Log.ErrorFormat("HARAVAN : ID received in RabbitMQ not in Company... ID = {0} ", idWebsosanh); } else { string shopname = haravanTable.Rows[0]["ShopName"].ToString(); string accesstoken = haravanTable.Rows[0]["AccessToken"].ToString(); List <QT.Entities.Product> ListProducts = QT.Moduls.WebPartner.frmSettingHaravan.GetProductFromHaravan(shopname, accesstoken, company); Log.InfoFormat("Get {0} product of Company {1}, ID = {2}", ListProducts.Count, company.Domain, company.ID); var cancelUpdateDataFeedTokenSource = new CancellationTokenSource(); companyFunctions.UpdateProductsToSql(company, ListProducts, cancelUpdateDataFeedTokenSource); } } else { Log.ErrorFormat("HARAVAN: ID received in RabbitMQ not in Company_Haravan... ID = {0}", idWebsosanh); } } catch (Exception exx) { Log.Error("HARAVAN ERROR: ", exx); } }