Пример #1
0
 private void LoadProductDatabaseButton_Click(object sender, EventArgs e)
 {
     Wait.Show("Load all product in database!");
     try
     {
         DBWebPartnerTableAdapters.ProductTableAdapter productAdapter = new DBWebPartnerTableAdapters.ProductTableAdapter();
         productAdapter.Connection.ConnectionString = Server.ConnectionString;
         long idwss = Common.Obj2Int64(companyIdWSSSpinEdit.Text);
         productAdapter.FillBy_CompanyId(dBWebPartner.Product, idwss);
     }
     catch (Exception)
     {
         //MessageBox.Show("Lỗi!");
     }
     Wait.Close();
 }
Пример #2
0
 private void toolTaiLai_Click(object sender, EventArgs e)
 {
     Wait.Show("Đang tải dữ liệu!");
     try
     {
         this.productTableAdapter.FillBy_AllProductID(this.dBPMan.Product);
         this.gridView1.ExpandAllGroups();
         this.xtraTabControl1.SelectedTabPageIndex = 1;
         LogJobAdapter.SaveLog(JobName.FrmManagerProduct_Load_All, "Click nút Load All nên ko có ID...", 0, (int)JobTypeData.KhongXacDinh);
     }
     catch (Exception)
     {
         throw;
     }
     Wait.Close();
 }
Пример #3
0
        private void simpleButtonViewLog_Click(object sender, EventArgs e)
        {
            Wait.Show("Đang tải dữ liệu...");
            long iddata = Common.Obj2Int64(textEditIDData.Text);

            if (iddata != 0)
            {
                LoadData(iddata);
            }
            else
            {
                MessageBox.Show("ID = 0.......");
                textEditIDData.Focus();
            }
            Wait.Close();
        }
Пример #4
0
 private void LoadAllSPGocButton_Click(object sender, EventArgs e)
 {
     Wait.Show("Đang tải dữ liệu!");
     try
     {
         //this.productTableAdapter.FillBy_CategoryID(this.dBPMan.Product, Common.Obj2Int(this.iDCategoryTextBox.Text.Trim()));
         this.dBPMan.Product.Rows.Clear();
         this.productTableAdapter.FillBy_SPGoc_TrungTen(this.dBPMan.Product);
         this.gridView1.ExpandAllGroups();
         this.xtraTabControl1.SelectedTabPageIndex = 1;
     }
     catch (Exception)
     {
     }
     Wait.Close();
 }
Пример #5
0
 private void simpleButtonLoadProductInSql_Click(object sender, EventArgs e)
 {
     Wait.Show("Load all product in database!");
     try
     {
         DBBizwebTableAdapters.ProductTableAdapter productAdapter = new DBBizwebTableAdapters.ProductTableAdapter();
         productAdapter.Connection.ConnectionString = Server.ConnectionString;
         long idwss = Common.Obj2Int64(companyIdWSSTextEdit.Text);
         productAdapter.FillBy_CompanyId(dBBizweb.Product, idwss);
     }
     catch (Exception)
     {
         MessageBox.Show("ERROR! Load Product from Database fails!");
     }
     Wait.Close();
 }
Пример #6
0
 private void btnUnActiveAll_Click(object sender, EventArgs e)
 {
     Wait.Show("...");
     try
     {
         foreach (var item in dBIndi.RootProducts)
         {
             item.IsActive = false;
         }
         this.rootProductsBindingSource.EndEdit();
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
     }
     Wait.Close();
 }
