Example #1
0
 private void btBuildContent_Click(object sender, EventArgs e)
 {
     try
     {
         this.productValueTableAdapter.FillByProductID(dBMap.ProductValue, Common.Obj2Int64(iDTextBox.Text));
         string sv = ContentAnalytic.BuildContentProduct((DataTable)dBMap.ProductValue);
         this.webBuildContent.DocumentText = sv;
     }
     catch (Exception)
     {
     }
 }
Example #2
0
        private void bt_Analytic_Click(object sender, EventArgs e)
        {
            List <PropertyEntyties> ls = new List <PropertyEntyties>();

            ls = ContentAnalytic.GetListProperties(this.productContentTextBox.Text.Trim(),
                                                   this.detailUrlTextBox.Text.Trim());
            string s = "";

            foreach (PropertyEntyties item in ls)
            {
                s += string.Format("{0}\t{1}\t{2}\n", item.STT, item.Name, item.Value);
            }
            this.webContent.DocumentText = s;
        }
Example #3
0
        private void btTestProperties_Click(object sender, EventArgs e)
        {
            List <PropertyEntyties> l = ContentAnalytic.GetListProperties(productContentTextBox.Text, this.detailUrlTextBox.Text);

            ContentAnalytic.UpdateContent(0, l);
        }
Example #4
0
 private void bttest_Click(object sender, EventArgs e)
 {
     List <PropertyEntyties> ls = ContentAnalytic.GetListProperties(this.productContentTextBox.Text, this.detailUrlTextBox1.Text);
 }
Example #5
0
        void doConvertSPGoc()
        {
            this.Invoke((MethodInvoker) delegate
            {
                this.lamssconvert.Text = "Start convert";
            });
            DBPManTableAdapters.ProductTableAdapter adtProduct = new DBPManTableAdapters.ProductTableAdapter();
            DBPMan.ProductDataTable dtP = new DBPMan.ProductDataTable();
            adtProduct.Connection.ConnectionString = Server.ConnectionString;
            int i = 0;

            foreach (DBMap.ProductRow dr in dBMap.Product)
            {
                //if (Common.Obj2Int64(dr.ProductID) <= 0)
                //{
                //insert to productid
                // vatgia
                if ((dBMap.Product.Rows[i]["ImageUrls"].ToString().Trim() != "")
                    //&& (dBMap.Product.Rows[i]["ProductContent"].ToString().Trim().Length > 10)
                    && (dBMap.Product.Rows[i]["ImageUrls"].ToString().Trim() != ""))
                {
                    int ID = Common.GetID_ProductID(dr.Name, IDCategory);
                    try
                    {
                        string name      = dr.Name.Replace("- Thông số kỹ thuật", "").Trim();
                        string contentft = Common.UnicodeToKoDauFulltext(name + " " + labelControlListIDSearch.Text);
                        if (adtProduct.Connection.State == ConnectionState.Closed)
                        {
                            adtProduct.Connection.Open();
                        }
                        try
                        {
                            /// check san pham nay da được tạo chưa
                            /// nếu chưa thì insert
                            /// đã có thì update lại thông số kỹ thuật
                            ///
                            dtP = new DBPMan.ProductDataTable();
                            adtProduct.FillBy_CheckID(dtP, ID);
                            if (dtP.Rows.Count > 0)
                            {
                                //adtProduct.UpdateQuery_SPGoc(
                                //    12,
                                //    Common.GetIDCompany("quangtrung.vn"),
                                //    DateTime.Now,
                                //    dBMap.Product.Rows[i]["ProductContent"].ToString(),
                                //    name,
                                //    dr.DetailUrl,
                                //    dr.ImageUrls,
                                //    Common.UnicodeToKoDauFulltext(name),
                                //    false,
                                //    Common.GetHashNameProduct("quangtrung.vn", name),
                                //    "",
                                //    IDCategory,
                                //    ID);
                            }
                            else
                            {
                                // chuyển sang làm sản phẩm gốc
                                adtProduct.InsertQuery_SPGoc(
                                    ID,
                                    Common.GetIDCompany("quangtrung.vn"),
                                    DateTime.Now,
                                    name,
                                    dBMap.Product.Rows[i]["ProductContent"].ToString(),
                                    name,
                                    dr.DetailUrl,
                                    dr.ImageUrls,
                                    Common.UnicodeToKoDauFulltext(name) + " " + NameCategory + " " + Common.UnicodeToKoDauFulltext(NameCategory),
                                    false,
                                    Common.GetHashNameProduct("quangtrung.vn", name),
                                    "",
                                    IDCategory,
                                    Common.Obj2Int(dBMap.Product.Rows[i]["Price"].ToString()),
                                    dr.ID,  // lưu product id vào trường classification vì productid chỉ là kiểu int
                                    contentft);
                                LogJobAdapter.SaveLog(JobName.FrmEditeProductByCat_Them_moi_san_pham_goc, "Thêm mới sản phẩm gốc MAP PRODUCT!", ID, (int)JobTypeData.Product);
                            }
                            dtP.Dispose();
                            List <PropertyEntyties> ls = new List <PropertyEntyties>();
                            ls = ContentAnalytic.GetListProperties(dBMap.Product.Rows[i]["ProductContent"].ToString().Trim(),
                                                                   dBMap.Product.Rows[i]["DetailUrl"].ToString().Trim());
                            ContentAnalytic.UpdateContent(ID, ls);
                        }
                        catch (Exception)
                        {
                            //  tên sản phẩm trong chuyên mục này đã có
                        }

                        // update lại sản phẩm vừa chuyển đã chuyển
                        adtProduct.UpdateQuery_ProductID(ID, dr.ID);
                    }
                    catch (Exception)
                    {
                    }
                    this.Invoke((MethodInvoker) delegate
                    {
                        this.lamssconvert.Text = string.Format("{0}/{1} - {2}", i, dBMap.Product.Count, dr.Name);
                    });
                    Application.DoEvents();
                    adtProduct.Connection.Close();
                    //String[] images = dBMap.Product.Rows[i++]["Promotion"].ToString().Split('\n');
                    //if ((images.Length > 0) && (images[0].Trim().Length > 0))
                    //{

                    //try
                    //{
                    //    adtID.Insert(
                    //    ID,
                    //    images[0].ToString(),
                    //    IDCategory,
                    //    0, 0, 0,
                    //    dr.ProductContent,
                    //    dr.DetailUrl,
                    //    dr.Name,
                    //    dr.NameFT,
                    //    Common.Obj2Int(Common.ProductIDStatus.NotValid));
                    //}
                    //catch (Exception)
                    //{

                    //}

                    //}
                }
                //}
                i++;
            }
        }