Exemplo n.º 1
0
        public ActionResult getContentDocumant(int DocumentCode)
        {
            using (iysContext db = new iysContext())
            {
                string           user = User.Identity.Name;
                int              DocumentCodeBefore = DocumentCode - 1;
                USER_QUIZ_STATUS quiz = db.USER_QUIZ_STATUSS.Where(x => x.USER_CODE == user).Where(x => x.DOCUMENT_CODE == DocumentCodeBefore).FirstOrDefault();
                docDetail        d    = new docDetail();
                if (quiz != null || DocumentCode == 1 || User.IsInRole("Admin"))
                {
                    DOCUMENT doc = db.DOCUMENTS.Find(DocumentCode);

                    d.sure = Convert.ToInt32(doc.DURATION.Substring(0, 2)) * 60 + Convert.ToInt32(doc.DURATION.Substring(3, 2));
                    if (doc.DOCUMENT_TYPE == 5)//video
                    {
                        d.path = doc.PATH;
                    }
                    else if (doc.DOCUMENT_TYPE == 6)
                    {
                        d.path = String.Format("<embed src=\"../dersler/{0}\" width=\"600\" height=\"480\">", doc.PATH);
                    }
                    d.hata = 0;
                }
                else
                {
                    d.path = "Bu Dersi Almaya hakkınız yok!..";
                    d.sure = 0;
                    d.hata = 1;
                }
                return(Json(d, JsonRequestBehavior.AllowGet));
            }
            // return "<embed src=\"/Content/pdfd.pdf\" width=\"500\" height=\"375\">";
        }
