Beispiel #1
0
        private static void ResetCacheProductInfo()
        {
            ProductAdapter   productAdapter = new ProductAdapter(new SqlDb(Server.ConnectionString));
            CacheProductInfo c = new CacheProductInfo(new SqlDb(Server.ConnectionString));

            Console.WriteLine("1- Reset all cache by company (domain)");
            Console.WriteLine("2- Reset all cache");
            Console.WriteLine("3- Reset only 'product_info' all company");
            Console.WriteLine("4- Reset cache ProductInfo by domain");
            Console.Write("Input choose:");
            int i = Convert.ToInt32(Console.ReadLine());

            switch (i)
            {
            case 1:
            {
                Console.Write("Input domain:");
                string strDomain = Console.ReadLine().Trim();
                c.RefreshAllCacheAllProduct(productAdapter.GetCompanyIDFromDomain(strDomain));
            } break;

            case 2:
            {
                List <long> lstCompany = productAdapter.GetAllCompanyIdCrawler();
                for (int j = 0; j < lstCompany.Count; j++)
                {
                    c.RefreshAllCacheAllProduct(lstCompany[j]);
                    log.Info(string.Format("Update company {0}/{1}", j, lstCompany.Count - 1));
                }
            } break;

            case 3:
            {
                List <long> lstCompany = productAdapter.GetAllCompanyIdCrawler();
                for (int j = 0; j < lstCompany.Count; j++)
                {
                    c.ResetAllCacheProductInfo(lstCompany[j]);
                    log.Info(string.Format("Update company {0}/{1}", j, lstCompany.Count - 1));
                }
            } break;

            case 4:
            {
                Console.Write("Input domain:");
                string strDomain = Console.ReadLine().Trim();
                c.ResetForCompany(productAdapter.GetCompanyIDFromDomain(strDomain));
            } break;
            }
        }
Beispiel #2
0
        private void btnPush_Click(object sender, EventArgs e)
        {
            ProductAdapter pt = new ProductAdapter(new SqlDb(QT.Entities.Server.ConnectionString));

            string[] arData       = txtCompanyDomain.Text.Split(new char[] { }, 500, StringSplitOptions.RemoveEmptyEntries);
            int      countCompany = 0;

            foreach (var strCompany in arData)
            {
                long companyID = 0;
                if (long.TryParse(strCompany, out companyID))
                {
                    queueCompany.Enqueue(companyID);
                    countCompany++;
                }
                else
                {
                    companyID = pt.GetCompanyIDFromDomain(strCompany);
                    if (companyID > 0)
                    {
                        queueCompany.Enqueue(companyID);
                    }
                    countCompany++;
                }
            }

            if (countCompany > 0)
            {
                this.txtCompanyDomain.Clear();
                this.lblQueueCount.Text = string.Format("Q:{0}", queueCompany.Count);
                MessageBox.Show(string.Format("Added {0} companys", countCompany));
            }
        }
Beispiel #3
0
        private static void ManagerCacheLastTime()
        {
            ProductAdapter         productAdapter  = new ProductAdapter(new SqlDb(Server.ConnectionString));
            RedisLastUpdateProduct redisLastUpdate = RedisLastUpdateProduct.Instance();

            Console.WriteLine("1- Reset cache by company (domain)");
            Console.WriteLine("2- Cache for AllCompany");
            Console.Write("Input choose:");
            int i = Convert.ToInt32(Console.ReadLine());

            switch (i)
            {
            case 1:
            {
                Console.Write("Input domain you need reset cache:");
                string strDomain = Console.ReadLine().Trim();
                long   CompanyID = productAdapter.GetCompanyIDFromDomain(strDomain);
                redisLastUpdate.RemoveAllLstProduct(CompanyID);
                DataTable tbl = productAdapter.sqlDb.GetTblData("select id from product where company = @CompanyID", CommandType.Text, new System.Data.SqlClient.SqlParameter[] {
                        SqlDb.CreateParamteterSQL("@CompanyID", CompanyID, SqlDbType.BigInt)
                    });
                List <long> productIDs = new List <long>();
                foreach (DataRow rowInfo in tbl.Rows)
                {
                    productIDs.Add(Convert.ToInt64(rowInfo["id"]));
                }
                redisLastUpdate.UpdateBathLastUpdateProduct(CompanyID, productIDs, new DateTime(1900, 1, 1, 0, 0, 0));
                Console.WriteLine("Reseted all product LastUpdate in cache");
            } break;

            case 2:
            {
                List <long> companyCrawelrs = productAdapter.GetAllCompanyIdCrawler();
                int         Count           = 0;
                foreach (long CompanyID in companyCrawelrs)
                {
                    Count++;
                    DataTable tbl = productAdapter.sqlDb.GetTblData("select id from product where company = @CompanyID", CommandType.Text, new System.Data.SqlClient.SqlParameter[] {
                            SqlDb.CreateParamteterSQL("@CompanyID", CompanyID, SqlDbType.BigInt)
                        });
                    List <long> productIDs = new List <long>();
                    foreach (DataRow rowInfo in tbl.Rows)
                    {
                        productIDs.Add(Convert.ToInt64(rowInfo["id"]));
                    }
                    redisLastUpdate.RemoveAllLstProduct(CompanyID);
                    redisLastUpdate.UpdateBathLastUpdateProduct(CompanyID, productIDs, new DateTime(1990, 1, 1, 0, 0, 0));
                    log.Info(string.Format("Reseted all products for company {0}/{1} LastUpdate in cache", Count, companyCrawelrs.Count));
                }
            } break;
            }
        }
