Beispiel #1
0
        public void Save(DataSet ds, DbTransaction transaction)
        {
            DataRow            drCourse          = ds.Tables[Entities.Course.TABLE_NAME].Rows[0];
            DACourse           oDACourse         = new DACourse();
            DACourseMaterial   oDACourseMaterial = new DACourseMaterial();
            DACultureResources oDACr             = new DACultureResources();

            //Saving culture resources for Course name:Start

            DataTable dtCourseCr = ds.Tables[Entities.CultureResources.TABLE_NAME];

            oDACr.PersistCultureResource(dtCourseCr, transaction);
            drCourse[Entities.Course.COURSE_NAME] = (Int64)dtCourseCr.Rows[0][Entities.CultureResources.ID];

            //Saving culture resources for Course name:Finish


            //Saving culture resources for Course desc:Start

            DataTable dtCourseDescCr = ds.Tables[Enumaration.ManageCourseKeys.DT_CourseDescriptionCultureRes];

            oDACr.PersistCultureResource(dtCourseDescCr, transaction);
            drCourse[Entities.Course.DESCRIPTION] = (Int64)dtCourseDescCr.Rows[0][Entities.CultureResources.ID];

            //Saving culture resources for Course desc:Finish

            //Saving culture resources for Course Icon:Start

            DataTable dtCourseIconCr = ds.Tables[Enumaration.ManageCourseKeys.DT_CourseFileUploadCultureRes];

            oDACr.PersistCultureResource(dtCourseIconCr, transaction);
            drCourse[Entities.Course.ICON] = (Int64)dtCourseIconCr.Rows[0][Entities.CultureResources.ID];

            //Saving culture resources for Course Icon:Finish


            //Saving Course Start

            oDACourse.SaveCourse(transaction, drCourse);
            string courseId = drCourse[Entities.Course.COURSE_ID].ToString();
            //Saving Course Finish
            //Saving Course Material Start

            DataTable dtCourseMaterial = ds.Tables[Entities.CourseMaterial.TABLE_NAME];

            oDACourseMaterial.DeleteCourseMaterialForCourseId(transaction, courseId);
            foreach (DataRow row in dtCourseMaterial.Rows)
            {
                row[Entities.CourseMaterial.COURSE_MATERIAL_ID] = DBNull.Value;
                row[Entities.CourseMaterial.COURSE_ID]          = int.Parse(courseId);
                oDACourseMaterial.SaveCourseMaterial(transaction, row);
            }

            //Saving Course Material  Finish
        }
Beispiel #2
0
        public void Save(DataSet ds)
        {
            objDARooms = new DATrainingRooms();
            DACultureResources oDACr = new DACultureResources();

            using (DbTransaction transaction = objDARooms.CreateTransaction())
            {
                try
                {
                    DataTable dtRoom = ds.Tables[Entities.TrainingRooms.TABLE_NAME];
                    DataRow   room   = dtRoom.Rows[0];

                    //Saving culture resources for slide name:Start

                    DataTable dtCr = ds.Tables[Entities.CultureResources.TABLE_NAME];
                    oDACr.PersistCultureResource(dtCr, transaction);
                    room[Entities.TrainingRooms.ROOM_NAME] = (Int64)dtCr.Rows[0][Entities.CultureResources.ID];

                    //Saving culture resources for slide name:Finish

                    objDARooms.Save(transaction, room);
                    objDARooms.CommitTransaction(transaction);
                }
                catch (Exception e)
                {
                    objDARooms.RollbackTransaction(transaction);
                    throw e;
                }
            }
        }
