Exemplo n.º 1
0
        ///java sys
        /// <summary>
        /// read database  to local json file
        /// </summary>
        public void SaveTBNameToJson(Uri JsonPath = null)
        {
            //读取数据库
            SysTBNameDAL sysTBNAMEDAL = new SysTBNameDAL();
            var          listTBName   = sysTBNAMEDAL.SelectTBName(null);//token
            //转换json
            JsonHelper jsonHelper = new JsonHelper();
            var        strJson    = jsonHelper.SerializerJson(listTBName);
            //保存文件
            IOFileHelper iOFileHelper    = new IOFileHelper();
            string       JsonContentPath = ConfigurationManager.AppSettings["JsonContentPath"];

            iOFileHelper.SaveJsonFile(JsonContentPath, "BarName.json", strJson);//文件名写死
        }
Exemplo n.º 2
0
 /// <summary>
 /// insert json data
 /// </summary>
 /// <param name="filepath"></param>
 /// <returns></returns>4
 public bool InsertJson(string filepath)
 {
     try
     {
         SysTBNameDAL sysTBNameDAL = new SysTBNameDAL();
         var          list         = getJsonContent(filepath);
         if (list == null)
         {
             return(false);
         }
         var data = sysTBNameDAL.InsertTBName(list);
         if (data == 0)
         {
             return(false);
         }
     }
     catch
     {
         Debug.Write("--------TBNameServices Error---------");
     }
     return(true);
 }