Пример #7
0
        private void btnGetProductImage_Click(object sender, EventArgs e)
        {
            Wait.Show("Get product from SQL...");
            string    querry       = @"SELECT ID,Name, DetailUrl,ImageUrls,ImageId,LastUpdate,Valid,Status FROM Product WHERE (Company = 6619858476258121218) AND (Valid = 1) AND (ImageId IS NULL OR ImageId = '') OR (Company = 6619858476258121218) AND (Valid = 0) AND (Status = 11)";
            SqlDb     sqldb        = new SqlDb(Server.ConnectionString);
            DataTable productTable = new DataTable();

            try
            {
                productTable = sqldb.GetTblData(querry, CommandType.Text, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ERROR " + ex.Message);
            }
            grdProductImage.DataSource = productTable;
            Wait.Close();
        }
Пример #8
0
        private void TestProductButton_Click(object sender, EventArgs e)
        {
            Wait.Show("Đang tải sản phẩm từ Haravan");
            long idcompany = Common.Obj2Int64(companyIdWSSSpinEdit.Text);

            QT.Entities.Company company = new QT.Entities.Company(idcompany);
            if (company.Name.ToLower() == "not in database")
            {
                MessageBox.Show("Không tồn tại công ty này trong database! Ấn Check Company để kiểm tra");
            }
            else
            {
                string shopname    = shopNameTextEdit.Text;
                string accesstoken = accessTokenTextEdit.Text;
                gridControlProduct.DataSource = GetProductFromHaravan(shopname, accesstoken, company);
            }
            Wait.Close();
        }
Пример #9
0
        private void simpleButtonTestProduct_Click(object sender, EventArgs e)
        {
            Wait.Show("Đang tải dữ liệu...");
            long idcompany = Common.Obj2Int64(companyIdWSSTextEdit.Text);

            QT.Entities.Company company = new QT.Entities.Company(idcompany);
            if (company.Name.ToLower() == "not in database")
            {
                MessageBox.Show("ERROR! Không tồn tại công ty này trong database!");
            }
            else
            {
                string shopname    = shopNameTextEdit.Text;
                string accesstoken = accessTokenTextEdit.Text;
                gridControlProduct.DataSource = GetProductFromBizweb(shopname, accesstoken, company);
            }
            Wait.Close();
        }
Пример #10
0
        private void btnUpdatePromotionListProduct_Click(object sender, EventArgs e)
        {
            Wait.Show("Cập nhật Promotion!");
            var listProductId = GetListIdProductSelectedInGrid();

            if (listProductId.Count > 0)
            {
                for (int i = 0; i < listProductId.Count; i++)
                {
                    productTableAdapter.UpdatePromotion(rbPromotionListProduct.Text, listProductId[i]);
                    SendMessageUpdateProductSolrAndRedisService(listProductId[i]);
                    Wait.Show(string.Format("{0}/{1} Updated productId = {2}", i + 1, listProductId.Count, listProductId[i]));
                }
            }
            else
            {
                MessageBox.Show("Chưa chọn sản phẩm để cập nhật Promotion");
            }
            Wait.Close();
        }
Пример #11
0
 private void searchLookUpEditUser_EditValueChanged(object sender, EventArgs e)
 {
     Wait.Show("Đang tải dữ liệu...");
     if (searchLookUpEditUser.EditValue != null)
     {
         DateTime fromDate = ctrDateRanger1.FromDate;
         DateTime toDate   = ctrDateRanger1.ToDate;
         int      iduser   = 0;
         int.TryParse(searchLookUpEditUser.EditValue.ToString(), out iduser);
         if (iduser != 0)
         {
             iDTextEdit.Text = iduser.ToString();
             string expression;
             expression = "ID = " + iduser;
             var x = dBLogJob.tblUser.Select(expression).FirstOrDefault();
             departmentTextEdit.Text = x["Department"].ToString();
             //LoadLogUser(iduser, fromDate, toDate);
         }
     }
     Wait.Close();
 }
Пример #12
0
 private void barLoadT_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Wait.CreateWaitDialog();
     try
     {
         this.dB.Company.Rows.Clear();
         Wait.Show("Đang tải dữ liệu");
         this.companyTableAdapter1.FillBy_KyTu(this.dBCom.Company);
         foreach (Company.DBCom.CompanyRow dr in this.dBCom.Company)
         {
             dr.Check = true;
         }
         companyBindingSource.EndEdit();
         Wait.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Errorr: " + ex.ToString());
     }
     Wait.Close();
 }