Beispiel #3
0
        private static void SaveSurveyChoices(DataSet ds, DbTransaction transaction, DACultureResources oDACr, Int64 slideId)
        {
            DASurveyChoices oDACat   = new DASurveyChoices();
            DataTable       dtChoice = ds.Tables[Entities.SlideSurveyChoices.TABLE_NAME];

            foreach (DataRow dr in dtChoice.Rows)
            {
                if (!dr[Entities.SlideSurveyChoices.IS_CHANGED].ToString().Equals("1") &&
                    !dr[Entities.SlideSurveyChoices.IS_NEW].ToString().Equals("1") &&
                    !dr[Entities.SlideSurveyChoices.IS_DELETED].ToString().Equals("1"))
                {
                    continue;
                }
                DataTable dtCulture = Entities.CultureResources.GetDataTable();
                DataRow   row       = dtCulture.NewRow();
                foreach (DataColumn col in dtCulture.Columns)
                {
                    if (dtChoice.Columns.Contains(col.ColumnName))
                    {
                        row[col.ColumnName] = dr[col.ColumnName];
                    }
                }
                row[Entities.CultureResources.ID] = dr[Entities.SlideSurveyChoices.CHOICE_TEXT];
                oDACr.PersistCultureResource(row, transaction);
                if (dr[Entities.SlideSurveyChoices.IS_NEW].ToString().Equals("1"))
                {
                    dr[Entities.SlideSurveyChoices.CHOICE_TEXT] = row[Entities.CultureResources.ID];
                    dr[Entities.SlideSurveyChoices.SLIDE_ID]    = slideId;
                    dr[Entities.SlideSurveyChoices.CHOICE_ID]   = DBNull.Value;
                }
                oDACat.Save(transaction, dr);
            }
        }
Beispiel #4
0
        private void SaveSurveyCategories(DataSet ds, DbTransaction transaction, DACultureResources oDACr, Int64 slideId)
        {
            DASlideSurveyCategory oDACat     = new DASlideSurveyCategory();
            DataTable             dtCategory = ds.Tables[Entities.SlideSurveyCategory.TABLE_NAME];

            foreach (DataRow dr in dtCategory.Rows)
            {
                if (!dr[Entities.SlideSurveyCategory.IS_CHANGED].ToString().Equals("1") &&
                    !dr[Entities.SlideSurveyCategory.IS_NEW].ToString().Equals("1") &&
                    !dr[Entities.SlideSurveyCategory.IS_DELETED].ToString().Equals("1")
                    )
                {
                    continue;
                }
                DataTable dtCategoryCulture = Entities.CultureResources.GetDataTable();
                DataRow   row = dtCategoryCulture.NewRow();
                foreach (DataColumn col in dtCategoryCulture.Columns)
                {
                    if (dtCategory.Columns.Contains(col.ColumnName))
                    {
                        row[col.ColumnName] = dr[col.ColumnName];
                    }
                }
                row[Entities.CultureResources.ID] = dr[Entities.SlideSurveyCategory.CATEGORY_TEXT];
                int tempCategoryId = -1;
                oDACr.PersistCultureResource(row, transaction);
                if (dr[Entities.SlideSurveyCategory.IS_NEW].ToString().Equals("1"))
                {
                    dr[Entities.SlideSurveyCategory.CATEGORY_TEXT] = row[Entities.CultureResources.ID];
                    dr[Entities.SlideSurveyCategory.SLIDE_ID]      = slideId;
                    tempCategoryId = Convert.ToInt32(dr[Entities.SlideSurveyCategory.CATEGORY_ID]);

                    dr[Entities.SlideSurveyCategory.CATEGORY_ID] = DBNull.Value;
                }
                oDACat.Save(transaction, dr);
                //adding for the first time we assign a temp id to category. If this category has been associated with the survey question then we
                //have to remove the temp id from survey question and assign the db id to it.For this purpose we are storing temp id in dictionary along
                //with the db id.Later on adding survey questions we will retrieve the db id from this dictionary and change the temp id of question category
                if (tempCategoryId > 0)
                {
                    dicCategoryTempActualId.Add(tempCategoryId,
                                                Convert.ToInt32(dr[Entities.SlideSurveyCategory.CATEGORY_ID])
                                                );
                }
            }
        }
Beispiel #5
0
 private static void PersistSlideCultureText(DbTransaction transaction, DataRow drSlide, DACultureResources oDACr, DataTable dtSlideCr)
 {
     foreach (DataRow row in dtSlideCr.Rows)
     {
         string id = row[Entities.CultureResources.ID].ToString();
         if (row[Entities.CultureResources.IS_NEW] != DBNull.Value &&
             row[Entities.CultureResources.IS_NEW].ToString().Equals("1")
             )
         {
             row[Entities.CultureResources.ID] = DBNull.Value;
         }
         oDACr.PersistCultureResource(row, transaction);
         if (drSlide[Entities.TrainingSlide.SLIDE_NAME].ToString().Equals(id))
         {
             drSlide[Entities.TrainingSlide.SLIDE_NAME] = Convert.ToInt64(row[Entities.CultureResources.ID]);
         }
         else if (drSlide[Entities.TrainingSlide.DESCRIPTION].ToString().Equals(id))
         {
             drSlide[Entities.TrainingSlide.DESCRIPTION] = Convert.ToInt64(row[Entities.CultureResources.ID]);
         }
     }
 }