Beispiel #4
0
 private void btnVisibleAllDumplicate_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("NoValid All Dumplicate?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
     {
         ProductAdapter productAdapter = new ProductAdapter(new Entities.Data.SqlDb(QT.Entities.Server.ConnectionString));
         int            numberDelete   = productAdapter.NoValidProductDuplicate(txtCompanyID.Text);
         this.richTextBox1.AppendText(string.Format("\r\n Deleleted {0} products!", numberDelete));
         if (numberDelete > 0 && MessageBox.Show("Do you want to refresh cache in solr?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == System.Windows.Forms.DialogResult.Yes)
         {
             long CompanyID = productAdapter.GetCompanyIDFromDomain(txtCompanyID.Text);
             productAdapter.PushQueueIndexCompany(CompanyID);
             MessageBox.Show("Pushed message");
         }
     }
 }
Beispiel #5
0
        private static void ResetCacheProduct()
        {
            Console.Write("Input domain:");
            string                     strDomain           = Console.ReadLine().Trim();
            ProductAdapter             productAdapter      = new ProductAdapter(new SqlDb(Server.ConnectionString));
            RedisCheckDuplicateAdapter redisCheckDuplicate = RedisCheckDuplicateAdapter.Instace();
            RedisLastUpdateProduct     redisLastUpdate     = RedisLastUpdateProduct.Instance();
            CacheProductInfo           cacheProductInfo    = new CacheProductInfo(productAdapter.sqlDb);
            int     count     = 0;
            var     companyID = productAdapter.GetCompanyIDFromDomain(strDomain);
            Company cmp       = new Company(companyID);

            redisCheckDuplicate.ResetForCompany(companyID, cmp.Domain, productAdapter.sqlDb);
            redisLastUpdate.ResetForCompany(companyID, productAdapter.sqlDb);
            cacheProductInfo.ResetForCompany(companyID);
            log.Info(string.Format("Reset cache company {0}/{1}-{2} {3} products", count++, companyID, cmp.Domain, cmp.TotalProduct));
            Console.WriteLine("Success reset data!");
        }
Beispiel #6
0
        private static void Main(string[] args)
        {
            Server.ConnectionString        = ConfigCrawler.ConnectProduct;
            Server.ConnectionStringCrawler = ConfigCrawler.ConnectionCrawler;
            Server.LogConnectionString     = ConfigCrawler.ConnectLog;
            ProductAdapter productAdapter = new ProductAdapter(new SqlDb(ConfigCrawler.ConnectProduct));

            string strParaInput = (args.Length == 0) ? Console.ReadLine() : string.Join(" ", args);

            strParaInput = @"-c svptccache -u http://maxmobile.vn/dien-thoai/lg-g5-cu.html";

            ParameterManager p = ParameterManager.Parse(strParaInput);

            //p.SubCmd = "svptccache";
            if (p.SubCmd == "crlrl")
            {
                string domain    = p.Parameters["dm"][0];
                long   idCOmpany = productAdapter.GetCompanyIDFromDomain(domain);
                using (var worker = new WorkerReload(idCOmpany, new CancellationToken(), "", true))
                {
                    worker.StartCrawler();
                }
            }
            else if (p.SubCmd == "crlfn")
            {
            }
            else if (p.SubCmd == "svcudclss")
            {
                var c = new ConsumerClassificationToSql();
                c.StartConsume();
            }
            else if (p.SubCmd == "svptccache")
            {
                var c = new ConsumerProductChangeToCache();
                c.StartConsume();
            }
            else if (p.SubCmd == "svudprsql")
            {
                var c = new ConsumerProductChangeToSql();
                c.StartConsume();
            }
            else if (p.SubCmd == "prpt")
            {
                ProductAdapter pta = new ProductAdapter(new SqlDb(Server.ConnectionString));
                string         url = p.Parameters["u"][0].ToString();
                url = "http://maxmobile.vn/dien-thoai/lg-g5-cu.html";
                Uri           uri          = new Uri(url);
                string        domain       = Common.GetDomainFromUrl(uri);
                long          idCompanyId  = pta.GetCompanyIdByDomain(domain);
                IDownloadHtml downloader   = new DownloadHtmlCrawler();
                Configuration config       = new Configuration();
                HtmlDocument  htmlDocument = new HtmlDocument();
                var           ext          = new WebExceptionStatus();
                string        html         = downloader.GetHTML(url, 45, 2, out ext);
                htmlDocument.LoadHtml(html);
                ProductEntity pte = new ProductEntity();
                ProductParse  ppr = new ProductParse();
                ppr.Analytics(pte, htmlDocument, url, config, domain);
            }
            //ConsumerSaveEndSession consumerSaveEndSession = new ConsumerSaveEndSession();
            //consumerSaveEndSession.StartConsume();
        }
Beispiel #7
0
        private static void Main(string[] args)
        {
            try
            {
                Server.ConnectionString        = ConfigCrawler.ConnectProduct;
                Server.ConnectionStringCrawler = ConfigCrawler.ConnectionCrawler;
                Server.LogConnectionString     = ConfigCrawler.ConnectLog;
                InitQueue isq = new InitQueue();
                isq.Start();

                if (args == null || args.Length == 0)
                {
                    Console.WriteLine(@"Input para:");
                    var readLine = Console.ReadLine();
                    if (readLine != null)
                    {
                        args = readLine.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                    }
                }
                else
                {
                    Console.WriteLine(string.Join(" ", args));
                }

                var strPara = string.Join(" ", args);
                var pr      = new Parameter();
                pr.ParseData(strPara);
                Console.Title = strPara;

                Console.CancelKeyPress += EndApp;
                if (pr.TypeRun == 1)
                {
                    if (string.IsNullOrEmpty(pr.Domain))
                    {
                        for (var i = 0; i < pr.NumberThread; i++)
                        {
                            Task.Factory.StartNew(() =>
                            {
                                var w = new WorkerMqRl(RabbitMQManager.GetRabbitMQServer(ConfigCrawler.KeyRabbitMqCrawler), pr.QueueMQ, pr.AckIm);
                                w.StartConsume();
                            });
                            Thread.Sleep(20000);
                        }
                    }
                    else
                    {
                        var pt      = new ProductAdapter(new SqlDb(QT.Entities.Server.ConnectionString));
                        var token   = new CancellationToken();
                        var wokerFn = new WSS.Core.Crawler.WorkerReload(pt.GetCompanyIDFromDomain(pr.Domain), "");
                        wokerFn.StartCrawler();
                    }
                }
                else if (pr.TypeRun == 0)
                {
                    if (string.IsNullOrEmpty(pr.Domain))
                    {
                        for (var i = 0; i < pr.NumberThread; i++)
                        {
                            var token = Source.Token;
                            var j     = i;
                            Task.Factory.StartNew(() =>
                            {
                                var w = new WorkerMqFn(RabbitMQManager.GetRabbitMQServer(ConfigCrawler.KeyRabbitMqCrawler), pr.QueueMQ);
                                w.StartConsume();
                            }, token);
                            Thread.Sleep(20000);
                        }
                    }
                    else
                    {
                        var pt      = new ProductAdapter(new SqlDb(QT.Entities.Server.ConnectionString));
                        var token   = new CancellationToken();
                        var wokerFn = new WorkerFindNew(pt.GetCompanyIDFromDomain(pr.Domain), "");
                        wokerFn.StartCrawler();
                    }
                }

                while (true)
                {
                    if (Source.IsCancellationRequested)
                    {
                        Thread.Sleep(10000);
                        return;
                    }
                    else
                    {
                        Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception ex0)
            {
                log.Error(ex0);
                Console.ReadLine();
            }
        }
Beispiel #8
0
        public void Start()
        {
            string data = @"alobuy.vn
haianh.vn
knic.vn
lingo.vn
telo.vn
manhnguyen.com.vn
sieuthithanhcong.com
yes24.vn
dtcvietnam.com.vn
huongshop.vn
thegioikts.com
khoedepeva24h.com
familydeal.vn
kidsplaza.vn
lingo.vn
shoptuancua.com
bkc.vn
alobuy.vn
dienmaysaigon.com
hanghoachatluong.com
trevang.vn
saigonmusical.com.vn
cellphones.com.vn
kimnganhanoi.vn
congtyphuongnam.vn
evadeal.vn
sieuthithanhcong.com
f5fashion.vn
thoitrangxitin.com
muatot.vn
unigolf.vn
ghettre.com
doibanthan.vn
quatructuyen.com
telo.vn
dienthoaila.com
mykim.vn
yes24.vn
dongho24h.com
suabim.vn
muagiamgia.net
chuyengiasi.vn
bebeland.com.vn
lunibaby.com/
ngocanhshop.com.vn
apalife.com
maytinhbanggiasi.com
jotunshop.vn
xedaponline.vn
Ecare.vn
camerahoanglam.net
streetstyle.vn
bangiatot.vn
Dienmayhikaru.com
cucvip.vn
babimart.com
365mobile.vn
bepquangvinh.com
babo.vn
maimua.com
dogiadung.net.vn
anchau.vn
chamsocbesosinh.com
babylovevn.com
sua.vn
tickmua.com
thegioipinsac.vn
smartphonestore.vn
bibomart.com.vn
memoryzone.com.vn/
dochoiaz.vn
banhtrungthuthuhuong.net
quatangsumo.com
hoavoanmytho.com
thenhominhhang.com
banmaylanh.com
audionghiathuy.com
deal1.vn
androidgiare.vn
deltamevn.com
vienthongnam.com
muathuoctot.com
thegioisi.com
daugoichinhhang.com
suboy.vn
sphoto.vn
manhnguyen.com.vn
dienmaythienphuc.vn
batlua.vn
cameraminhanh.com
vndeal.net
giaiphapmaytinhtien.com
thaovinhvnt.com
haily.vn
laptoptragop.com.vn
thethaore.com
giaydabanh.com
sieumuanhanh.com
thegioikts.com
mkjsc.com.vn
noithatmiennam.com
digiphone.com.vn
azaudio.vn
tienloi24h.com.vn
noithatnhapkhau.net.vn
hongyen.vn
kdeal.vn
matkinhnamquang.com
chuthi.vn
bigshop.vn
maylocnuockangaroo.vn
kangaroohanoi.vn
thietbivesinhviet.com
giaphucomputer.com
dodiengiare.vn
shopbevame.com
kimnganhanoi.vn
babycuatoi.vn
fastmarket.vn
xedapkhaisang.com
uudaigia.com
thoitrang79.com
thaivinhphukien.com
dochoididong.com
vienthinh.vn
sacmauchobe.com
halobuy.vn
giadinhmart.vn
lamdep365.com.vn
dientulinhanh.com
ketnoitieudung.vn
nhanhmua.vn
lottedatviet.vn
mualachuan.com
nasa.vn
gangnammobile.vn
alobuy.vn
zoombuy.com.vn
shopmeyeucon.com
laptopchinhhang.com
banhandamchobe.net
vietlongbaby.vn
phunu24h.com.vn
giavu.vn
dungcuykhoabachhue.com
cycybon.com
dienmayduclong.vn
sola.vn
vitinhhoaibao.com
loagiare.com
dealhotvn.com
deal1.vn
okbuy.vn
cucvip.vn
domy.vn
noithatmiennam.com
brandon.com.vn
quatpanasonic.com.vn
quattranden.net.vn
anchau.vn
phunu24h.com.vn
bepminhha.com
goodlink.vn
babymart.vn
laptopprocom.vn
nhathuocviet.vn
http://huyhoang.vn/
hptvn.com
hongminhbaby.vn
www.dienmaytantien.vn
ytecaocap.com
picnictoy.vn
dienmayvico.com
thethaore.com
Vohoang.vn
thenhominhhang.com
caganu.com
phuquangkts.vn
kay.vn
thegioitragop.vn
dasangdangxinh.vn
tga.vn
ledvina999.vn
nguyenkim.com
songlongmedia.com
webhangnhat.com
duongmonglinh.com
saha.vn
rawshop.vn
nguyenhoamobile.com
playmobile.vn
shopnhaxinh.com
thegioididongsamsung.com
sieuthidienmaychinhhang.vn
bichngocmobile.com
laptopvip.vn
lemonshop.com.vn
baongoclaptop.com
vienthongthanhpho.vn
usamua.com
otb.vn
ytehoanggia.com
laptop3mien.vn
dienlanhnasan.com
xachtaynhat.com.vn
thoitrangxitin.com
hongdungsport.com
Shopsieure.com
nhaccuquythanh.com
hanoilab.com.vn
thegioilinhphukien.vn
dienthoaire.vn
kimphu.vn
dienmayhoanghai.vn
myphamhoaithu.com
khoevadepeva.com
phukienthoigian.com
u100.vn
amuasam.com
huylongphat.com.vn
ketsatson.com
doibanthan.vn
shopbabyfun.com.vn
tula.vn
xechobe.com.vn
htt.com.vn
muatot.vn
thegioithethao360.vn
haduong.vn
itech365.vn
htt.com.vn
vienthongmoi.com
panasonic-tphcm.com
kingshop.vn
thegioithethao360.vn
thethaore.com
chotinhcuaboo.com
homeoffice.com.vn
dongho24h.com
lunibaby.com/
eco-mart.com.vn
kingshop.vn
baoholaodongthienbang.com
deal1.vn
chodeal24h.vn
hongnguyensc.com.vn
ytecaocap.com
goodlink.vn
okbuy.vn
baoholaodongthienbang.com
hoangphatvn.vn
vanphatmobile.com.vn
vitinhbaoan.com
thegioikts.com
dienmayhikaru.com
hoaphathanoi.vn
bigmua.com
thenhominhhang.com
mayanhonline.com
afe.vn
Sieuthihangphap.com
hot.vn
thanhloansport.com.vn
giaysanco.com
happyworld.vn
batluadocdao.com
goldenhouse.com.vn
dealvip.vn
haolamshop.com
Thietbiytethuchuyen.com
Tanlongcamera.com
depeva.com
nmobile.vn
bigmua.com
lequanmobile.com
ianker.vn
tiengiaphat.vn
shopthegioihangdoc.com
f5c.vn
nhasachphuongnam.com
longbinh.com.vn
thegioilinhphukien.vn
dienmaykhanghuy.vn
tickmua.com
bengo.vn
iservice.vn
okbuy.vn
bachkhoashop.com
bepquangvinh.com
dongho24h.com
alomua360.com
umove.vn
fahasa.com
sieuthiphongphu.com
leofone.vn
chinhnhan.vn
sieumuanhanh.com
mediamart.vn
didongviet.vn
phucanh.vn
dienmaytruongviet.vn
thaovinhvnt.com
banmaylanh.com
bibomart.com.vn
bichha.vn
bosomivietnam.com
deal1.vn
digiphone.com.vn
manhnguyen.com.vn
sieuthidienmaymiennam.com
banhangusa.com
thethaore.com
microthuam.com
donghobcat.com
ytecaocap.com
chiaki.vn
anchau.vn
anchau.vn
adayroi.com
adayroi.com
chuthi.vn
maivangdatviet.com
kizomart.com.vn
thegioipinsac.vn
okbuy.vn
phukiengiare.com
anhduongmobile.com.vn
xedapkhaisang.com
vinbarista.com
yeucon247.com
chamsocbesosinh.com
anhduongmobile.com.vn
muadienthoai.vn
kdeal.vn
toilav.com
linhkiendidong.net
giaydabanh.com
laptopdell.vn
babylovevn.com
gangnammobile.vn
sacmauchobe.com
youshopping.vn
catlaser-cncgiare.com
dienmaycholon.vn
domy.vn
sola.vn
nhanhmua.vn
tech4you.vn
thegioipinsac.vn
trangtuan.com
dgcameras.vn
vntvbox.vn
kay.vn
loagiare.com
dochoididong.com
phunu24h.com.vn
cnttshop.vn
vinhtranmobile.com
okbuy.vn
thenhominhhang.com
cucvip.vn
goodlink.vn
dienmayduclong.vn
phunu24h.com.vn
sieumuanhanh.com
vienthongthanhpho.vn
bigshop.vn
hongminhbaby.vn
songlongmedia.com
vimax.vn
mykim.vn
ngocanhshop.com.vn
telo.vn
kieusashop.vn
applepro.vn
pinsacdidong.net
otb.vn
dienmay247.com
itshophanoi.vn
ytehoanggia.com
laptopvip.vn
dienmaybinhminh.com
shopmebill.com
vuahatchia.com
vohoang.vn
dienlanhminhkhoa.vn
takara.vn (mikaro.vn)
webhangnhat.com
dienmay247.com
tech4you.vn
shopbabyfun.com.vn
suabim.vn
suckhoexanh.vn
dienmayso8.com
myphamhoangdung.com
vientammobile.com
bibomart.com.vn
huyphu.com
myphamtocthunhung.com
linhkiendidong.net
thenhominhhang.com
yes24.vn
huyphu.com
Dienmayhoanghai.vn
Dienmayquanghanh.com
thegioiquattran.com.vn
dienmaycholon.vn
ali-vn.com
haduong.vn
memoryzone.com.vn
lunibaby.com
bige.vn
thoitrangtichtac.com
4tech.vn
nerfviet.com
Xuannhi.co
hoangphatvn.vn
sieuthibepga.net
deal1.vn
bachlong.vn
Dienmayquanghanh.com
manhnguyen.com.vn
sieuthidienmaychinhhang.vn
suachobeyeu.vn
chodeal24h.vn
sieumuanhanh.com
xachtaynhat.com.vn
thaonhien.com.vn
taembe.com
cungmua.com
Anphatpc.com.vn
tga.vn
www.phukienminhhieu.com
saha.vn
dienmaythudo.com
Thegioitu.com
dienmaycuongdat.com
dongho24h.com
fam.vn
Bigmua.com
myky.com.vn
Lanhuongmart.vn
maycaphenhapkhau.com
thegioilinhphukien.vn
www.thietbigames.com
www.microthuam.com
Shoptuancua.com
www.phammykim.vn
maytinhkimlong.com
tga.vn
Ora.life
www.vitinhvominh.com
www.dienmaykimnga.com
www.noithatmiennam.com
thegioiboardgame.vn
www.alovendor.com
www.evadeeva24h.com
www.fptshop.com.vn
www.banmaylanh.com
www.Aothun24h.vn
www.dienmaygiakhang.vn
www.myphamhanquocq8.com
http://dogiadung.net.vn/
www.imua.com.vn
www.chuyencungcap.com
www.giadunghanquoc.net
www.amazona.vn
kholaptopthaihoa.com
F5c.vn
Dnmart.vn
Hanoilab.com.vn
www.deal1.vn
goldenhouse.com.vn
avishop.vn
Giatot24h.net
www.giamcanngoai.com
www.daiphatloc.com.vn
tamphatshop.com
www.topazshop.vn
www.12mua.com
www.quatangme.com
www.thenhominhhang.com
www.mevabe123.vn
Kimnganhanoi.vn
www.dungcuykhoabachhue.com
www.topazshop.vn
dientulinhanh.com
www.sieuthiyte.com.vn
www.nhanhmua.vn
www.fptshop.com.vn
Babimart.com
www.dienmaycholon.vn
www.myphamus.vn
dienmaychicuong.com
www.thuanthe.com
www.viettablet.com
mangxanh.vn
dochoididong.com
www.dienmaycholon.vn
cucvip.vn
manhnguyen.com.vn
www.myphamhanquochcm.com
www.okbuy.vn
www.vienthongmoi.com
www.dienlanh50.com
Quattranden.net.vn
Quatpanasonic.com.vn
kienquoc.net
yteanhtu.com
www.xedapkhaisang.com
www.dienmayantam.vn
scj.vn
www.mac24h.vn
www.usamua.com
www.babymart.vn
www.sieumuanhanh.com
www.bepkhanhvy.vn
www.muadonhanh.com
www.camera4k.vn
www.thoitrangxitin.com
mangxanh.vn
thegioi2tech.com
vitinhvominh.com
babymua.com
etoy.vn
phucanh.vn
139.vn
loagiare.com
deal1.vn
shopmebill.com
dienmaynhatban.vn
phukien.com.vn
dientungocminh.vn
www.babymart.vn
quattranden.com.vn
hongminhbaby.vn
dienmayduclong.vn
giahotnhat.com
chichishop.com.vn
yteanhtu.com
myphamsino.com
mediamart.vn
onlinekangaroo.vn
vuaphukienso.com
dienmaytanbinh.vn
picnictoy.vn
dohieuchobe.vn
goodlink.vn
evamua.vn
aloday.com.vn
binhsuangoai.com
obabyshop.vn
bigshop.vn
cohoimua.com
alobuy.vn
babieskids.vn
thivi.vn
laptopusa.com.vn
ytehoanggia.com
songlongmedia.com
laptopvip.vn
dienmayso8.com
dodiengiare.vn
fastmarket.vn
hoaphathanoi.vn
mobilepro.com.vn
zemzemshop.com
shinperfume.com
rawshop.vn
myphamtocthunhung.com
phukienrenhat.net
vuhoangtelecom.vn
chotinhcuaboo.com
babydeal.vn
fahasa.com
quakhuyenmaivn.com
dochoilego.vn
thegioicuabe.net
vinared.vn
thegioisua.us
decalsaigon.com
cholonsaigon.vn
giadungsoctho.com
aloola.vn
taphoahangmy.com
inmstore.vn
zeal.vn
mshopcamera.com
dienlanhsieure.com
metieulong.com
fahasa.com
upschinhhang.com
kimnganhanoi.vn
sonsaoviet.com
24hstore.vn
dailydienmay.vn
xaumasoc.com
alomevabe.vn
mua99.vn
wowmart.vn
dienlanhduykhoa.com
shop79.vn
shopchoang.vn
ketnoitieudung.vn
panodo.vn
jackyjeans.com
nvfashion.vn
theauthenticwatch.com
songnhac.com.vn
dogotoiyeu.com.vn
aventkid.com
adayroi.com
quatpanasonic.com.vn
quattranden.net.vn
deal1.vn
kidsfami.com
sumall.vn
alconi.vn
bacsidalieu24h.vn
sunnybaby.vn
thietbiytethuchuyen.com
shopmaika.com
thuocbonhatban.com
";

            QT.Entities.Server.ConnectionString = ConfigCrawler.ConnectProduct;
            ProductAdapter productAdapter = new ProductAdapter(new SqlDb(QT.Entities.Server.ConnectionString));
            var            lstDomain      = data.Split(Common.arSplitToList, StringSplitOptions.RemoveEmptyEntries);

            int       countDomain = 0;
            IDatabase db          = RedisManager.GetRedisServer("redisConfigCat").GetDatabase(0);

            foreach (var domain in lstDomain)
            {
                countDomain++;
                List <Tuple <long, long> > lstCat = new List <Tuple <long, long> >();
                long companyId  = productAdapter.GetCompanyIDFromDomain(domain.Trim());
                var  ProductIds = productAdapter.GetAllProductIDsByCompany(companyId).ToList();

                foreach (var subLstProductIds in Common.SplitArray <long>(ProductIds, 500))
                {
                    RedisKey[] arRedisKeys = new RedisKey[subLstProductIds.Count];
                    for (int i = 0; i < subLstProductIds.Count; i++)
                    {
                        arRedisKeys[i] = "PRODUCT_CATID:" + subLstProductIds[i].ToString();
                    }
                    RedisValue[] redisValue = db.StringGet(arRedisKeys, CommandFlags.HighPriority);
                    for (int i = 0; i < redisValue.Length; i++)
                    {
                        if (redisValue[i].HasValue)
                        {
                            lstCat.Add(new Tuple <long, long>(ProductIds[i], Convert.ToInt64(redisValue[i])));
                        }
                    }

                    if (lstCat.Count > 0)
                    {
                        List <string> lst = new List <string>();
                        for (int i = 0; i < lstCat.Count; i++)
                        {
                            lst.Add(string.Format("Insert Into Product_Category (Product_Id, Category_Id) Values ({0}, {1})", lstCat[i].Item1, lstCat[i].Item2));
                        }

                        bool bOK = productAdapter.GetSqlDb().RunQuery(string.Join(";", lst), CommandType.Text, null);
                        Console.WriteLine(bOK);
                        lstCat.Clear();
                    }
                }

                log.InfoFormat("Success for domain {0} {1}/{2}", domain, countDomain, lstDomain.Count());
            }
        }