public typeofwork Add(typeofwork tw) { // 考虑是否已存在该工种 typeofwork tmp; if (!TryGet(tw.Name, out tmp)) { tw = db.typeofwork.Add(tw); db.SaveChanges(); return(tw); } else { return(null); } }
public organizationuser Add(organizationuser user) { user.Pwd = Tools.HashPassword(user.Pwd); user = db.organizationuser.Add(user); db.SaveChanges(); return(user); }
public testpaper Add(testpaper tp) { // 取机构用户id int organizationUserID = (int)tp.ID; // 向试卷表中添加 tp = db.testpaper.Add(tp); // 向生成关系表中添加 generate_testpaper_between_organizationuser_and_testpaper tmp = new generate_testpaper_between_organizationuser_and_testpaper { OrganizationUserID = organizationUserID, TestPaperID = (int)tp.ID, TimeOfGeneration = DateTime.Now }; db.generate_testpaper_between_organizationuser_and_testpaper.Add(tmp); db.SaveChanges(); return(tp); }
public bool ArrangeTestGame(arrange_testgame_between_ordinaryuser_and_testpaper tg) { var result = db.arrange_testgame_between_ordinaryuser_and_testpaper.Where(p => p.StartTime <tg.StartTime && p.EndTime> tg.StartTime || (p.StartTime <= tg.EndTime && p.EndTime >= tg.EndTime)).FirstOrDefault(); if (result != null) //考试安排冲突 { return(false); } db.arrange_testgame_between_ordinaryuser_and_testpaper.Add(tg); db.SaveChanges(); return(true); }
public testpaper Add(testpaper tp) { tp = db.testpaper.Add(tp); db.SaveChanges(); return(tp); }
public ordinaryuser AddStu(ordinaryuser user) { user = db.ordinaryuser.Add(user); db.SaveChanges(); return(user); }
public board Add(board b) { b = db.board.Add(b); db.SaveChanges(); return(b); }
public letter_between_administrator_organizationuser Add(letter_between_administrator_organizationuser letter) { letter = db.letter_between_administrator_organizationuser.Add(letter); db.SaveChanges(); return(letter); }
public questionbank Add(questionbank qb) { qb = db.questionbank.Add(qb); db.SaveChanges(); return(qb); }
public trueorfalse Add1(int id, trueorfalse question) { // 向试题表里增加试题 question = db.trueorfalse.Add(question); include_question_between_bank_and_trueorfalse tmp = new include_question_between_bank_and_trueorfalse { BankID = id, QuestionID = question.ID }; // 向题库里增加试题 db.include_question_between_bank_and_trueorfalse.Add(tmp); db.SaveChanges(); return(question); }