Beispiel #6
0
        private void SaveSurveyQuestions(DataSet ds, DbTransaction transaction, DACultureResources oDACr, Int64 slideId)
        {
            DASurveyQuestion oDA = new DASurveyQuestion();
            DataTable        dtSurveyQuestion = ds.Tables[Entities.SlideSurveyQuestions.TABLE_NAME];

            foreach (DataRow dr in dtSurveyQuestion.Rows)
            {
                //Only persist those rows that are new or changed
                if (!dr[Entities.SlideSurveyQuestions.IS_CHANGED].ToString().Equals("1") &&
                    !dr[Entities.SlideSurveyQuestions.IS_NEW].ToString().Equals("1") &&
                    !dr[Entities.SlideSurveyQuestions.IS_DELETED].ToString().Equals("1"))
                {
                    continue;
                }
                DataTable dtQuestionCulture = Entities.CultureResources.GetDataTable();
                DataRow   row = dtQuestionCulture.NewRow();
                foreach (DataColumn col in dtQuestionCulture.Columns)
                {
                    if (dtSurveyQuestion.Columns.Contains(col.ColumnName))
                    {
                        row[col.ColumnName] = dr[col.ColumnName];
                    }
                }
                row[Entities.CultureResources.ID] = dr[Entities.SlideSurveyQuestions.SURVEY_QUESTION_TEXT];
                oDACr.PersistCultureResource(row, transaction);
                int id = Convert.ToInt32(dr[Entities.SlideSurveyQuestions.CATEGORY_ID]);
                if (dr[Entities.SlideSurveyQuestions.IS_NEW].ToString().Equals("1"))
                {
                    dr[Entities.SlideSurveyQuestions.SURVEY_QUESTION_TEXT] = row[Entities.CultureResources.ID];
                    dr[Entities.SlideSurveyQuestions.SLIDE_ID]             = slideId;
                    dr[Entities.SlideSurveyQuestions.SURVEY_QUESTION_ID]   = DBNull.Value;
                }
                if (dicCategoryTempActualId.ContainsKey(id))
                {
                    dr[Entities.SlideSurveyQuestions.CATEGORY_ID] = dicCategoryTempActualId[id];
                }
                oDA.Save(transaction, dr);
            }
        }
Beispiel #7
0
        private void SaveSlideFiles(DataSet ds, DbTransaction transaction, DataRow drSlide, DACultureResources oDACr)
        {
            DataTable dtSlideFileUpload = ds.Tables[Enumaration.ManageSlideKeys.DT_SlideFileUploadCultureRes];

            foreach (DataRow dr in dtSlideFileUpload.Rows)
            {
                oDACr.PersistCultureResource(dr, transaction);
                switch (dr[Entities.CultureResources.TYPE].ToString())
                {
                case "1":
                    drSlide[Entities.TrainingSlide.ANIMATION_ID] = dr[Entities.CultureResources.ID];
                    break;

                case "2":
                    drSlide[Entities.TrainingSlide.AUDIO_ID] = dr[Entities.CultureResources.ID];
                    break;

                case "3":
                    drSlide[Entities.TrainingSlide.IMAGE_ID] = dr[Entities.CultureResources.ID];
                    break;
                }
            }
        }
Beispiel #8
0
        public void PersistExamTemplate(DataSet ds)
        {
            DAExamTemplate     daET = new DAExamTemplate();
            DACultureResources daCR = new DACultureResources();

            using (DbTransaction transaction = daET.CreateTransaction())
            {
                try
                {
                    DataTable dtCR  = ds.Tables[Entities.CultureResources.TABLE_NAME];
                    DataTable dtET  = ds.Tables[Entities.TestTemplate.TABLE_NAME];
                    DataTable dtSWQ = ds.Tables[Entities.TestTemplateSectionWiseQuestions.TABLE_NAME];
                    daCR.PersistCultureResource(dtCR, transaction);
                    dtET.Rows[0][Entities.TestTemplate.CULTURE_NAME] = (Int64)dtCR.Rows[0][Entities.CultureResources.ID];
                    daET.PersistExamTemplates(dtET, dtSWQ, transaction);
                    daET.CommitTransaction(transaction);
                }
                catch (Exception e)
                {
                    daET.RollbackTransaction(transaction);
                    throw e;
                }
            }
        }
