예제 #1
0
        public int DoSearch(string searchCriteria, string searchForType)
        {
            appDB.EFileSearchDataTable dt;
            switch (searchForType)
            {
            case OfficerPrefsBE.qsiCaseFileNumber:
                dt = AtMng.FileSearchByICASE(searchCriteria);
                break;

            case OfficerPrefsBE.qsSIN:
                dt = AtMng.FileSearchBySIN(searchCriteria);
                break;

            case OfficerPrefsBE.qsOfficeFileNumber:
                dt = AtMng.FileSearchByOfficeFileNum(searchCriteria);
                break;

            case OfficerPrefsBE.qsLastName:
                dt = AtMng.FileSearchByLastName(searchCriteria);
                break;

            case OfficerPrefsBE.qsFileNumber:
                dt = AtMng.FileSearchByFileNumber(searchCriteria);
                break;

            case OfficerPrefsBE.qsFullFileNumber:
                dt = AtMng.FileSearchByFullFileNumber(searchCriteria);
                break;

            case "qsFileName":
            case OfficerPrefsBE.qsFileNameEng:
            case OfficerPrefsBE.qsFileNameFre:
                dt = AtMng.FileSearchByKeyword(searchCriteria);
                break;

            case OfficerPrefsBE.qsFullFileName:
                dt = AtMng.FileSearchByFullFileName(searchCriteria);
                break;

            default:
                dt = null;
                break;
            }
            System.Diagnostics.Trace.WriteLine("search", "bind");

            Bs.DataSource = dt;

            Bs.MoveFirst();

            return(dt.Rows.Count);
        }
예제 #2
0
        public ActionResult Search(string term, string method, int page)
        {
            atriumManager myAtmng = Helper.Atmng();

            appDB.EFileSearchDataTable dt;
            switch (method)
            {
            case "filenumber":
                dt = myAtmng.FileSearchByFileNumber(term + "%");
                break;

            case "sin":
                dt = myAtmng.FileSearchBySIN(term);
                break;

            case "lastname":
                dt = myAtmng.FileSearchByLastName(term);
                break;

            case "fullfilenumber":
                dt = myAtmng.FileSearchByFullFileNumber(term + "%");
                break;

            default:
                throw new Exception("Not a valid search method");
            }
            if (dt.Rows.Count == 1)
            {
                return(RedirectToAction("Activity", "File", new { fileid = dt[0]["Fileid"] }));
            }
            else if (dt.Rows.Count == 0)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                ViewBag.Atmng  = myAtmng;
                ViewBag.term   = term;
                ViewBag.method = method;
                ViewBag.Action = "Search";

                return(View(dt.AsEnumerable().ToPagedList(page, 12)));
            }
        }