public void UpdateTrainers(U_WeChatRegistered ruser) { using (SqlSugarClient _dbSql = SugarDao_LandaVSql.GetInstance()) { _dbSql.Update <AllTrainers>(new { MobilePhone = ruser.mobile }, c => c.EmployeeNO == ruser.userid); } }
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); }
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); } } }