public HttpResponseMessage TransUser() { using (kingsundbNewEntities db = new kingsundbNewEntities()) { var sUer = db.tb_J_School.Where(w => 1 == 1).ToList(); List <U_Info> ls = new List <U_Info>(); foreach (var item in sUer) { U_Info sc = new U_Info(); sc._id = item.SchoolID; sc.em = item.Email; sc.ph = item.Tel; sc.pnm = item.PersonName; sc.pwd = item.Pwd; sc.qq = item.QQ; sc.sfnm = item.SchoolFullName; sc.snm = item.SchoolName; sc.tp = 1; sc.area = 1; ls.Add(sc); } MongoDbHelper.Insert(ls, DbName.U_Info); } return(ResultHelper.OK()); }
public HttpResponseMessage SignAdmin([FromBody] AdminUser m) { if (m == null || m.Account == "") { return(ResultHelper.Failed("账号不能为空")); } var u = MongoDbHelper.QueryOne <U_Info>(DbName.U_Info, w => w._id == m.Account); if (u != null) { return(ResultHelper.Failed("该用户已存在")); } U_Info j = new U_Info() { pnm = m.Name, pwd = SecurityHelper.EncryptString("666666"), _id = m.Account, tp = 0 }; MongoDbHelper.Insert(j, DbName.U_Info); return(ResultHelper.OK()); }
public HttpResponseMessage SignArea([FromBody] Area m) { var sc = MongoDbHelper.QueryOne <U_Info>(DbName.U_Info, w => w._id == m.ID); if (sc != null) { return(ResultHelper.Failed("该用户已存在")); } U_Info s = new U_Info() { _id = m.ID, em = m.Email, ph = m.Tel, pnm = m.Name, pwd = SecurityHelper.EncryptString("666666"), qq = m.QQ, tp = 2, area = m.AreaID }; MongoDbHelper.Insert(s, DbName.U_Info); return(ResultHelper.OK()); }
public HttpResponseMessage SignSchool([FromBody] User m) { var sc = MongoDbHelper.QueryOne <U_Info>(DbName.U_Info, w => w._id == m.ID); if (sc != null) { return(ResultHelper.Failed("该用户已存在")); } U_Info s = new U_Info() { _id = m.ID, em = m.Email, ph = m.Tel, pnm = m.PersonName, pwd = SecurityHelper.EncryptString("666666"), qq = m.QQ, sfnm = m.SchoolFullName, snm = m.SchoolName, tp = 1, area = m.AreaID }; MongoDbHelper.Insert(s, DbName.U_Info); var exam = MongoDbHelper.QueryOne <E_Info>(DbName.E_Info, w => w.btstate == 0 && w.IsDel == 0); if (exam != null) { Sch_Sc sc1 = new Sch_Sc(); sc1.eid = exam._id; sc1.sid = s._id; sc1.state = 0; sc1.snm = s.snm; sc1.area = s.area; MongoDbHelper.Insert(sc1, DbName.Sch_Sc); } return(ResultHelper.OK()); }