public void SaveAnswers(oEEntiti SaveAnswers) { DataTable dtAnswer = null; DataRow drNew = null; SaveAnswers Answer = null; try { Answer = SaveAnswers as SaveAnswers; LoadXML(); dtAnswer = oeEntity.Tables[EntityConstents.TBL_ANSWERS]; if (Answer.EntityState == EntityOperationalState.New) { drNew = dtAnswer.NewRow(); drNew[EntityConstents.COL_ANSWERS_ID] = Guid.NewGuid().ToString(); dtAnswer.Rows.Add(drNew); } else { drNew = dtAnswer.AsEnumerable().Where(ans => ans.Field <string>("ID") == Answer.ID).SingleOrDefault(); } drNew[EntityConstents.COL_ANSWERS_ANSWER] = Answer.Answerr; drNew[EntityConstents.COL_ANSWERS_QUESTION] = Answer.QuestionID; drNew[EntityConstents.COL_ANSWERS_ORDER] = Answer.AnswerOrder; drNew[EntityConstents.COL_ANSWERS_VALUE] = Answer.Value; saveXML(oeEntity); } catch { throw; } }
public void SaveQuestionRelation(oEEntiti SaveQuestionR) { DataTable dtQuestionR = null; DataRow drNew = null; SaveQuestionRelation saveQuestionR = null; try { LoadXML(); saveQuestionR = SaveQuestionR as SaveQuestionRelation; dtQuestionR = oeEntity.Tables[EntityConstents.TBL_QUESTIONS_REL]; if (saveQuestionR.EntityState == EntityOperationalState.New) { drNew = dtQuestionR.NewRow(); dtQuestionR.Rows.Add(drNew); drNew[EntityConstents.COL_QUESTIONS_REL_ID] = Guid.NewGuid().ToString(); } else { drNew = dtQuestionR.AsEnumerable().Where(ans => ans.Field <string>("ID") == saveQuestionR.ID).SingleOrDefault(); } //drNew[EntityConstents.COL_QUESTIONS_REL_GROUPTYPE] = saveQuestionR.GroupTypeID; drNew[EntityConstents.COL_QUESTIONS_REL_TOPICTYPE] = saveQuestionR.TopicTypeID; drNew[EntityConstents.COL_QUESTIONS_REL_QUSID] = saveQuestionR.QuestionID; saveXML(oeEntity); } catch { } }
public void AddQuestion(oEEntiti QuestionRelationEntity) { DataTable dtQuestion = null; DataRow drNew = null; Question Question = null; QuestionRelation QuestionR = null; try { QuestionR = QuestionRelationEntity as QuestionRelation; Question = QuestionR.Questionn; if (QuestionR.EntityState != EntityOperationalState.None) { AddQuestionRelation(QuestionR); } if (Question.EntityState != EntityOperationalState.None) { LoadXML(); dtQuestion = oeEntity.Tables[EntityConstents.TBL_QUESTIONS]; if (Question.EntityState == EntityOperationalState.New) { drNew = dtQuestion.NewRow(); dtQuestion.Rows.Add(drNew); drNew[EntityConstents.COL_QUESTIONS_ID] = Guid.NewGuid().ToString(); } else { drNew = dtQuestion.AsEnumerable().Where(ans => ans.Field <string>("ID") == Question.ID).SingleOrDefault(); } drNew[EntityConstents.COL_QUESTIONS_QUESTION] = Question.Questionn; drNew[EntityConstents.COL_QUESTIONS_LEVEL] = Question.ComplexLevel; drNew[EntityConstents.COL_QUESTIONS_POINT] = Question.Point; drNew[EntityConstents.COL_QUESTIONS_QUESTIONMODE] = Question.QuestionMode.ID; saveXML(oeEntity); } } catch { } }
public string SaveQuestion(oEEntiti SaveQuestion) { DataTable dtQuestion = null; DataRow drNew = null; SaveQuestion saveQuestion = null; string questionID = string.Empty; try { saveQuestion = SaveQuestion as SaveQuestion; LoadXML(); dtQuestion = oeEntity.Tables[EntityConstents.TBL_QUESTIONS]; if (saveQuestion.EntityState == EntityOperationalState.New) { drNew = dtQuestion.NewRow(); questionID = Guid.NewGuid().ToString(); drNew[EntityConstents.COL_QUESTIONS_ID] = questionID; dtQuestion.Rows.Add(drNew); } else { questionID = saveQuestion.ID; drNew = dtQuestion.AsEnumerable().Where(ans => ans.Field <string>("ID") == saveQuestion.ID).SingleOrDefault(); } if (drNew != null) { drNew[EntityConstents.COL_QUESTIONS_QUESTION] = saveQuestion.Questionn; drNew[EntityConstents.COL_QUESTIONS_LEVEL] = saveQuestion.ComplexLevel; drNew[EntityConstents.COL_QUESTIONS_POINT] = saveQuestion.Point; saveXML(oeEntity); } } catch { throw; } return(questionID); }
private void AddQuestionRelation(oEEntiti QuestionRelation) { DataTable dtQuestionRelation = null; DataRow drNew = null; QuestionRelation QuestionR = null; try { LoadXML(); dtQuestionRelation = oeEntity.Tables[EntityConstents.TBL_QUESTIONS_REL]; QuestionR = QuestionRelation as QuestionRelation; if (QuestionR.EntityState != EntityOperationalState.None) { if (QuestionR.EntityState == EntityOperationalState.New) { drNew = dtQuestionRelation.NewRow(); dtQuestionRelation.Rows.Add(drNew); drNew[EntityConstents.COL_QUESTIONS_ID] = Guid.NewGuid().ToString(); } else { drNew = dtQuestionRelation.AsEnumerable().Where(ans => ans.Field <string>("ID") == QuestionR.ID).SingleOrDefault(); } //drNew[EntityConstents.COL_QUESTIONS_REL_GROUPTYPE] = QuestionR.GroupType.ID; drNew[EntityConstents.COL_QUESTIONS_REL_TOPICTYPE] = QuestionR.TopicType.ID; drNew[EntityConstents.COL_QUESTIONS_REL_QUSID] = QuestionR.Questionn.ID; saveXML(oeEntity); } } catch { throw; } }
public void AddParticipant(oEEntiti Participant) { DataTable dtParticipant = null; DataTable dtParticipantAssesment = null; DataRow drNew = null; DataRow drNewPartiAss = null; List <DataRow> drParticepentColl = null; //Participant participant = null; ParticeipentInfo particeipentInfo = null; string participentID = string.Empty; try { particeipentInfo = Participant as ParticeipentInfo; LoadXML(); dtParticipant = oeEntity.Tables[EntityConstents.TBL_PARTICIPANT]; dtParticipantAssesment = oeEntity.Tables[EntityConstents.TBL_PARTICIPANTASSESMENT]; if (particeipentInfo.EntityState == EntityOperationalState.New) { drNew = dtParticipant.NewRow(); participentID = Guid.NewGuid().ToString(); drNew[EntityConstents.COL_PARTICIPANT_ID] = participentID; dtParticipant.Rows.Add(drNew); } else { participentID = particeipentInfo.ID; drNew = dtParticipant.AsEnumerable().Where(ans => ans.Field <string>("ID") == particeipentInfo.ID).SingleOrDefault(); } drNew[EntityConstents.COL_PARTICIPANT_CODE] = particeipentInfo.Code; drNew[EntityConstents.COL_PARTICIPANT_NAME] = particeipentInfo.Name; drNew[EntityConstents.COL_PARTICIPANT_ACTIVE] = particeipentInfo.Active; drNew[EntityConstents.COL_PARTICIPANT_EMAIL] = particeipentInfo.Email; drNew[EntityConstents.COL_PARTICIPANT_GENDER] = particeipentInfo.Gender; drNew[EntityConstents.COL_PARTICIPANT_REMARKS] = particeipentInfo.Remarks; if (particeipentInfo.ParticeipentAssesmentEntityState == EntityOperationalState.New || particeipentInfo.ParticeipentAssesmentEntityState == EntityOperationalState.Update) { if (particeipentInfo.ParticeipentAssesmentEntityState == EntityOperationalState.Update) { drParticepentColl = dtParticipantAssesment.AsEnumerable().Where(partiass => partiass.Field <string>("Fk_Participant") == participentID).ToList(); if (drParticepentColl != null && drParticepentColl.Count > 0) { for (int cnt = drParticepentColl.Count; cnt >= 0; cnt--) { dtParticipantAssesment.Rows.Remove(drParticepentColl[cnt]); } } } foreach (string qbID in particeipentInfo.QBIds) { drNewPartiAss = dtParticipantAssesment.NewRow(); drNewPartiAss[EntityConstents.COL_PARTICIPANTASSESMENT_ID] = Guid.NewGuid().ToString(); drNewPartiAss[EntityConstents.COL_PARTICIPANTASSESMENT_QUESTIONBANK] = qbID; drNewPartiAss[EntityConstents.COL_PARTICIPANTASSESMENT_PARTICIPANT] = participentID; dtParticipantAssesment.Rows.Add(drNewPartiAss); } } saveXML(oeEntity); } catch { throw; } }
public void AddQuestionBank(oEEntiti Qbinfo) { DataTable dtQuestionBank = null; DataTable dtQBQuestions = null; DataRow drNewQB = null; DataRow drNewQBRel = null; List <DataRow> drNewQBRelColl = null; QBInfo qbinfo = null; string qbID = string.Empty; try { qbinfo = Qbinfo as QBInfo; LoadXML(); dtQuestionBank = oeEntity.Tables[EntityConstents.TBL_QUESTIONSBANK]; dtQBQuestions = oeEntity.Tables[EntityConstents.TBL_QUESTIONSBANK_QUES]; if (qbinfo.EntityState == EntityOperationalState.New) { drNewQB = dtQuestionBank.NewRow(); drNewQB[EntityConstents.COL_QUESTIONSBANK_ID] = Guid.NewGuid().ToString(); } else { drNewQB = dtQuestionBank.AsEnumerable().Where(ans => ans.Field <string>("ID") == qbinfo.ID).SingleOrDefault(); } qbID = drNewQB[EntityConstents.COL_QUESTIONSBANK_ID].ToString(); drNewQB[EntityConstents.COL_QUESTIONSBANK_EXAMNAME] = qbinfo.QBName; drNewQB[EntityConstents.COL_QUESTIONSBANK_REMARKS] = qbinfo.Remarks; if (qbinfo.EntityState == EntityOperationalState.New) { dtQuestionBank.Rows.Add(drNewQB); } if (qbinfo.QBQuestionsEntityState == EntityOperationalState.New || qbinfo.QBQuestionsEntityState == EntityOperationalState.Update) { if (qbinfo.QBQuestionsEntityState == EntityOperationalState.Update) { drNewQBRelColl = dtQBQuestions.AsEnumerable().Where(ans => ans.Field <string>("Fk_Question_Bank") == qbID).ToList(); if (drNewQBRelColl != null && drNewQBRelColl.Count > 0) { for (int cnt = drNewQBRelColl.Count - 1; cnt >= 0; cnt--) { dtQBQuestions.Rows.Remove(drNewQBRelColl[cnt]); } } } foreach (QBQuestions qbq in qbinfo.QBQuestions) { drNewQBRel = dtQBQuestions.NewRow(); drNewQBRel[EntityConstents.COL_QUESTIONSBANK_QUES_ID] = Guid.NewGuid().ToString(); drNewQBRel[EntityConstents.COL_QUESTIONSBANK_QUES_REL_ID] = qbq.Question_Rel_ID; drNewQBRel[EntityConstents.COL_QUESTIONSBANK_QUES_BANK_ID] = qbID; drNewQBRel[EntityConstents.COL_QUESTIONSBANK_QUES_ORDER] = qbq.Order; dtQBQuestions.Rows.Add(drNewQBRel); } } saveXML(oeEntity); } catch { throw; } }