Пример #1
0
        public ActionResult Detail(string id)
        {
            var logger = NLog.LogManager.GetCurrentClassLogger();

            logger.Info("로그 테스트입니다.");

            NoteIndexVM model = new NoteIndexVM();

            //int id; //노트아이디

            OrderColumn defaultOrderColumn = OrderColumn.Notedate;
            OrderType   defaultOrderType   = OrderType.Desc;

            OrderColumn selectedOrderColumn;
            OrderType   selectedOrderType;

            if (Session["OrderColumn"] != null)
            {
                selectedOrderColumn = (OrderColumn)Enum.Parse(typeof(OrderColumn), Session["OrderColumn"].ToString());
            }
            else
            {
                // use default value
                selectedOrderColumn = defaultOrderColumn;
            }

            if (Session["OrderType"] != null)
            {
                selectedOrderType = (OrderType)Enum.Parse(typeof(OrderType), Session["OrderType"].ToString());
            }
            else
            {
                // use default value
                selectedOrderType = defaultOrderType;
            }

            model.NoteList = NoteDAO.GetNoteList((OrderColumn)selectedOrderColumn, (OrderType)selectedOrderType, 0);

            if (String.IsNullOrEmpty(id))
            {
                model.SelectedNote = NoteDAO.GetNotebyId(model.NoteList[0].NoteId);
                id = model.SelectedNote.NoteId.ToString();

                return(RedirectToAction("detail", new { id = id }));
            }

            model.SelectedNote = NoteDAO.GetNotebyId(int.Parse(id));

            //노트북선택
            SelectNoteBook(int.Parse(id));

            //노트 아이디로 노트북 얻어옴
            model.NoteBook = NoteBookDAO.GetNoteBookbyId(model.SelectedNote.NoteBookId);

            return(View(model));
        }
Пример #2
0
        public ActionResult List(string orderColumn, string orderType, string noteId, string tagId)
        {
            OrderColumn defaultOrderColumn = OrderColumn.Notedate;
            OrderType   defaultOrderType   = OrderType.Desc;

            OrderColumn selectedOrderColumn;
            OrderType   selectedOrderType;
            int         selectedTagId;

            if (String.IsNullOrEmpty(orderColumn))
            {
                // parameter is empty
                //selectedOrderColumn = defaultOrderColumn;

                if (Session["OrderColumn"] != null)
                {
                    // do nothing
                }
                else
                {
                    // use default value
                    Session["OrderColumn"] = defaultOrderColumn;
                }
            }
            else
            {
                // parameter is delivered by user
                selectedOrderColumn    = (OrderColumn)Enum.Parse(typeof(OrderColumn), orderColumn);
                Session["OrderColumn"] = selectedOrderColumn;
            }

            if (String.IsNullOrEmpty(orderType))
            {
                // parameter is empty
                //selectedOrderColumn = defaultOrderColumn;

                if (Session["OrderType"] != null)
                {
                    // do nothing
                }
                else
                {
                    // use default value
                    Session["OrderType"] = defaultOrderType;
                }
            }
            else
            {
                // parameter is delivered by user
                selectedOrderType    = (OrderType)Enum.Parse(typeof(OrderType), orderType);
                Session["OrderType"] = selectedOrderType;
            }

            //Tagid
            selectedTagId = int.Parse(tagId);


            var noteList = TagDAO.GetNoteListByTagId(selectedTagId);

            // 리스트 정렬 정보 (column, asc|desc)

            // note detail
            int    selectedNoteid = noteList[0].NoteId;
            NoteVO selectedNote   = NoteDAO.GetNotebyId(selectedNoteid);

            NoteIndexVM model = new NoteIndexVM();

            model.NoteList     = noteList;
            model.SelectedNote = selectedNote;
            int notebookIdParsedInt = int.Parse(tagId);

            model.NoteBook = NoteBookDAO.GetNoteBookbyId(notebookIdParsedInt);


            //바로가기 여부 보여줌
            //ViewBag.isShortCut = ShortcutManager.IsShorcut(id, 1);

            return(View(model));
        }