コード例 #1
0
ファイル: ProcessHelp.cs プロジェクト: Joy011024/PickUpData
        public override void Execute(INotification notification)
        {
            switch (notification.Type)
            {
            case AppNotify.Get_UinTotal:
                Task.Factory.StartNew(() =>
                {
                    Domain.CommonData.PickUpStatic pc = (new QQDataDA()).TodayStatic();
                    SendNotification(AppNotify.Back_UinTotal, pc);
                });
                break;

            case AppNotify.Get_CityData:
                Task.Factory.StartNew(() =>
                {
                    List <CategoryData> list = new DataFromManage().QueryCities();
                    SendNotification(AppNotify.Back_CityData, list);
                });
                break;

            case AppNotify.Get_UsableProxy:
                Task.Factory.StartNew(() =>
                {
                    string connString    = new ConfigurationItems().GetConnString("Proxy_Read");
                    ProxyDataService api = new ProxyDataService(connString);
                    List <ProxyDataService.Proxy> proxy = api.GetUsageProxy();
                });
                break;
            }
            //base.Execute(notification);
        }
コード例 #2
0
        public PickUpStatic TodayStatic()
        {
            //改为sync

            DataFromManage manage = new DataFromManage();

            return(manage.TodayStatic());
        }
コード例 #3
0
ファイル: TecentDataFrm.cs プロジェクト: Joy011024/PickUpData
        private void BindComboBox(CategoryData parentCode, ComboBox cmb, int level)
        {
            List <CategoryData> nodes = new List <CategoryData>();

            try
            {
                if (parentCode.Id == 0 && level == 2)
                {//该控件来自于省会自治区
                    nodes = cityList;
                }
                else if (parentCode.Id > 0)
                {
                    nodes.Add(noLimitAddress);
                    //如果没有启用Redis功能,则该数据从文本文件中读取
                    CategoryGroup objs = null;
                    //如果是文本文件 需要读取上层节点项,如果是Redis缓存项,则只需读取当前节点对id组装缓存项名称
                    if (SystemConfig.OpenRedis)
                    {
                        string itemName = GetCagetoryDataFileNameOrRedisItem(parentCode,
                                                                             redisItemOrFileNameFormat(SystemConfig.RedisValueIsJsonFormat));
                        // typeof(CategoryGroup).Name + ".Objcet=" + parentCode.Id;
                        if (!SystemConfig.RedisValueIsJsonFormat)
                        {//json  or object
                            List <CategoryData> items = new DataFromManage().QueryCities();
                            if (items != null)
                            {
                            }
                            // objs = new CategoryGroup() { Childrens = items };
                        }
                        else
                        {
                            //objs = redis.GetRedisCacheItem<CategoryGroup>(itemName);
                        }
                    }
                    else
                    {
                        string dir      = GetRedisRelyFileDir();
                        string fileJson = FileHelper.ReadFile(dir + "/" + GetNodeItemFileName(new CategoryGroup()
                        {
                            Root = parentCode
                        },
                                                                                              redisItemOrFileNameFormat(SystemConfig.RedisValueIsJsonFormat)));
                        if (fileJson != null)
                        {
                            objs = fileJson.ConvertObject <CategoryGroup>();
                        }
                    }
                    if (objs != null)
                    {//没数据
                        List <CategoryData> items = objs.Childrens.Select(s => s.Root)
                                                    .OrderBy(t => t.Code).ToList();
                        nodes.AddRange(items.ToArray());
                    }
                }
                else
                {
                    nodes.Add(noLimitAddress);
                }
            }
            catch (Exception ex)
            {
                nodes = new List <CategoryData>();
                nodes.Add(noLimitAddress);
            }
            cmb.DataSource    = nodes;
            cmb.DisplayMember = ComboboxItem.Name.ToString();
            cmb.ValueMember   = ComboboxItem.Code.ToString();
        }