예제 #1
0
        public ActionResult Delete(int seq, string txtSearch, int hidPageSize)
        {
            BoardDispatch boardDispatch = new BoardDispatch();
            int           retVal        = boardDispatch.DeleteBoard(seq);

            return(RedirectToAction("Main", "Search", new { txtSearch = txtSearch, hidPageSize = hidPageSize }));
        }
예제 #2
0
        public ActionResult Modify(int seq, string txtLabel, string txtSubject, string txtComment, string txtSearch, int hidPageSize)
        {
            BoardDispatch boardDispatch = new BoardDispatch();
            int           returnVal     = boardDispatch.UpdateBoard(seq, txtLabel, txtSubject, txtComment);

            return(RedirectToAction("Detail", "Book", new { Seq = seq, txtSearch = txtSearch, hidPageSize = hidPageSize }));
        }
예제 #3
0
        public ActionResult Write(string txtLabel, string txtSubject, string txtComment)
        {
            BoardDispatch boardDispatch = new BoardDispatch();
            int           seq           = boardDispatch.InsertBoard(txtLabel, txtSubject, txtComment);

            return(RedirectToAction("Detail", "Book", new { Seq = seq, txtSearch = "", hidPageSize = 1 }));
        }
예제 #4
0
        public ActionResult Index()
        {
            BoardDispatch boardDispatch = new BoardDispatch();

            //라벨리스트
            DataSet dataLabel = boardDispatch.GetLabelList(6);

            ViewBag.LabelList = dataLabel.Tables[0].Rows;

            return(View());
        }
예제 #5
0
        private BoardT GetDetail(int seq, int option)
        {
            BoardDispatch boardDispatch = new BoardDispatch();
            DataSet       data          = boardDispatch.GetBoardDetail(seq);

            BoardT boardT = new BoardT
            {
                Comment   = option == 1 ? data.Tables[0].Rows[0]["Comment"].ToString().Replace("\n", "<br/>") : data.Tables[0].Rows[0]["Comment"].ToString(),
                LabelName = data.Tables[0].Rows[0]["LabelName"].ToString(),
                RegDate   = (DateTime)data.Tables[0].Rows[0]["RegDate"],
                Seq       = (int)data.Tables[0].Rows[0]["Seq"],
                Subject   = data.Tables[0].Rows[0]["Subject"].ToString()
            };

            return(boardT);
        }
예제 #6
0
        public ActionResult Main(string txtSearch, string hidPageSize)
        {
            string searchValue = txtSearch == null ? "" : txtSearch;

            SearchOptionView searchOptionView = new SearchOptionView();

            searchOptionView.TxtSearch = searchValue;
            ViewBag.SearchOptionView   = searchOptionView;


            int pageSize   = String.IsNullOrWhiteSpace(hidPageSize) ? 1 : Convert.ToInt32(hidPageSize);
            int startCount = ((pageSize - 1) * PAGECOUNT) + 1;
            int endCount   = pageSize * PAGECOUNT;

            BoardDispatch boardDispatch = new BoardDispatch();
            DataSet       data          = boardDispatch.GetBoardList(searchValue, startCount, endCount);

            List <BoardT> boardResults = new List <BoardT>();

            foreach (DataRow row in data.Tables[0].Rows)
            {
                boardResults.Add(new BoardT
                {
                    Comment   = row["Comment"].ToString(),
                    LabelName = row["LabelName"].ToString(),
                    RegDate   = (DateTime)row["RegDate"],
                    Seq       = (int)row["Seq"],
                    Subject   = row["Subject"].ToString()
                });
            }

            //Paging 처리
            int totalCount = Convert.ToInt32(data.Tables[1].Rows[0][0]);
            var pager      = new Pager(totalCount, pageSize, PAGECOUNT);

            ViewBag.Pagination = pager;

            //라벨리스트
            DataSet dataLabel = boardDispatch.GetLabelList(15);

            ViewBag.LabelList = dataLabel.Tables[0].Rows;

            return(View("Main", new SearchResult {
                SearchText = searchValue, IsValid = true, BoardTotalCount = totalCount, lstBoard = boardResults, ServerError = ""
            }));
        }