Esempio n. 1
0
        public ActionResult List(string searchKey, string pttID, int?page)
        {
            WebView.WebService._base myWebService;
            myWebService = new WebService._base();

            WebService._base.OSPExchangeMaintenance ExcMain = new WebService._base.OSPExchangeMaintenance();
            if (searchKey != null || pttID != null)
            {
                if (searchKey == "" && pttID == "")
                {
                    ExcMain = myWebService.GetOSPExchangeMaintenance(0, 50000, null, null);
                }

                else
                {
                    ExcMain           = myWebService.GetOSPExchangeMaintenance(0, 50000, searchKey, pttID);
                    ViewBag.searchKey = searchKey;
                    ViewBag.pttID2    = pttID;
                }
            }
            else
            {
                ExcMain           = myWebService.GetOSPExchangeMaintenance(0, 50000, null, null);
                ViewBag.searchKey = "";
                ViewBag.pttID2    = "";
            }

            ViewData["data10"] = ExcMain.ExchangeMaintenanceList;

            using (Entities ctxData = new Entities())
            {
                List <SelectListItem> list2 = new List <SelectListItem>();
                var query3 = from p in ctxData.WV_EXC_MAST
                             //orderby p.PTT_ID ascending
                             select new { p.PTT_ID };
                list2.Add(new SelectListItem()
                {
                    Text = "", Value = ""
                });
                foreach (var a in query3.Distinct().OrderBy(it => it.PTT_ID))
                {
                    list2.Add(new SelectListItem()
                    {
                        Text = a.PTT_ID, Value = a.PTT_ID
                    });
                }
                ViewBag.PttId = list2;
            }
            string input = "\\\\adsvr";
            //string input = "\\\\server\\d$\\x\\y\\z\\AAA";
            string output = String.Format("http:{0}", input.Replace("\\d$\\x\\y", String.Empty).Replace("\\", "/"));

            ViewBag.output = output;

            //return View();
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(View(ExcMain.ExchangeMaintenanceList.ToPagedList(pageNumber, pageSize)));
        }