Exemplo n.º 2
0
 public ActionResult Index()
 {
     ViewData["Options"] = new ImageSliderSlideShowDemoOptions();
     using (var ctx = new iysContext())
     {
         return(View());
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// tüm Dersleri getirir
 /// </summary>
 /// <returns></returns>
 public static Dictionary <int, string> getCourse()
 {
     using (iysContext db = new iysContext())
     {
         return((from d in db.COURSES
                 select new { Key = d.COURSE_CODE, Value = d.COURSE_NAME }).ToDictionary(t => t.Key, t => t.Value));
     }
 }
Exemplo n.º 4
0
        public ActionResult MasterDetail()
        {
            iysContext db    = new iysContext();
            var        model = from d in db.COURSES
                               select d;

            return(View(model));
        }
Exemplo n.º 5
0
        public ActionResult MasterDetailMasterPartial()
        {
            iysContext db    = new iysContext();
            var        model = from d in db.COURSES
                               select d;

            return(PartialView("MasterDetailMasterPartial", model.ToArray()));
        }
Exemplo n.º 6
0
        //
        // GET: /AdminPanel/
        public ActionResult Index()
        {
            iysContext db    = new iysContext();
            var        model = from d in db.COURSES
                               select d;

            return(View(model.ToArray()));
        }
Exemplo n.º 7
0
 /// <summary>
 /// seçilen soruyu getiri
 /// </summary>
 /// <returns></returns>
 public static Dictionary <int, string> getQuestions()
 {
     using (iysContext db = new iysContext())
     {
         return((from d in db.QUESTIONS
                 select new { Key = d.QUESTION_CODE, Value = d.DESCRIPTION }).ToDictionary(t => t.Key, t => t.Value));
     }
 }
Exemplo n.º 8
0
 public ActionResult Exam(int documenCode)
 {
     using (iysContext db = new iysContext())
     {
         ViewBag.ExamName = db.DOCUMENTS.Find(documenCode).DOCUMENT_NAME;
         List <QUESTION> doc = db.QUESTIONS.Where(x => x.DOCUMENT_CODE == documenCode).ToList();
         return(View(doc));
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// seçilen soruyu getiri
 /// </summary>
 /// <returns></returns>
 public static Dictionary <int, string> getType(int gruopDes)
 {
     using (iysContext db = new iysContext())
     {
         return((from d in db.GROUPS
                 where d.GROUP_CODE == gruopDes
                 select new { Key = d.ID, Value = d.EXP_TR }).ToDictionary(t => t.Key, t => t.Value));
     }
 }
Exemplo n.º 10
0
 public static string getDocumentString(int documentCode)
 {
     using (iysContext db = new iysContext())
     {
         string a = (from d in db.DOCUMENTS
                     where d.DOCUMENT_CODE == documentCode
                     select d.DOCUMENT_NAME).First().ToString();
         return(a);
     }
 }
Exemplo n.º 11
0
 public static string getLessonString(int lessonCode)
 {
     using (iysContext db = new iysContext())
     {
         string a = (from d in db.LESSONS
                     where d.LESSON_CODE == lessonCode
                     select d.LESSON_NAME).First().ToString();
         return(a);
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// seçilen dersin bölümlerini getirir
 /// </summary>
 /// <returns></returns>
 public static string getChapterString(int chapterCode)
 {
     using (iysContext db = new iysContext())
     {
         string a = (from d in db.CHAPTERS
                     where d.CHAPTER_CODE == chapterCode
                     select d.CHAPTER_NAME).First().ToString();
         return(a);
     }
 }
Exemplo n.º 13
0
 /// <summary>
 /// seçilen dersin bölümlerini getirir
 /// </summary>
 /// <returns></returns>
 public static Dictionary <int, string> getChapter(int course)
 {
     using (iysContext db = new iysContext())
     {
         Dictionary <int, string> a = (from d in db.CHAPTERS
                                       where d.COURSE_CODE == course
                                       select new { Key = d.CHAPTER_CODE, Value = d.CHAPTER_NAME }).ToDictionary(t => t.Key, t => t.Value);
         return(a);
     }
 }
Exemplo n.º 14
0
 /// <summary>
 /// seçilen dersin bölümlerini getirir
 /// </summary>
 /// <returns></returns>
 public static Dictionary <int, string> getLesson(int course, int chapter)
 {
     using (iysContext db = new iysContext())
     {
         Dictionary <int, string> a = (from d in db.LESSONS
                                       where d.COURSE_CODE == course && d.CHAPTER_CODE == chapter
                                       select new { Key = d.LESSON_CODE, Value = d.LESSON_NAME }).ToDictionary(t => t.Key, t => t.Value);
         return(a);
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// session daki user bilgilerini getirir
        /// </summary>
        /// <returns>user code</returns>
        public int getCurrentUserName()
        {
            int username = -1;

            using (iysContext db = new iysContext())
            {
                string userId = User.Identity.Name;
                username = db.USERDETAILS.Where(x => x.NICK_NAME == userId).Select(x => x.USER_CODE).SingleOrDefault();
            }
            return(username);
        }
Exemplo n.º 16
0
        public ActionResult MasterDetailDetailPartial(string customerID)
        {
            ViewData["COURSE_CODE"] = customerID;
            int        cID   = Convert.ToInt32(customerID);
            iysContext db    = new iysContext();
            var        model = from d in db.CHAPTERS
                               where d.COURSE_CODE == cID
                               select d;

            return(PartialView("MasterDetailDetailPartial", model.ToArray()));
        }
Exemplo n.º 17
0
        public ActionResult ExamChoose(int DOCUMENT_CODE, int count)
        {
            using (iysContext db = new iysContext())
            {
                USER_QUIZ_STATUS quiz = new USER_QUIZ_STATUS();
                quiz.DOCUMENT_CODE = DOCUMENT_CODE;
                quiz.DATE          = DateTime.Now;
                quiz.USER_CODE     = User.Identity.Name;
                db.USER_QUIZ_STATUSS.Add(quiz);
                db.SaveChanges();
                List <QUESTION> sorular    = db.QUESTIONS.Where(x => x.DOCUMENT_CODE == DOCUMENT_CODE).ToList();
                int             dogruCevap = 0;
                for (int i = 0; i < count; i++)
                {
                    USER_ANSWER answer        = new USER_ANSWER();
                    string      question_code = Request.Form["item_QUESTION_CODE_" + i.ToString()].ToString();
                    string      chose         = Request.Form[question_code].ToString();
                    answer.QUESTION_CODE = Convert.ToInt32(question_code);
                    answer.CHOOSE        = chose;
                    answer.QUIZ_CODE     = quiz.QUIZ_CODE;
                    answer.USER_CODE     = User.Identity.Name;
                    db.USER_ANSWERS.Add(answer);

                    //doğre cevap bul
                    if (chose.Equals(sorular.Where(x => x.QUESTION_CODE == answer.QUESTION_CODE).FirstOrDefault().rightChoose))
                    {
                        dogruCevap++;
                    }
                }


                quiz.GRADE = (dogruCevap * 100) / count;
                db.USER_QUIZ_STATUSS.Attach(quiz);
                db.Entry(quiz).State = System.Data.Entity.EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
        }