Exemple #1
0
        public AllTrainers GetTrainers(U_WeChatRegistered ruser)
        {
            AllTrainers trainers = null;

            using (SqlSugarClient _dbSql = SugarDao_LandaVSql.GetInstance())
            {
                List <AllTrainers> allTrainers = _dbSql.Queryable <AllTrainers>().Where(c => c.EmployeeNO == ruser.userid).ToList();
                if (allTrainers.Count > 0)
                {
                    trainers = allTrainers[0];
                }
            }
            return(trainers);
        }
Exemple #2
0
        public void InsertTrainers(U_WeChatRegistered ruser)
        {
            AllTrainers trainer = new AllTrainers();

            trainer.IDCard     = ruser.idcard;
            trainer.Name       = ruser.name;
            trainer.EmployeeNO = ruser.userid;
            trainer.Gender     = 1;
            if (!string.IsNullOrEmpty(ruser.gender))
            {
                trainer.Gender = Convert.ToInt32(ruser.gender);
            }
            trainer.MobilePhone = ruser.mobile;
            using (SqlSugarClient _dbSql = SugarDao_LandaVSql.GetInstance())
            {
                AllTrainers train = _dbSql.Queryable <AllTrainers>().Where(c => c.EmployeeNO == ruser.userid).FirstOrDefault();
                if (train == null)
                {
                    _dbSql.Insert(trainer);
                }
            }
        }