Beispiel #9
0
        public void PersistQuestionSections(DataSet ds)
        {
            DAQuestionSections daQS = new DAQuestionSections();
            DACultureResources daCR = new DACultureResources();

            using (DbTransaction transaction = daQS.CreateTransaction())
            {
                try
                {
                    DataTable dtCR = ds.Tables[Entities.CultureResources.TABLE_NAME];
                    DataTable dtQS = ds.Tables[Entities.QuestionSections.TABLE_NAME];

                    daCR.PersistCultureResource(dtCR, transaction);
                    dtQS.Rows[0][Entities.QuestionSections.SECTION_NAME] = (Int64)dtCR.Rows[0][Entities.CultureResources.ID];
                    daQS.PersistQuestionSections(dtQS, transaction);
                    daQS.CommitTransaction(transaction);
                }
                catch (Exception e)
                {
                    daQS.RollbackTransaction(transaction);
                    throw e;
                }
            }
        }
Beispiel #10
0
        public void Save(DataSet ds)
        {
            DACultureResources oDACr = new DACultureResources();
            DataRow            drTrainingTemplate = null;

            using (System.Data.Common.DbTransaction transaction = oDACr.CreateTransaction())
            {
                try
                {
                    drTrainingTemplate = ds.Tables[Entities.TrainingTemplate.TABLE_NAME].Rows[0];
                    DATrainingTemplate          oDATrainingTemplate = new DATrainingTemplate();
                    DATrainingTempFinesOnAbsent oDAFines            = new DATrainingTempFinesOnAbsent();
                    DATrainingTemplatePlan      oDAPlan             = new DATrainingTemplatePlan();


                    //Saving culture resources for TrainingTemplate desc:Start

                    DataTable dtTrainingTemplateDescCr = ds.Tables[Enumaration.ManageTrainingTemplateKeys.DT_TrainingTemplateDescriptionCultureRes];

                    oDACr.PersistCultureResource(dtTrainingTemplateDescCr, transaction);
                    drTrainingTemplate[Entities.TrainingTemplate.DESCRIPTION] = (Int64)dtTrainingTemplateDescCr.Rows[0][Entities.CultureResources.ID];

                    //Saving culture resources for TrainingTemplate desc:Finish

                    //Saving culture resources for TrainingTemplate name:Start

                    DataTable dtTrainingTemplateNameCr = ds.Tables[Enumaration.ManageTrainingTemplateKeys.DT_TrainingTemplateNameCultureRes];

                    oDACr.PersistCultureResource(dtTrainingTemplateNameCr, transaction);
                    drTrainingTemplate[Entities.TrainingTemplate.TRAINING_NAME] = (Int64)dtTrainingTemplateNameCr.Rows[0][Entities.CultureResources.ID];

                    //Saving culture resources for TrainingTemplate name:Finish


                    //Saving TrainingTemplate Start

                    oDATrainingTemplate.SaveTrainingTemplate(transaction, drTrainingTemplate);
                    string TrainingTemplateId = drTrainingTemplate[Entities.TrainingTemplate.TRAINING_TEMP_ID].ToString();
                    //Saving TrainingTemplate Finish

                    //Saving TrainingTemplate Fine Start

                    DataTable dtTrainingTemplateMaterial = ds.Tables[Entities.TrainingTempFinesOnAbsent.TABLE_NAME];
                    oDAFines.DeleteTrainingTempFinesOnAbsentForTrainingTempId(transaction, TrainingTemplateId);
                    foreach (DataRow row in dtTrainingTemplateMaterial.Rows)
                    {
                        row[Entities.TrainingTempFinesOnAbsent.TEMP_FINES_ABSENT_ID] = DBNull.Value;
                        row[Entities.TrainingTempFinesOnAbsent.TRAINING_TEMP_ID]     = int.Parse(TrainingTemplateId);
                        oDAFines.SaveFinesOnAbsent(transaction, row);
                    }

                    //Saving TrainingTemplate Fine Finish

                    //Saving TrainingTemplate Plan Start

                    DataTable dtPlan = ds.Tables[Entities.TrainingTemplatePlan.TABLE_NAME];
                    oDAPlan.DeleteTrainingTemplatePlanForTrainingTempId(transaction, TrainingTemplateId);
                    foreach (DataRow row in dtPlan.Rows)
                    {
                        row[Entities.TrainingTemplatePlan.TEMPLATE_PLAN_ID] = DBNull.Value;
                        row[Entities.TrainingTemplatePlan.TRAINING_TEMP_ID] = int.Parse(TrainingTemplateId);
                        oDAPlan.SavePlan(transaction, row);
                    }

                    //Saving TrainingTemplate Plan  Finish

                    oDACr.CommitTransaction(transaction);
                }

                catch (Exception ex)
                {
                    oDACr.RollbackTransaction(transaction);
                    throw ex;
                }
            }
            if (drTrainingTemplate != null)
            {
                PersistTrainingXML(drTrainingTemplate);
            }
        }
