public bool InsertResult(QuestionsModel Res) { try { if (_VoitingBaseDataContext.QuestAnswers.Where(a => a.EmpId == Res.Empl.Id && a.AnketaId == AnketaId).Count() > 0) { return(true); } foreach (CQuestion Q in Res.Questions) { QuestAnswers Qa = new QuestAnswers() { //AnketaId = Res.AnketaId, AnketaId = AnketaId, EmpDepNum = Res.Empl.DepId, AnswerDate = DateTime.Now, EmpDepPos = Res.Empl.PosId, EmpId = Res.Empl.Id, QuestionId = Q.QId, Result = Q.Result, Ip = Res.IpAddress, CompName = Res.CompName, Agent = Res.UserAgent }; _VoitingBaseDataContext.QuestAnswers.InsertOnSubmit(Qa); } _VoitingBaseDataContext.SubmitChanges(); return(true); } catch { return(false); } }
partial void DeleteQuestAnswers(QuestAnswers instance);
partial void UpdateQuestAnswers(QuestAnswers instance);
partial void InsertQuestAnswers(QuestAnswers instance);
private void detach_QuestAnswers(QuestAnswers entity) { this.SendPropertyChanging(); entity.QuestQuestions = null; }
private void attach_QuestAnswers(QuestAnswers entity) { this.SendPropertyChanging(); entity.QuestAnketa = this; }