Beispiel #1
0
        int DeleteAll()
        {
            int retTrueCount = 0;

            addList = addList.OrderBy(info => info.GetType().Name).ToList();
            BaseMODEL        topMod  = null;
            List <BaseMODEL> toplist = new List <BaseMODEL>();

            foreach (var info in deleteList)
            {
                FileClass fs = FileClass.GetFileClassBymodel(info);
                if (topMod != null && topMod.GetType().Name == topMod.GetType().Name)
                {
                    deleteItem(toplist, info);
                }
                else
                {
                    toplist = GetListModel(fs.ReadFile(), info.GetType());
                    deleteItem(toplist, info);
                }
                fs.WriteInFile(JsonConvert.SerializeObject(toplist), true);
                retTrueCount++;
            }
            return(retTrueCount);
        }
Beispiel #2
0
        public override List <T> SelectList(string orderbystr)
        {
            List <T>  retList = new List <T>();
            BaseMODEL itemObj = (BaseMODEL)Activator.CreateInstance(typeof(T));
            FileClass fc      = FileClass.GetFileClassBymodel(itemObj);
            JArray    ar      = JArray.Parse(fc.ReadFile());

            foreach (var item in ar)
            {
                retList.Add(JsonConvert.DeserializeObject <T>(item.ToString()));
            }
            return(retList);
        }