Пример #13
0
        private void ViewDetailProductWithCategoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Wait.Show("Loading...");
            _listSolrProductItemsTemp.Clear();
            var  listkeywords      = txtKeyword.Text.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries).ToList();
            var  listKeywordsBlock = rbKeywordBlock.Text.Replace('\n', ',').Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            var  listIdBlock       = rbListIdBlock.Text.Replace('\n', ',').Trim().Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            long minPrice          = Common.Obj2Int64(spinEditMinPrice.Value);
            long maxPrice          = Common.Obj2Int64(spinEditMaxPrice.Value);
            int  categoryId        = Common.Obj2Int(txtCategoryId.Text);
            int  numberFound;

            _listSolrProductItemsTemp = solrProductClient.GetProductByProductIdentityRequestAndCategory(listkeywords, listKeywordsBlock,
                                                                                                        listIdBlock, categoryId, minPrice, maxPrice, 0, Common.Obj2Int(txtNumberFound.Text), out numberFound);
            foreach (var product in _listSolrProductItemsTemp)
            {
                product.WebsiteId = _websiteId;
            }
            grdProduct.DataSource = _listSolrProductItemsTemp;
            Wait.Close();
        }
Пример #14
0
        private void btnLoadErrorConfig_Click(object sender, EventArgs e)
        {
            xtraTabControl1.SelectedTabPage = xtraTabPage2;
            loadByType   = false;
            loadByStatus = false;
            //LoadData();
            Wait.Show("Đang tải dữ liệu");
            DataTable temp = new DataTable();

            Company.DBCom.Company1DataTable Com1Table = new Company.DBCom.Company1DataTable();
            SqlDataAdapter da   = new SqlDataAdapter();
            SqlConnection  conn = new SqlConnection(Server.ConnectionString);

            conn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType  = CommandType.StoredProcedure;
            cmd.CommandText  = "CMS_Company_SelectErrorConfig";
            cmd.Connection   = conn;
            da.SelectCommand = cmd;
            da.Fill(temp);

            for (int i = 0; i < temp.Rows.Count; i++)
            {
                int result = 0;
                int.TryParse(temp.Rows[i]["TheoDoi"].ToString(), out result);
                if ((!string.IsNullOrEmpty(temp.Rows[i]["TheoDoi"].ToString())) && (result != 0))
                {
                    int TheoDoi = int.Parse(temp.Rows[i]["TheoDoi"].ToString());
                    company1TableAdapter.FillBy_ErrorConfig(Com1Table, _pageIndex, _pageCount, TheoDoi);
                    dBCom.Company1.Merge(Com1Table);
                }
            }

            //Wait.Show("Đang tải dữ liệu");
            //this.company1TableAdapter.FillBy_ErrorConfig(this.dBCom.Company1, _pageIndex, _pageCount);
            //company1BindingSource.EndEdit();
            Wait.Close();
        }
