Beispiel #1
0
 /// <summary>
 /// 开始读取数据
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_read_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(txt_ConStr.Text.Trim()))
     {
         WriteMsg?.Invoke("数据库链接字符串不能为空");
     }
     else
     {
         try
         {
             IRepository repository = new MysqlRepository(txt_ConStr.Text.Trim());
             List <TerminalDataSetEntity> terminalDataSetEntities = repository.GetList <TerminalDataSetEntity>("select * from base_terminaldataset").Result.ToList();
             List <IndexManageEntity>     indexManageEntities     = repository.GetList <IndexManageEntity>("select * from base_indexmanage").Result.ToList();
             List <IndexAssocationEntity> assocationEntities      = repository.GetList <IndexAssocationEntity>("select * from base_indexassociation").Result.ToList();
             File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content/指标/基础指标数据.txt"), JsonConvert.SerializeObject(terminalDataSetEntities));
             File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content/指标/标题配置.txt"), JsonConvert.SerializeObject(indexManageEntities));
             File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Content/指标/关联关系.txt"), JsonConvert.SerializeObject(assocationEntities));
             WriteMsg?.Invoke("数据读取并存储完毕");
         }
         catch (Exception ex)
         {
             WriteMsg?.Invoke(ex.Message);
         }
     }
 }
Beispiel #2
0
 public BaseService()
 {
     mysqlRepository = new MysqlRepository <TEntity>();
 }