Esempio n. 1
0
    private void BindGridQuestion()
    {
        int? getChaptersPerDay = 0;
        int lessonCompleted = 0;
        int iSkip = 0;
        string username = hdnusername.Value;

        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {
            var newuser = DataServiceWord.NewUser(username);
            if (newuser == 0)
            {
                imgPrevious.Visible = false;
                getChaptersPerDay = DataServiceWord.GetTopicsPerChapter(lessonCompleted + 1);
                iSkip = 0;
            }
            else
            {
                //skip sum coursemst topic and take nect lesson 
                //iSkip=
                //getChaptersPerDay

            }
            grdWord.DataSource = DataServiceWord.LoadChapters(getChaptersPerDay);
            grdWord.DataBind();
        }

    }
Esempio n. 2
0
 public static Int32 NewUser(string username)
 {
     Int32 result = 0;
     using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
     {
         result = db.Beg_WordResult.Where(x => x.Username == username).ToList().Count;
     }
     return result;
 }
Esempio n. 3
0
    public static int? GetTopicsPerChapter(Int32 lessoncompleted)
    {
        int? result = 0;
        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {

            result = db.Beg_WordCourse.Where(x => x.Lesson == lessoncompleted).Select(x => x.Topics).SingleOrDefault();
        }
        return result;
    }
Esempio n. 4
0
    public static int? GetNumQuestTaken(string username, int? getChaptersPerDay)
    {

        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {

            List<int?> result1 = db.Beg_WordUserTest.Where(x => x.Username == username).Select(x => x.BegWordTestId).ToList();
            List<int> result2 = db.Beg_WordTest.Select(x => x.Id).ToList();
            var differences = result2.Where(i => !result1.Contains(i)).ToList();
            int diff = differences[0];
            return diff;

        }

    }
Esempio n. 5
0
 public static List<LearningWord> LoadChapters(int? getchaptersperday)
 {
     List<LearningWord> resultList;
     using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
     {
         resultList = db.Beg_Word.Join(db.Beg_WordTranslate, x => x.Id, y => y.BegWordId, (x, y) => new { x, y })
                     .Join(db.Beg_WordFiles, a => a.x.Id, b => b.BegWordId, (a, b) => new { a, b })
                     .Take(Convert.ToInt32(getchaptersperday))
                     .Select(xy => new LearningWord()
                     {
                         BegPrId = xy.a.x.Id,
                         CapitalLetters = xy.a.x.Word,
                         Kannada = xy.a.y.Kannada,
                         Hindi = xy.a.y.Hindi,
                         Play = xy.b.Play
                     }).ToList();
     }
     return resultList;
 }
Esempio n. 6
0
    protected void OnClick_Next(object sender, EventArgs e)
    {
        //UpdateTimer.Enabled = true;
        int? getChaptersPerDay = 0;
        int? getNumQuestTaken = 0;
        int lessonCompleted = 0;
        int iSkip = 0;
        int i;
        ViewState["questnum"] = 0;
        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {
            var newuser = DataServiceWord.NewUser(hdnusername.Value);
            if (newuser == 0)
            {
                getChaptersPerDay = DataServiceWord.GetTopicsPerChapter(lessonCompleted + 1);
                getNumQuestTaken = DataServiceWord.GetNumQuestTaken(hdnusername.Value, getChaptersPerDay);
                ViewState["questnum"] = getNumQuestTaken;
                imgPrevious.Visible = false;

                iSkip = 0;
            }
            else
            {
                ViewState["questnum"] = Convert.ToInt32(ViewState["questnum"]) + 1;
                //skip sum coursemst topic and take nect lesson 
                //iSkip=
                //getChaptersPerDay

            }
            List<DataServiceWord.LearningQuiz> quest = DataServiceWord.LoadQuiz(Convert.ToInt32(ViewState["questnum"]));
            lblQuest.Text = quest[0].QuestionNum + "   " + quest[0].Question;
            hdnAn.Value = Convert.ToString(quest[0].An);
            hdnMainQuestid.Value = Convert.ToString(quest[0].BegPrId);
            hdnTestQuestid.Value = Convert.ToString(quest[0].IdTestquiz);
            hdnTestQuestDay.Value = Convert.ToString(quest[0].IdquizDay);
        }
        grdWord.Visible = false;
        BindGridQuiz(getChaptersPerDay, Convert.ToInt32(hdnMainQuestid.Value));
        btnsubmit.Visible = true;

    }
Esempio n. 7
0
    public static bool ResultPassorFail(string testday, string username)
    {
        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {

            bool res = false;
            var results = db.Beg_WordUserTest.AsNoTracking().Where(x => x.Day == testday && x.Username == username).ToList();

            foreach (var result in results)
            {
                if (result.Answer == result.Question)
                {
                    res = true;
                }
                else
                {
                    res = false;
                    break;
                }
            }
            return res;
        }

    }
Esempio n. 8
0
    public static bool SendBacktoSameCourse(string testday, string username)
    {
        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {
            using (var trans = db.Database.BeginTransaction(IsolationLevel.ReadUncommitted))
            {
                try
                {
                    var removeusertest = db.Beg_WordUserTest.Where(x => x.Username == username && x.Day == testday).ToList();
                    db.Beg_WordUserTest.RemoveRange(removeusertest);
                    db.SaveChanges();
                    trans.Commit();

                    return false;
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw;
                }
            }
        }

    }
