Exemplo n.º 1
0
        public IActionResult Search(Search_param _params, int now_page = 1)
        {
            clear_session(); //Sessionのクリア
            if (_params.Start_day.ToString("yyyy") != null)
            {
                HttpContext.Session.SetString("date1", _params.Start_day.ToString("yyyy-MM-dd"));
                ViewBag.date1 = _params.Start_day.ToString("yyyy") == "0001" ? null : HttpContext.Session.GetString("date1");
            }
            else
            {
                ViewBag.date1 = "yyyy-MM-dd";
            }
            if (_params.End_day != null)
            {
                HttpContext.Session.SetString("date2", _params.End_day.ToString("yyyy-MM-dd"));
                ViewBag.date2 = _params.End_day.ToString("yyyy") == "0001" ? null : HttpContext.Session.GetString("date2");
            }
            else
            {
                ViewBag.date2 = "yyyy-MM-dd";
            }
            if (_params.Word != null)
            {
                HttpContext.Session.SetString("freeword", _params.Word);
                ViewBag.freeword = HttpContext.Session.GetString("freeword");
            }
            ViewBag.Check = _params.Check ? true : false;
            if (_params.Check)
            {
                HttpContext.Session.SetString("check", "Checked");
            }
            var          _list          = Search_Target();
            SearchInqury _search_inqury = new SearchInqury(_list, _params.Start_day, _params.End_day, _params.Check, _params.Word);
            var          _result        = _search_inqury.Search_start();

            if (_result.Count() == 0)
            {
                ViewBag.error = " 該当データはありません";
            }
            else
            {
                ViewBag.error = String.Format(" {0}件ヒット", _result.Count().ToString());
            }
            Pagenation pages    = new Pagenation(_result.AsQueryable().AsNoTracking(), 20);
            var        _result2 = pages.Pager(now_page);
            //_srにはページネーションをどこまで出すかをLIST<int>で渡している。
            var _sr = pages.Separate_now(now_page);

            if (_sr.Count() <= 1)  //1件未満の場合はViewでは非表示にする。
            {
                ViewBag.separate = new List <int>();
            }
            else
            {
                ViewBag.separate = _sr;
            }
            ViewBag.now_page = now_page;
            return(View("Index", _result2));
        }
Exemplo n.º 2
0
        public IActionResult Index(int now_page = 1)
        {
            clear_session();                  //検索結果Sessionを削除するぜ。
            DateTime _today = DateTime.Today; //今日の日付

            ViewBag.Check = false;
            var _result = from tr in this._context.Tra_Inqury
                          join usr in this._context.Mst_User
                          on tr.Login_Id equals usr.Id
                          //where tr.Start_day == _today
                          where tr.Check_Flag == false
                          where tr.Del_Flag == false
                          orderby tr.Start_day descending
                          orderby tr.Start_Time descending
                          orderby tr.Id descending
                          select new MyList
            {
                Id           = tr.Id,
                Start_day    = tr.Start_day,
                Start_Time   = tr.Start_Time,
                Company_Name = tr.Company_Name,
                Tel_No       = tr.Tel_No,
                User_Name    = usr.User_Name,
                Inqury       = tr.Inqury,
                //Answer = tr.Answer,
                //Tan_Name = tr.Tan_Name,
                //Staff_Flag = tr.Staff_Flag,
                Complate_Flag = tr.Complate_Flag,
                Check_Flag    = tr.Check_Flag
            };
            //ページネーション処理
            Pagenation pages    = new Pagenation(_result.AsNoTracking(), 20);
            var        _result2 = pages.Pager(now_page);
            //_srにはページネーションをどこまで出すかをLIST<int>で渡している。
            var _sr = pages.Separate_now(now_page);

            if (_sr.Count() <= 1)  //1件未満の場合はViewでは非表示にする。
            {
                ViewBag.separate = new List <int>();
            }
            else
            {
                ViewBag.separate = _sr;
            }
            ViewBag.now_page = now_page;
            //ViewBag.date1 = _today;
            //ViewBag.date2 = _today;
            ViewBag.check = true;
            return(View(_result2));
        }