Пример #1
0
 public Runner()
 {
     _connectinString = ConfigurationManager.AppSettings["ConnectionString"];
     _producer        = new ProducerBasic(RabbitMQManager.GetRabbitMQServer("rabbitMqCrlProperties"), "Product.AdsScore.Deleted");
     MAX_HOUR_LOOP    = CommonConvert.Obj2Int(ConfigurationManager.AppSettings["MAX_HOUR_LOOP"]);
     HOUR_RUN         = CommonConvert.Obj2Int(ConfigurationManager.AppSettings["HOUR_RUN"]);
 }
Пример #2
0
 protected override void OnStart(string[] args)
 {
     _workerCount = CommonConvert.Obj2Int(ConfigurationManager.AppSettings["WorkerCount"]);
     for (var i = 0; i < _workerCount; i++)
     {
         var workerTask = new Task(() =>
         {
             WorkerLog wk = new WorkerLog();
             wk.StartConsume();
             Console.ReadLine();
         });
         workerTask.Start();
     }
 }
Пример #3
0
        public Entity.ConfigProperty GetConfig(string domain)
        {
            DataTable tbl = this._sqlDbProduct.GetTblData(@"
      SELECT TOP 1 c.[Id]
      ,c.[CompanyId]
      ,c.[TypeLayout]
      ,c.[XPath]
      ,c.[JSonOtherConfig]
      ,c.[JSonOtherConfigDemo]
	  ,c.UrlTest
	  , cf.CategoryXPath
      , co.Domain
      , cf.RemoveLastItemClassification
      , cf.TimeDelay
  FROM [dbo].[Configuration_Property] c
  INNER JOIN Configuration cf ON cf.CompanyID = c.CompanyId
  INNER JOIN Company co ON co.Id = cf.CompanyId
  Where co.Domain = @CompanyId"
                                                          , CommandType.Text, new SqlParameter[]
            {
                SqlDb.CreateParamteterSQL("@CompanyId", domain, SqlDbType.NVarChar)
            });

            if (tbl.Rows.Count > 0)
            {
                var row = tbl.Rows[0];
                return(new ConfigProperty()
                {
                    CategoryXPath = CommonConvert.Obj2String(row["CategoryXPath"]),
                    CompanyId = CommonConvert.Obj2Int64(row["CompanyId"]),
                    JSonOtherConfig = CommonConvert.Obj2String(row["JSonOtherConfig"]),
                    TypeLayout = CommonConvert.Obj2Int(row["TypeLayout"]),
                    XPath = CommonConvert.Obj2String(row["XPath"]),
                    UrlTest = CommonConvert.Obj2String(row["UrlTest"]),
                    Domain = CommonConvert.Obj2String(row["Domain"]),
                    RemoveLastItemClassification = CommonConvert.Obj2Bool(row["RemoveLastItemClassification"]),
                    TimeDelay = CommonConvert.Obj2Int(row["TimeDelay"])
                });
            }
            else
            {
                return(null);
            }
        }