Exemplo n.º 1
0
        public ActionResult GridView1PartialAddNew(iys.ModelProject.DOCUMENT item)
        {
            var model = db.DOCUMENTS;

            try
            {
                item.PATH             = filePath;
                item.VISIBLE          = true;
                item.CREATE_USER      = getCurrentUserName();
                item.CREATE_DATE      = DateTime.Now;
                item.LAST_UPDATE      = DateTime.Now;
                item.LAST_UPDATE_USER = getCurrentUserName();
                filePath = null;
                model.Add(item);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                ViewData["EditError"] = e.Message;
            }
            //}
            //else
            //    ViewData["EditError"] = "Please, correct all errors.";
            var model1 = from d in db.DOCUMENTS
                         join b in db.CHAPTERS on d.CHAPTER_CODE equals b.CHAPTER_CODE
                         join cs in db.COURSES on d.COURSE_CODE equals cs.COURSE_CODE
                         join lesson in db.LESSONS on d.LESSON_CODE equals lesson.LESSON_CODE
                         select new { d.DOCUMENT_CODE, CHAPTER_CODE = b.CHAPTER_NAME, d.DOCUMENT_TYPE, d.DURATION, d.LINK_TYPE, d.PATH, LESSON_CODE = lesson.LESSON_NAME, COURSE_CODE = cs.COURSE_NAME, d.DOCUMENT_NAME };

            return(PartialView("_GridView1Partial", model.ToList()));
        }
Exemplo n.º 2
0
        public ActionResult GridView1PartialUpdate(iys.ModelProject.DOCUMENT item)
        {
            var model = db.DOCUMENTS;

            try
            {
                item.PATH             = filePath;
                item.PRIORITY         = 0;
                item.ROW_ORDER_NO     = 0;
                item.VISIBLE          = true;
                item.CREATE_USER      = getCurrentUserName();
                item.CREATE_DATE      = DateTime.Now;
                item.LAST_UPDATE      = DateTime.Now;
                item.LAST_UPDATE_USER = getCurrentUserName();
                filePath = null;
                /// DOCUMENT modelItem = model.FirstOrDefault(it => it.DOCUMENT_CODE == item.DOCUMENT_CODE);
                if (item != null)
                {
                    db.DOCUMENTS.Attach(item);
                    db.Entry(item).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
            catch (Exception e)
            {
                ViewData["EditError"] = e.Message;
            }
            //}
            //else
            //    ViewData["EditError"] = "Please, correct all errors.";
            var model1 = from d in db.DOCUMENTS
                         join b in db.CHAPTERS on d.CHAPTER_CODE equals b.CHAPTER_CODE
                         join cs in db.COURSES on d.COURSE_CODE equals cs.COURSE_CODE
                         join lesson in db.LESSONS on d.LESSON_CODE equals lesson.LESSON_CODE
                         select new { d.DOCUMENT_CODE, CHAPTER_CODE = b.CHAPTER_NAME, d.DOCUMENT_TYPE, d.DURATION, d.LINK_TYPE, d.PATH, LESSON_CODE = lesson.LESSON_NAME, COURSE_CODE = cs.COURSE_NAME, d.DOCUMENT_NAME };

            return(PartialView("_GridView1Partial", model.ToList()));
        }