Beispiel #11
0
        private void SaveNavigationDetails(DataSet ds, DbTransaction transaction, DACultureResources oDACr, Int64 slideId)
        {
            DataTable dtChoice = ds.Tables[Entities.SlideNavigation.TABLE_NAME];
            DataTable dtCR     = ds.Tables[Enumaration.ManageSlideKeys.DT_SlideNavigationCultureRes];
            DataTable dtLinks  = ds.Tables[Entities.SlideNavigationLinks.TABLE_NAME];
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            foreach (DataRow dr in dtCR.Rows)
            {
                string key = string.Empty;
                key = dr[Entities.CultureResources.ID].ToString();
                if (dr[Entities.CultureResources.IS_NEW].ToString().Equals("1"))
                {
                    //key = dr[Entities.CultureResources.ID].ToString();
                    dr[Entities.CultureResources.ID] = DBNull.Value;
                }
                oDACr.PersistCultureResource(dr, transaction);
                //if (dr[Entities.CultureResources.IS_NEW].ToString().Equals("1"))
                //{
                dictionary.Add(key, dr[Entities.CultureResources.ID].ToString());
                //}
            }

            DASlideNavigation oDA      = new DASlideNavigation();
            DASlideNavLinks   oDALinks = new DASlideNavLinks();

            foreach (DataRow dr in dtChoice.Rows)
            {
                string navigationChoiceId = string.Empty;
                bool   isNewOrChanged     = (dr[Entities.SlideNavigation.IS_NEW].ToString().Equals("1") ||
                                             dr[Entities.SlideNavigation.IS_CHANGED].ToString().Equals("1")
                                             );
                bool   isIncompleteAddition  = dr[Entities.SlideNavigation.IS_ADDING].ToString().Equals("1");
                string oldNavigationChoiceId = string.Empty;
                if (isNewOrChanged && !isIncompleteAddition)
                {
                    if (dr[Entities.SlideNavigation.IS_NEW].ToString().Equals("1"))
                    {
                        oldNavigationChoiceId = dr[Entities.SlideNavigation.NAVIGATION_CHOICE_ID].ToString();
                        dr[Entities.SlideNavigation.NAVIGATION_CHOICE_ID] = DBNull.Value;
                        dr[Entities.SlideNavigation.SLIDE_ID]             = slideId;
                    }
                    else
                    {
                        oldNavigationChoiceId = dr[Entities.SlideNavigation.NAVIGATION_CHOICE_ID].ToString();
                    }

                    if (dictionary.ContainsKey(dr[Entities.SlideNavigation.TITLE].ToString()))
                    {
                        dr[Entities.SlideNavigation.TITLE] = Convert.ToInt64(dictionary[dr[Entities.SlideNavigation.TITLE].ToString()]);
                    }
                    if (dictionary.ContainsKey(dr[Entities.SlideNavigation.AUDIO].ToString()))
                    {
                        dr[Entities.SlideNavigation.AUDIO] = Convert.ToInt64(dictionary[dr[Entities.SlideNavigation.AUDIO].ToString()]);
                    }
                    else
                    {
                        dr[Entities.SlideNavigation.AUDIO] = DBNull.Value;
                    }
                    if (dictionary.ContainsKey(dr[Entities.SlideNavigation.DESCRIPTION].ToString()))
                    {
                        dr[Entities.SlideNavigation.DESCRIPTION] = Convert.ToInt64(dictionary[dr[Entities.SlideNavigation.DESCRIPTION].ToString()]);
                    }
                    else
                    {
                        dr[Entities.SlideNavigation.DESCRIPTION] = DBNull.Value;
                    }
                    if (dictionary.ContainsKey(dr[Entities.SlideNavigation.IMAGE].ToString()))
                    {
                        dr[Entities.SlideNavigation.IMAGE] = Convert.ToInt64(dictionary[dr[Entities.SlideNavigation.IMAGE].ToString()]);
                    }
                    else
                    {
                        dr[Entities.SlideNavigation.IMAGE] = DBNull.Value;
                    }
                    if (dictionary.ContainsKey(dr[Entities.SlideNavigation.VIDEO].ToString()))
                    {
                        dr[Entities.SlideNavigation.VIDEO] = Convert.ToInt64(dictionary[dr[Entities.SlideNavigation.VIDEO].ToString()]);
                    }
                    else
                    {
                        dr[Entities.SlideNavigation.VIDEO] = DBNull.Value;
                    }
                    oDA.Save(transaction, dr);
                    navigationChoiceId = dr[Entities.SlideNavigation.NAVIGATION_CHOICE_ID].ToString();
                    DataRow[] links = dtLinks.Select(Entities.SlideNavigationLinks.NAVIGATION_CHOICE_ID + "=" + oldNavigationChoiceId);
                    foreach (DataRow link in links)
                    {
                        isNewOrChanged = (link[Entities.SlideNavigationLinks.IS_NEW].ToString().Equals("1") ||
                                          link[Entities.SlideNavigationLinks.IS_CHANGED].ToString().Equals("1")
                                          );
                        isIncompleteAddition = link[Entities.SlideNavigationLinks.IS_ADDING].ToString().Equals("1");
                        if (isIncompleteAddition || !isNewOrChanged)
                        {
                            continue;
                        }
                        link[Entities.SlideNavigationLinks.NAVIGATION_CHOICE_ID] = Convert.ToInt64(navigationChoiceId);
                        if (dictionary.ContainsKey(link[Entities.SlideNavigationLinks.FILE_LINK].ToString()))
                        {
                            link[Entities.SlideNavigationLinks.FILE_LINK] = Convert.ToInt64(dictionary[link[Entities.SlideNavigationLinks.FILE_LINK].ToString()]);
                        }
                        else
                        {
                            link[Entities.SlideNavigationLinks.FILE_LINK] = DBNull.Value;
                        }
                        if (dictionary.ContainsKey(link[Entities.SlideNavigationLinks.DESCRIPTION].ToString()))
                        {
                            link[Entities.SlideNavigationLinks.DESCRIPTION] = Convert.ToInt64(dictionary[link[Entities.SlideNavigationLinks.DESCRIPTION].ToString()]);
                        }
                        else
                        {
                            link[Entities.SlideNavigationLinks.DESCRIPTION] = DBNull.Value;
                        }
                        oDALinks.Save(transaction, link);
                    }
                }
            }
        }