Пример #15
0
        private void btDay_Click(object sender, EventArgs e)
        {
            //int idClassification = QT.Entities.Common.Obj2Int(this.iDClassificationTextBox.Text);
            int idUser = Common.Obj2Int(this.iDUserSelectTextBox.Text);

            Wait.Show("Đẩy dữ liệu");
            for (int x = gridView1.GetSelectedRows().Length - 1; x >= 0; x--)
            {
                try
                {
                    int  i         = gridView1.GetSelectedRows()[x];
                    long idProduct = Common.Obj2Int64(gridView1.GetDataRow(i)["ID"].ToString());
                    if (idProduct != 0)
                    {
                        int    idClassification = Common.Obj2Int(gridView1.GetDataRow(i)["CategoryID"].ToString());
                        string keysearch        = GetFilterCategory(idClassification);
                        this.job_SPGocNhapLieuTableAdapter.InsertQuery(
                            idProduct,
                            idUser,
                            idClassification,
                            QT.Entities.Common.JobNhapLieuStatus.Job_TaoMoi,
                            DateTime.Now, keysearch);
                        //Wait.Show(String.Format("Đẩy dữ liệu {0}/{1}", i + 1, dBPhanSP.Product.Count));
                        DataRow[] drr = dBPhanSP.Product.Select("ID=' " + idProduct + " ' ");
                        foreach (var row in drr)
                        {
                            row.Delete();
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            Wait.Close();
            //PhanTichLai();
            dBPhanSP.Product.AcceptChanges();
        }
Пример #16
0
        private void btChonCheck_Click(object sender, EventArgs e)
        {
            this.viewListValueOfCatFTBindingSource.EndEdit();
            string txt1 = "Chuyển toàn bộ id đã chọn thành id: " + this.txtValueCurrent.Text;

            if (MessageBox.Show(this, txt1, "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes)
            {
                for (int i = 0; i < dBProperties.ViewListValueOfCatFT.Rows.Count; i++)
                {
                    bool check = false;
                    check = Common.Obj2Bool(dBProperties.ViewListValueOfCatFT.Rows[i]["Check"].ToString());
                    if (check)
                    {
                        int PropertiesID      = Common.Obj2Int(dBProperties.ViewListValueOfCatFT.Rows[i]["PropertiesID"].ToString());
                        int PropertiesValueID = Common.Obj2Int(dBProperties.ViewListValueOfCatFT.Rows[i]["PropertiesValueID"].ToString());
                        Wait.Show("Đang chuyển ID: " + PropertiesValueID.ToString());
                        adt.UpdateQuery_NhapValueGiongNhau(Common.Obj2Int(this.txtValueCurrent.Text), PropertiesID, PropertiesValueID);
                    }
                }
            }
            Wait.Close();
            RefreshData();
        }
Пример #17
0
        public void Sound(int Type)    //語音
        {
            //需要備份的檔案
            //string[] fsbFile = { "VOBank_zh_TW.fsb", "VOBank_zh_CN.fsb", "VOBank_en_US.fsb", "VOBank_ko_KR.fsb", "LoL_Audio_zh_TW.fev", "LoL_Audio_zh_CN.fev", "LoL_Audio_en_US.fev", "LoL_Audio_ko_KR.fev" };

            if (Type == 1)  //備份
            {
                wait.Show();
                wait.progressBar1.Value = 0;

                //foreach (string file in fsbFile)
                //{
                //try
                //{
                //File.Copy(installPath + @"\Game\DATA\Sounds\FMOD\" + file, Application.StartupPath + @"\bak\sound\FMOD\" + file, true);
                //wait.progressBar1.Value = wait.progressBar1.Value + 5;
                //}
                //catch { }
                //}
                try
                {
                    My.Computer.FileSystem.CopyDirectory(installPath + "\\Game\\DATA\\Sounds\\Wwise\\VO\\zh_TW", Application.StartupPath + "\\bak\\sound\\zh_TW", true);
                }
                catch
                {
                }
                try
                {
                    My.Computer.FileSystem.CopyDirectory(installPath + "\\Game\\DATA\\Sounds\\Wwise\\VO\\en_US", Application.StartupPath + "\\bak\\sound\\en_US", true);
                }
                catch
                {
                }

                try
                {
                    Directory.CreateDirectory(Application.StartupPath + @"\bak\sound\air");
                    foreach (string newPath in Directory.GetFiles(installPath + @"\Air\assets\sounds\en_US\champions", "*.*", SearchOption.AllDirectories))
                    {
                        File.Copy(newPath, newPath.Replace(installPath + @"\Air\assets\sounds\en_US\champions", Application.StartupPath + @"\bak\sound\air"), true);
                    }
                    wait.progressBar1.Value = 60;
                    foreach (string newPath in Directory.GetFiles(installPath + @"\Air\assets\sounds\zh_TW\champions", "*.*", SearchOption.AllDirectories))
                    {
                        File.Copy(newPath, newPath.Replace(installPath + @"\Air\assets\sounds\zh_TW\champions", Application.StartupPath + @"\bak\sound\air"), true);
                    }
                    wait.progressBar1.Value = 100;
                    wait.progressBar1.Value = 0;
                    wait.Close();
                    MessageBox.Show("備份成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Logger.log("語音檔 備份成功!", Logger.LogType.Info);
                }
                catch (Exception e)
                {
                    wait.Close();
                    Logger.log("語音檔 備份失敗!", Logger.LogType.Error);
                    Logger.log(e);
                    MessageBox.Show("備份失敗 \r\n 錯誤信息: " + e, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            if (Type == 2) //還原
            {
                wait.Show();
                wait.progressBar1.Value = 0;

                //foreach (string file in fsbFile)
                //{
                //try
                //{
                //File.Copy(Application.StartupPath + @"\bak\sound\FMOD\" + file, installPath + @"\Game\DATA\Sounds\FMOD\" + file, true);
                //wait.progressBar1.Value = wait.progressBar1.Value + 15;
                //}
                //catch { }
                //}
                string[] folder =
                {
                    "ko_KR",
                    "zh_CN"
                };
                foreach (string f in folder)
                {
                    if (Directory.Exists(installPath + "\\Game\\DATA\\Sounds\\Wwise\\VO\\" + f))
                    {
                        Directory.Delete(installPath + "\\Game\\DATA\\Sounds\\Wwise\\VO\\" + f);
                    }
                }
                try
                {
                    My.Computer.FileSystem.CopyDirectory(Application.StartupPath + "\\bak\\sound\\zh_TW", installPath + "\\Game\\DATA\\Sounds\\Wwise\\VO\\zh_TW", true);
                }
                catch
                {
                }
                try
                {
                    My.Computer.FileSystem.CopyDirectory(Application.StartupPath + "\\bak\\sound\\en_US", installPath + "\\Game\\DATA\\Sounds\\Wwise\\VO\\en_US", true);
                }
                catch
                {
                }
                try
                {
                    foreach (string newPath in Directory.GetFiles(Application.StartupPath + @"\bak\sound\air", "*.*", SearchOption.AllDirectories))
                    {
                        File.Copy(newPath, newPath.Replace(Application.StartupPath + @"\bak\sound\air", installPath + @"\Air\assets\sounds\en_US\champions"), true);
                    }
                    wait.progressBar1.Value = 50;
                    foreach (string newPath in Directory.GetFiles(Application.StartupPath + @"\bak\sound\air", "*.*", SearchOption.AllDirectories))
                    {
                        File.Copy(newPath, newPath.Replace(Application.StartupPath + @"\bak\sound\air", installPath + @"\Air\assets\sounds\zh_TW\champions"), true);
                    }
                    wait.progressBar1.Value = 100;
                    wait.progressBar1.Value = 0;
                    wait.Close();
                    MessageBox.Show("還原成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Logger.log("語音檔 還原成功!", Logger.LogType.Info);
                }
                catch (System.IO.DirectoryNotFoundException err)
                {
                    wait.Close();
                    Logger.log("語音檔 還原失敗 : 沒有還原檔可供還原", Logger.LogType.Error);
                    Logger.log(err);
                    MessageBox.Show("沒有還原檔可供還原", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception e)
                {
                    wait.Close();
                    Logger.log("語音檔 還原失敗!", Logger.LogType.Error);
                    Logger.log(e);
                    MessageBox.Show("還原失敗 \r\n 錯誤信息: " + e, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            if (Type == 3)  //刪除備份
            {
                //foreach (string files in fsbFile)
                //{
                //try
                //{
                //File.Delete(Application.StartupPath + @"\bak\sound\FMOD\" + files);
                //}
                //catch { }
                //}
                try
                {
                    Directory.Delete(Application.StartupPath + @"\bak\sound\zh_TW", true);
                }
                catch
                { }
                try
                {
                    Directory.Delete(Application.StartupPath + @"\bak\sound\zh_CN", true);
                }
                catch
                { }
                try
                {
                    Directory.Delete(Application.StartupPath + @"\bak\sound\en_US", true);
                }
                catch
                { }
                try
                {
                    Directory.Delete(Application.StartupPath + @"\bak\sound\ko_KR", true);
                }
                catch
                { }
                try
                {
                    Directory.Delete(Application.StartupPath + @"\bak\sound\Air", true);
                    Logger.log("語音檔 刪除備份成功!", Logger.LogType.Error);
                    MessageBox.Show("備份刪除成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch
                { }
            }
        }
Пример #18
0
        private void CheckCompanyButton_Click(object sender, EventArgs e)
        {
            Wait.Show("Đang kiểm tra công ty!");
            //idcomnay này có thể là idharavan hoặc id mới đc sinh ra theo domain chính xác
            long idcompany = Common.Obj2Int64(companyIdWSSSpinEdit.Text);

            //QT.Entities.Company company = new QT.Entities.Company(idcompany);
            #region CheckCompany
            try
            {
                DBWebPartnerTableAdapters.CompanyTableAdapter companyAdapter = new DBWebPartnerTableAdapters.CompanyTableAdapter();
                companyAdapter.Connection.ConnectionString = Server.ConnectionString;
                DBWebPartner.CompanyDataTable _companyTable = new DBWebPartner.CompanyDataTable();
                companyAdapter.FillBy_ID(_companyTable, idcompany);
                //Trường hợp cài app thành công nhưng lúc tạo ra company xảy ra lỗi (api.websosanh.vn).
                // Lấy dữ liệu company từ haravan và thêm mới vào database.
                if (_companyTable.Rows.Count == 0)
                {
                    string shopname    = shopNameTextEdit.Text;
                    string accesstoken = accessTokenTextEdit.Text;
                    HaravanAuthorizationState authorizeState = new HaravanAuthorizationState();
                    authorizeState.ShopName    = shopname;
                    authorizeState.AccessToken = accesstoken;
                    var    client = new HaravanAPIClient(authorizeState);
                    object obj    = client.Get("/admin/shop.json");
                    if (obj != null)
                    {
                        ShopHaravanInfo shopharavanInfo = JsonConvert.DeserializeObject <ShopHaravanInfo>(obj.ToString());
                        //domain và website lấy theo domain chính xác được config (hoặc mặc định là shopname.myharavan.com)
                        string website = string.Format("http://{0}/", domainChinhXacTextEdit.Text);
                        Uri    uri     = new Uri(website);
                        String domain  = uri.Host.ToLower();
                        domain = domain.Replace("www.", "");
                        TimeSpan timestartup = new TimeSpan(0, 1, 1, 0);
                        TimeSpan timeSleep   = new TimeSpan(0, 1, 1, 0);
                        Alexa    a           = new Alexa();
                        a = Common.GetRankAlexa(uri.Host);
                        #region Insert
                        try
                        {
                            companyAdapter.Insert(
                                Common.GetIDCompany(domain),
                                authorizeState.ShopName,
                                "Shop in Haravan install App",
                                website,
                                domain,
                                DateTime.Now,
                                shopharavanInfo.shop.phone,
                                shopharavanInfo.shop.email,
                                shopharavanInfo.shop.customer_email,
                                shopharavanInfo.shop.address1,
                                Common.CompanyStatus.WEB_HARAVAN,
                                "",
                                a.AlexaRankContries,
                                a.AlexaRank,
                                timestartup,
                                timeSleep,
                                0,
                                0,
                                DateTime.Now,
                                DateTime.Now,
                                30,
                                0,
                                0,
                                0,
                                "",
                                DateTime.Now,
                                0);
                            Log.InfoFormat("HARAVAN : Insert Company Success With ShopName = {0}", authorizeState.ShopName);
                            MessageBox.Show("Thêm mới công ty thành công!");
                        }
                        catch (Exception ex)
                        {
                            Log.ErrorFormat("HARAVAN : Error Insert Company {0}", ex);
                        }
                        #endregion
                    }
                }
                else
                {
                    MessageBox.Show("Có công ty này!");
                }
            }
            catch (Exception exx)
            {
                Log.ErrorFormat("HARAVAN : CheckCompany {0}", exx);
            }
            #endregion
            Wait.Close();
        }
Пример #19
0
 public void Dispose()
 {
     this.CleanMemoryFootprints();
     Wait.Close();
 }
Пример #20
0
 private void DownloadAllImageButton_Click(object sender, EventArgs e)
 {
     Wait.Show("Đang download ảnh");
     try
     {
         long   idcompany = Common.Obj2Int64(companyIdWSSSpinEdit.Text);
         string _domain   = domainChinhXacTextEdit.Text;
         DBWebPartnerTableAdapters.ProductTableAdapter productAdapter = new DBWebPartnerTableAdapters.ProductTableAdapter();
         productAdapter.Connection.ConnectionString = Server.ConnectionString;
         DBWebPartner.ProductDataTable productTable = new DBWebPartner.ProductDataTable();
         productAdapter.FillBy_CompanyAndValid1(productTable, idcompany);
         if (productTable.Rows.Count == 0)
         {
             MessageBox.Show("Shop không có sản phẩm! Vui lòng kiểm tra lại!");
         }
         else
         {
             int count                    = productTable.Rows.Count;
             int countproduct             = 0;
             int countproductimagesuccess = 0;
             for (int i = 0; i < count; i++)
             {
                 Wait.Show(string.Format("Download ảnh {0}/{1}", i.ToString(), count.ToString()));
                 long   idProduct   = long.Parse(productTable.Rows[i]["ID"].ToString());
                 string imageurls   = productTable.Rows[i]["ImageUrls"].ToString();
                 string nameproduct = productTable.Rows[i]["Name"].ToString();
                 if (!string.IsNullOrEmpty(imageurls))
                 {
                     countproduct++;
                     string imagepath = string.Empty;
                     imagepath = Common.UploadImageProductStore(nameproduct, _domain, imageurls);
                     if (imagepath != "")
                     {
                         countproductimagesuccess++;
                         try
                         {
                             productTableAdapter.UpdateImagePath(imagepath, idProduct);
                         }
                         catch (Exception ex)
                         {
                             richTextBoxMessage.Text += ex.Message;
                         }
                     }
                     else
                     {
                         richTextBoxMessage.Text += idProduct.ToString() + "Upload fails\r\n";
                     }
                 }
                 else
                 {
                     richTextBoxMessage.Text += idProduct.ToString() + "Url null or Empty\r\n";
                 }
             }
             labelControlMessageImage.Text = string.Format("Upload ảnh {0} sản phẩm. Thành công {1}/{2}", count, countproductimagesuccess, countproduct);
         }
     }
     catch (Exception ex)
     {
         richTextBoxMessage.Text += ex.Message;
     }
     Wait.Close();
 }
Пример #21
0
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     waitWindow.Close();
 }
Пример #22
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     DBLogJobTableAdapters.CompanyTableAdapter companyAdapter = new DBLogJobTableAdapters.CompanyTableAdapter();
     DBLogJob.CompanyDataTable       companyTable             = new DBLogJob.CompanyDataTable();
     DBLogJob.ConfigurationDataTable configTable = new DBLogJob.ConfigurationDataTable();
     companyAdapter.Connection.ConnectionString = Server.ConnectionString;
     for (int i = 0; i < dBLogJob.CompanyVATStatus.Rows.Count; i++)
     {
         Wait.Show(string.Format("{0}/{1}", i, dBLogJob.CompanyVATStatus.Rows.Count));
         string domain    = dBLogJob.CompanyVATStatus.Rows[i]["Domain"].ToString();
         long   idcompany = Common.GetIDCompany(domain);
         if (idcompany != 0)
         {
             try
             {
                 companyTable.Rows.Clear();
                 companyAdapter.FillBy_ID(companyTable, idcompany);
                 if (companyTable.Rows.Count > 0)
                 {
                     configTable.Rows.Clear();
                     if (dBLogJob.CompanyVATStatus.Rows[i]["VATStatus"] == DBNull.Value)
                     {
                         Log.Error("VATSTatus NULL + ID =" + idcompany + " Domain = " + domain);
                         continue;
                     }
                     int status = Common.Obj2Int(dBLogJob.CompanyVATStatus.Rows[i]["VATStatus"].ToString());
                     try
                     {
                         configurationTableAdapter.FillBy_CompanyID(configTable, idcompany);
                         if (configTable.Rows.Count > 0)
                         {
                             try
                             {
                                 configurationTableAdapter.UpdateVATStatus(status, idcompany);
                             }
                             catch (Exception ex1)
                             {
                                 Log.Error("ERROR UPDATE + ID =" + idcompany + " Domain = " + domain, ex1);
                             }
                         }
                         else
                         {
                             try
                             {
                                 configurationTableAdapter.Insert("", "", "", "", "", "", "", "", null, "", "", idcompany, "", null, 0, 0, 0, 0, "", "", "", "", "", "", "", "", null, "", "", "", "", "", "", "", "", "", null, "", null, "", "", null, null, null, null, 0, status);
                             }
                             catch (Exception ex2)
                             {
                                 Log.Error("ERROR INSERT + ID =" + idcompany + " Domain = " + domain, ex2);
                             }
                         }
                     }
                     catch (Exception exx)
                     {
                         Log.Error("ERROR fill by id configuration  ", exx);
                     }
                 }
                 else
                 {
                     Log.Error("Không có Cong ty nay ID =" + idcompany + " Domain " + domain);
                 }
             }
             catch (Exception ex)
             {
                 Log.Error("ERROR fill by id COmpany ", ex);
             }
         }
         else
         {
             Log.Error("ID = 0  " + domain);
         }
     }
     Wait.Close();
 }