Esempio n. 9
0
 public static int GetquestAnswered(string testid, string username)
 {
     int? result;
     using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
     {
         result =
             db.Beg_WordUserTest.AsNoTracking()
                 .Where(x => x.Username == username && x.Day == testid.ToString())
                 .ToList()
                 .Count();
     }
     return result.GetValueOrDefault();
 }
Esempio n. 10
0
 public static int GetCoursemst(int testid)
 {
     int? result;
     using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
     {
         //var getquestioninfo = db.Beg_Test.SingleOrDefault(x => x.Id == testid);
         result = db.Beg_WordCourse.AsNoTracking().Where(x => x.Lesson == testid).Select(x => x.Topics).SingleOrDefault();
     }
     return result.GetValueOrDefault();
 }
Esempio n. 11
0
    public static void AnswerGiven(int testid, string username, int begid)
    {
        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {
            using (var trans = db.Database.BeginTransaction(IsolationLevel.ReadUncommitted))
            {
                try
                {
                    var getquestioninfo = db.Beg_WordTest.SingleOrDefault(x => x.Id == testid);
                    var getAnstext = db.Beg_Word.SingleOrDefault(x => x.Id == begid);
                    var testgiven = new Beg_WordUserTest()
                    {
                        BegWordId = getquestioninfo.BegWordId,
                        Username = username,
                        BegWordTestId = testid,
                        Day = getquestioninfo.Day,
                        Question = getquestioninfo.Question,
                        QuestionNumber = getquestioninfo.QuestionNumber,
                        Answer = getAnstext.Word

                    };
                    db.Beg_WordUserTest.Add(testgiven);
                    db.SaveChanges();
                    trans.Commit();
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    throw;
                }

            }
        }
    }
Esempio n. 12
0
    public static List<LearningWord> LoadQuizWithRandomSet(int? getchaptersperday, Int32 id, string username)
    {
        // int? nam=0;
        List<LearningWord> resultList = null;
        List<LearningWord> resultRandomList = null;
        List<LearningWord> resultList1 = null;
        Int32 i = 0;
        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {
            List<int?> randomnum = RandomService.GenerateRandom();
            var testid = db.Beg_WordUserTest.Where(x => x.Username == username).Select(x => x.BegWordTestId).Distinct().ToList();


            //takequestion
            resultList =
                db.Beg_WordTest.AsNoTracking()
                    .Join(db.Beg_WordTranslate, x => x.BegWordId, y => y.BegWordId, (x, y) => new { x, y })
                    .Join(db.Beg_WordFiles, a => a.x.BegWordId, b => b.BegWordId, (a, b) => new { a, b })
                    // .Take(Convert.ToInt32(getchaptersperday))
                    .Where(x => x.a.x.BegWordId == id).Take(1)
                    .Select(xy => new LearningWord()
                    {
                        idName = xy.a.x.Id,
                        BegPrId = xy.a.x.BegWordId,
                        Kannada = xy.a.y.Kannada,
                        Hindi = xy.a.y.Hindi,
                        Play = xy.b.Play
                    }).ToList();
            //   nam = resultList[0].idName;
            resultRandomList =
                db.Beg_Word.Join(db.Beg_WordTranslate, x => x.Id, y => y.BegWordId, (x, y) => new { x, y })
                    .Join(db.Beg_WordFiles, a => a.x.Id, b => b.BegWordId, (a, b) => new { a, b })
                    .Join(db.Beg_WordTest, aa => aa.a.x.Id, bb => bb.BegWordId, (aa, bb) => new { aa, bb })
                    .Take(Convert.ToInt32(getchaptersperday))
                    .Where(xx => randomnum.Contains(xx.aa.a.x.Id))
                    .Select(xy => new LearningWord()
                    {
                        idName = xy.bb.Id,
                        BegPrId = xy.aa.a.x.Id,
                        Kannada = xy.aa.a.y.Kannada,
                        Hindi = xy.aa.a.y.Hindi,
                        Play = xy.aa.b.Play
                    }).ToList();


            resultList1 = resultList.Union(resultRandomList).ToList();

        }
        return resultList1;
    }
Esempio n. 13
0
    public static List<LearningQuiz> LoadQuiz(int? getchaptersperday)
    {
        //4 quest
        //gets first record
        //List<Learning> randomList = LoadChapters(getchaptersperday);
        List<LearningQuiz> resultList;
        //randomList = randomList.Where(x => RandomService.GenerateRandom().Contains(x.BegPrId )).ToList();
        using (dbExtranetEntitiesWord db = new dbExtranetEntitiesWord())
        {
            //load question

            resultList =
                db.Beg_WordTest.AsNoTracking().Join(db.Beg_WordTranslate, x => x.Id, y => y.BegWordId, (x, y) => new { x, y })
                    .Join(db.Beg_WordFiles, a => a.x.Id, b => b.BegWordId, (a, b) => new { a, b })
                    .Where(x => x.a.x.Id == getchaptersperday)
                    .Select(xy => new LearningQuiz()
                    {
                        IdTestquiz = xy.a.x.Id,
                        IdquizDay = xy.a.x.Day,
                        QuestionNum = xy.a.x.QuestionNumber,
                        Question = xy.a.x.Question,
                        An = xy.a.x.Answer,
                        BegPrId = xy.a.x.BegWordId
                    }).ToList();
        }
        return resultList;
    }