private void btSiteMap_Click(object sender, EventArgs e) { DBPMan.ProductDataTable dt = new DBPMan.ProductDataTable(); DBPMan.Product_PropertiesDataTable dtProperties = new DBPMan.Product_PropertiesDataTable(); DBPManTableAdapters.Product_PropertiesTableAdapter adtProperties = new DBPManTableAdapters.Product_PropertiesTableAdapter(); adtProperties.Connection.ConnectionString = Server.ConnectionString; this.productTableAdapter.FillBy_AllSPGocValid_orderByLastUpdate(dt, Common.GetIDCompany("quangtrung.vn"), DateTime.Now); String xml = ""; xml += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; xml += "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n"; xml += " <url>\n"; xml += " <loc>http://websosanh.vn/home.htm</loc>\n"; xml += " <changefreq>daily</changefreq>\n"; xml += " <priority>0.8</priority>\n"; xml += " </url>\n"; string f = ""; f += " <url>\n"; f += " <loc>{0}</loc>\n"; f += " <changefreq>daily</changefreq>\n"; f += " <priority>0.8</priority>\n"; f += " </url>\n"; for (int i = 0; i < dt.Rows.Count; i++) { long id = 0; string name = "", url = ""; id = Common.Obj2Int64(dt.Rows[i]["ID"].ToString()); name = dt.Rows[i]["Summary"].ToString(); url = Bussiness.UrlHelper.GetUrlOfProductIDSoSanh(id, name); xml += string.Format(f, url); } dt.Dispose(); xml += "</urlset>\n"; FileLog.WriteText(xml, "sitemap.xml"); }
//Không sử dụng nữa 02-12-2015 void doUpdateFulltext() { DBPMan.ProductDataTable dt = new DBPMan.ProductDataTable(); DBPMan.Product_PropertiesDataTable dtProperties = new DBPMan.Product_PropertiesDataTable(); DBPManTableAdapters.Product_PropertiesTableAdapter adtProperties = new DBPManTableAdapters.Product_PropertiesTableAdapter(); adtProperties.Connection.ConnectionString = Server.ConnectionString; if (chkAll.Checked == true) { this.productTableAdapter.FillBy_AllSPGocValid_orderByLastUpdate(dt, Common.GetIDCompany("quangtrung.vn"), DateTime.Now); } else { this.productTableAdapter.FillBy_CompanyID_Valid_Category(dt, Common.GetIDCompany("quangtrung.vn"), true, Common.Obj2Int(this.iDListClassificationTextBox.Text)); } for (int i = 0; i < dt.Rows.Count; i++) { try { long id = 0; int categoryID = 0; string nameCat = ""; id = Common.Obj2Int64(dt.Rows[i]["ID"].ToString()); categoryID = Common.Obj2Int(dt.Rows[i]["CategoryID"].ToString()); var filter = GetFilterCategory(categoryID); nameCat = dt.Rows[i]["CategoryName"].ToString(); //adtProperties.FillBy_FillterByProductID(dtProperties, id); //foreach (DBPMan.Product_PropertiesRow dr in dtProperties) //{ // int proid = Common.Obj2Int(dr.PropertiesID); // int provalue = Common.Obj2Int(dr.PropertiesValueID); // filter += string.Format(" {0}_{1}", proid, provalue); //} //for (int ii = 0; ii < dtProperties.Rows.Count; ii++) //{ // int proid = Common.Obj2Int(dtProperties.Rows[ii]["PropertiesID"].ToString()); // int provalue = Common.Obj2Int(dtProperties.Rows[ii]["PropertiesValueID"].ToString()); // filter += string.Format(" {0}_{1}", proid, provalue); //} string nameFT = Common.UnicodeToKoDauFulltext(dt.Rows[i]["Name"].ToString() + " " + nameCat) + " " + nameCat; var contentft = Common.UnicodeToKoDauFulltext(nameCat) + " " + filter; if (contentft.Contains("c000")) { contentft = contentft; } this.productTableAdapter.UpdateQuery_ContentFT_NameFT_ByID( contentft, nameFT, id); int delay = 1000; this.Invoke( (MethodInvoker) delegate { this.laMess1.Text = String.Format("Update thông tin search {0}/{1} sản phẩm gốc: {2}\n ", i, dt.Rows.Count, dt.Rows[i]["Name"].ToString()); delay = Common.Obj2Int(txtDelay.Text.Trim()); }); contentft = nameFT + " " + filter; if (contentft.Contains("c000")) { contentft = contentft; } this.productTableAdapter.UpdateQuery_ContentFT_CategoryID_ByProductID( contentft, Common.Obj2Int(dt.Rows[i]["CategoryID"]), Common.Obj2Int(id)); Thread.Sleep(delay); } catch (Exception ex) { var error = ex.Message; error += ""; } } dt.Dispose(); if (updateFulltextThread != null) { if (updateFulltextThread.IsAlive) { updateFulltextThread.Abort(); updateFulltextThread.Join(); updateFulltextThread = null; } } }