Пример #1
0
        public int ImportDrug(string filePath)
        {
            DataTable    dtDrug  = ExcelHelper.ImportExceltoDt(filePath);
            List <Drug>  allDrug = new DrugManager().GetAll();
            List <Drug>  li      = DataTableToModel.ToListModel <Drug>(dtDrug).Where(item => !allDrug.Contains(item)).ToList();
            PinyinHelper ph      = new PinyinHelper();

            li.ForEach(item => item.searchcode = ph.GetFirstLetter(item.name));
            int count = new DrugManager().Insert(li);

            return(count);
        }