Пример #1
0
        public ActionResult List(string searchKey, int?page)
        {
            WebView.WebService._base myWebService;
            myWebService = new WebService._base();

            WebService._base.OSPPTTMaintenance PTTMain = new WebService._base.OSPPTTMaintenance();

            if (searchKey != null)
            {
                if (searchKey.Equals(""))
                {
                    PTTMain = myWebService.GetOSPPTTMaintenance(0, 100, null);
                }
                else
                {
                    PTTMain           = myWebService.GetOSPPTTMaintenance(0, 100, searchKey);
                    ViewBag.searchKey = searchKey;
                }
            }
            else
            {
                PTTMain           = myWebService.GetOSPPTTMaintenance(0, 100, null);
                ViewBag.searchKey = "";
            }

            ViewData["data7"] = PTTMain.PTTMaintenanceList;

            List <SelectListItem> list2 = new List <SelectListItem>();

            using (Entities ctxData = new Entities())
            {
                var sStateName = (from d in ctxData.WV_STATE_MAST
                                  select d);

                list2.Add(new SelectListItem()
                {
                    Text = "", Value = ""
                });

                foreach (var a in sStateName.Distinct().OrderBy(it => it.STATE_ID))
                {
                    list2.Add(new SelectListItem()
                    {
                        Text = a.STATE_NAME, Value = a.STATE_ID.ToString()
                    });
                    System.Diagnostics.Debug.WriteLine("B = State Name :" + a.STATE_NAME + " C = State ID :" + a.STATE_ID);
                }
                //Console.WriteLine(ListSatateName);
                System.Diagnostics.Debug.WriteLine("B = State Name :" + list2);
            }
            ViewBag.StateName = 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;

            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            return(View(PTTMain.PTTMaintenanceList.ToPagedList(pageNumber, pageSize)));
        }