Beispiel #12
0
        public void Save(DataSet ds, DbTransaction transaction, Enumaration.PageMode pageMode)
        {
            DataSet            dataToSave = ds;
            DataRow            drQp       = ds.Tables[Entities.QuestionsPool.TABLE_NAME].Rows[0];
            DataTable          dtQpCatOne = null;
            DataTable          dtQpCatTwo = null;
            DAQuestionsPool    oDAQp      = new DAQuestionsPool();
            DACultureResources oDACr      = new DACultureResources();
            //Saving culture resources for questions:Start
            DataTable dtQpCr = ds.Tables[Enumaration.ManageQuestionKeys.DT_QuestionTextCultureRes];

            oDACr.PersistCultureResource(dtQpCr, transaction);

            //Saving culture resources for questions:Finish
            if (Convert.ToInt16(drQp[Entities.QuestionsPool.TYPE_ID]).Equals((int)Enumaration.QuestionType.Categorybased))
            {
                //Saving culture resources for CATEGORIES:Start
                dtQpCatOne = ds.Tables[Enumaration.ManageQuestionKeys.DT_QuestionCatOneCultureRes];
                oDACr.PersistCultureResource(dtQpCatOne, transaction);

                dtQpCatTwo = ds.Tables[Enumaration.ManageQuestionKeys.DT_QuestionCatTwoCultureRes];
                oDACr.PersistCultureResource(dtQpCatTwo, transaction);
            }
            //Saving culture resources for CATEGORIES:Finish
            //Saving questions Start


            drQp[Entities.QuestionsPool.QUESTION_TEXT] = (Int64)dtQpCr.Rows[0][Entities.CultureResources.ID];
            if (dtQpCatOne != null && dtQpCatTwo != null)
            {
                drQp[Entities.QuestionsPool.CATEGORY_ONE] = (Int64)dtQpCatOne.Rows[0][Entities.CultureResources.ID];
                drQp[Entities.QuestionsPool.CATEGORY_TWO] = (Int64)dtQpCatTwo.Rows[0][Entities.CultureResources.ID];
            }

            oDAQp.SaveQuestionsPool(transaction, drQp, pageMode);

            //Saving questions Finish

            DAAnswersPool ODaAp = new DAAnswersPool();

            DataRow[] answersToPersist = ds.Tables[Entities.AnswersPool.TABLE_NAME].Select(
                Entities.AnswersPool.IS_NEW + "   =1 OR " +
                Entities.AnswersPool.IS_CHANGED + "   =1 OR " +
                Entities.AnswersPool.IS_DELETED + "    =1   "

                );
            foreach (DataRow drAp in answersToPersist)
            {
                DataRow[] drApCrs = ds.Tables[Enumaration.ManageQuestionKeys.DT_AnswerTextCultureRes].
                                    Select(Entities.CultureResources.ID + "=" + drAp[Entities.AnswersPool.ANSWER_TEXT]);

                DataRow drApCr = drApCrs[0];
                if (drAp[Entities.AnswersPool.IS_NEW] != DBNull.Value && drAp[Entities.AnswersPool.IS_NEW].ToString().Equals("1"))
                {
                    drApCr[Entities.CultureResources.ID] = DBNull.Value;
                    drAp[Entities.AnswersPool.ID]        = DBNull.Value;
                }

                //Saving culture resources for answer:Start

                oDACr.PersistCultureResource(drApCr, transaction);

                //Saving culture resources for answer:Finish

                //Saving answers Start

                drAp[Entities.AnswersPool.QUESTION_ID] = (Int64)drQp[Entities.QuestionsPool.ID];
                drAp[Entities.AnswersPool.ANSWER_TEXT] = (Int64)drApCr[Entities.CultureResources.ID];

                if (drAp[Entities.AnswersPool.IS_NEW].Equals("1") && drAp[Entities.AnswersPool.TEMP_ID_FOR_IMAGE] != DBNull.Value)
                {
                    String tempIdWithImage = drAp[Entities.AnswersPool.TEMP_ID_FOR_IMAGE].ToString();
                    if (drQp.Table.Columns.Contains(Entities.QuestionsPool.TEMP_ID))
                    {
                        drAp[Entities.AnswersPool.TEMP_ID_FOR_IMAGE] = drQp[Entities.QuestionsPool.TEMP_ID].ToString() + "/" +
                                                                       drAp[Entities.AnswersPool.TEMP_ID_FOR_IMAGE].ToString();
                    }
                    else
                    {
                        drAp[Entities.AnswersPool.TEMP_ID_FOR_IMAGE] = drQp[Entities.QuestionsPool.ID].ToString() + "/" +
                                                                       drAp[Entities.AnswersPool.TEMP_ID_FOR_IMAGE].ToString();
                    }
                    ODaAp.SaveAnswers(transaction, drAp);
                    drAp[Entities.AnswersPool.TEMP_ID_FOR_IMAGE] = tempIdWithImage;
                }
                else
                {
                    ODaAp.SaveAnswers(transaction, drAp);
                }
                //Saving answers Finish
            }
            //Generate Questions XML It should be the last item int the function
            oDAQp.PersistXML(transaction, drQp[Entities.QuestionsPool.ID].ToString());
        }