Ejemplo n.º 1
0
        public int Add <T>(List <T> modelList) where T : class, new()
        {
            var ddd   = new SimpleClient <T>(db);
            var count = ddd.InsertRange(modelList);

            return(count ? 1 : 0);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 功能描述:插入数据
 /// </summary>
 /// <param name="entitys">实体列表</param>
 /// <returns>是否成功</returns>
 public bool Insert(params T[] entitys)
 {
     if (entitys != null && entitys.Length > 0)
     {
         return(_entityDB.InsertRange(entitys));
     }
     return(true);
 }
Ejemplo n.º 3
0
        public void InitData(ISqlSugarClient sclient)
        {
            sclient.DbMaintenance.CreateDatabase(); //创建数据库
            sclient.CodeFirst.InitTables(typeof(zCustomUser));

            SimpleClient       simpleClient = new SimpleClient(sclient);
            List <zCustomUser> userlist     = new List <zCustomUser>()
            {
                new zCustomUser()
                {
                    Name = "admin", AddTime = DateTime.Now, Gender = 1, pwd = "", state = 1
                },
                new zCustomUser()
                {
                    Name = "bob", AddTime = DateTime.Now, Gender = 1, pwd = "", state = 1
                }
            };

            simpleClient.InsertRange(userlist);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// AddRange entity and return success or not
 /// </summary>
 /// <param name="entities"></param>
 /// <returns></returns>
 public bool AddRange(IEnumerable <T> entities)
 {
     return(currentDb.InsertRange(entities.ToArray()));
 }
Ejemplo n.º 5
0
        public int AddList(IQueryable <TEntity> entities)
        {
            var result = _dbSet.InsertRange(entities.ToList());

            return(1);
        }
Ejemplo n.º 6
0
 public bool Adds(T[] entity)
 {
     return sdb.InsertRange(entity);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 多条数据添加考生
        /// </summary>
        /// <param name="candidates"></param>
        /// <returns></returns>
        public int ADDList(List <Candidate> candidates)
        {
            var result = Convert.ToInt16(CandidateDB.InsertRange(candidates.ToArray()));

            return(result);
        }