private static void AddDatas(EntityDao db, Type type, string typeValue) { List <EnumItem> list = type.GetList(); List <TB_Type> datas = new List <TB_Type>(); list.ForEach(x => datas.Add(new TB_Type() { Type = typeValue, Value = x.Value, Name = x.Description, InserterCd = "CD0000", InserteTime = db.DbConectTime, UpdaterCd = "CD0000", UpdateTime = db.DbConectTime, })); db.Add(datas); }
/// <summary> /// /// </summary> /// <param name="model"></param> public void FileReplace(UI002ViewModel model) { string file = FileDialog(); if (file == null) { return; } using ExcelUtility excel = new ExcelUtility(file); ExcelWorksheet sheet = excel.GetSheet(); List <TB_User> addList = new List <TB_User>(); for (int i = 2; !string.IsNullOrWhiteSpace(sheet.Cells[i, 1].Text); i++) { TB_User tb = new TB_User() { CD = sheet.Cells[i, 1].Text, Name = sheet.Cells[i, 2].Text, Password = sheet.Cells[i, 3].Text, IP = sheet.Cells[i, 4].Text, GroupId = sheet.Cells[i, 5].Text, Level = 0, InserterCd = "CD001", InserteTime = DateTime.Now, UpdaterCd = "CD001", UpdateTime = DateTime.Now, }; addList.Add(tb); } using (EntityDao db = new EntityDao()) { db.Add(addList); } }