Пример #1
0
        public override void ProcessMessage(BasicDeliverEventArgs message)
        {
            MssUpdateAlexaCompany mss = Newtonsoft.Json.JsonConvert.DeserializeObject <MssUpdateAlexaCompany>(UTF8Encoding.UTF8.GetString(message.Body));

            var    alexa    = Common.GetRankAlexa(mss.Domain);
            string strQuery = @"update company 
set  AlexaRank= 1
where id =1";

            this._sqlDbProduct.RunQuery(strQuery, CommandType.Text,
                                        new SqlParameter[] { SqlDb.CreateParamteterSQL("@Id", mss.CompanyId, SqlDbType.BigInt), SqlDb.CreateParamteterSQL("@AlexaRank", alexa.AlexaRank, SqlDbType.Int), });
            Logger.Info(string.Format("{0} {1} \r\n", mss.Domain, alexa.AlexaRank, alexa.AlexaRankContries));
            this.GetChannel().BasicAck(message.DeliveryTag, true);
        }
Пример #2
0
        public override void ProcessMessage(BasicDeliverEventArgs message)
        {
            Thread.Sleep(2000);
            MssUpdateAlexaCompany mss = Newtonsoft.Json.JsonConvert.DeserializeObject <MssUpdateAlexaCompany>(UTF8Encoding.UTF8.GetString(message.Body));
            var alexa = Common.GetRankAlexa(mss.Domain);

            if (alexa.AlexaRankContries > 0)
            {
                string strQuery = @"
                                    update Web 
                                    set  AlexaRank = @AlexaRank
                                    where id =@Id";
                bool   bOK      = this._sqlDbProduct.RunQuery(strQuery, CommandType.Text,
                                                              new SqlParameter[] { SqlDb.CreateParamteterSQL("@Id", mss.CompanyId, SqlDbType.BigInt), SqlDb.CreateParamteterSQL("@AlexaRank", alexa.AlexaRankContries, SqlDbType.Int), });
                Logger.Info(string.Format("{0} {1} {2} => {3} \r\n", mss.Domain, alexa.AlexaRank, alexa.AlexaRankContries, bOK));
            }
            else
            {
                _log.InfoFormat("Fail alexa for {0}", mss.Domain);
            }
            this.GetChannel().BasicAck(message.DeliveryTag, true);
        }