日期:2014-05-18 浏览次数:20952 次
string[] temp = System.IO.File.ReadAllLines(SavePath, System.Text.Encoding.GetEncoding("gb2312")); IDictionary<bool, ArrayList> dict = BusiNeobyCardImportBiz.ImportCard(temp); public IDictionary<bool, ArrayList> ImportCard(string[] ListCard) { int Success = 0;//成功次数 int Failure = 0;//失败次数 IDictionary<bool, ArrayList> results = new Dictionary<bool, ArrayList>(); ArrayList arraylist = new ArrayList(); for (int i = 0; i < ListCard.Length; i++) { if (string.IsNullOrEmpty(ListCard[i])) { continue; } string[] cardNote = ListCard[i].Split(','); if (cardNote.Length != 4||cardNote[0].Length!=18) { Failure++; arraylist.Add(ListCard[i]); continue; } if (this.Find(ExpEnter.Equal("CardNo", cardNote[0]), null).Count >= 1) { Success++; continue; } BusiNeobyCardImport BusiNeobyCardImportModel = new BusiNeobyCardImport(); BusiNeobyCardImportModel.CardNo = cardNote[0]; BusiNeobyCardImportModel.Note1 = cardNote[0]; BusiNeobyCardImportModel.Note2 = cardNote[2]; BusiNeobyCardImportModel.Note3 = cardNote[3]; BusiNeobyCardImportModel.Status = "N"; OpResult result = BusiNeobyCardImportDal.Add(BusiNeobyCardImportModel);//添加到数据库 if (result.Success) { Success++; } else { Failure++; arraylist.Add(ListCard[i]); } } ArrayList listsuccess = new ArrayList(); listsuccess.Add(Success); results.Add(false, arraylist); results.Add(true, listsuccess); return results; }