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

            //     System.Diagnostics.Debug.WriteLine("Search Name Controler : " + searchName );

            WebService._base.OSPCityMaintenance CityMain = new WebService._base.OSPCityMaintenance();
            if (searchKey != null || searchCity != null)
            {
                if (searchKey == null && searchCity == null)
                {
                    System.Diagnostics.Debug.WriteLine("B : " + searchKey + " " + searchCity);
                    CityMain           = myWebService.GetOSPCityMaintenance(0, 100, null, null);
                    ViewBag.searchKey  = "";
                    ViewBag.CitySearch = "";
                }
                else
                {
                    //System.Diagnostics.Debug.WriteLine("Search Name P1 : " + searchName + "  " + CitySearch + "  " + searchKey);
                    CityMain = myWebService.GetOSPCityMaintenance(0, 100, searchKey, searchCity);
                    System.Diagnostics.Debug.WriteLine("C : " + searchKey + " " + searchCity);
                    ViewBag.searchKey   = searchKey;
                    ViewBag.CitySearch2 = searchCity;
                }
            }
            else
            {
                CityMain           = myWebService.GetOSPCityMaintenance(0, 100, null, null);
                ViewBag.searchKey  = "";
                ViewBag.CitySearch = "";
            }

            ViewData["data9"] = CityMain.CityMaintenanceList;

            using (Entities ctxData = new Entities())
            {
                //string StateName = "";

                var query = from d in ctxData.WV_CITY_MAST
                            select new { Text = d.DESCRIPTION_STATE.Trim(), Value = d.STATE_CODE };

                List <SelectListItem> listStateID = new List <SelectListItem>();
                listStateID.Add(new SelectListItem()
                {
                    Text = "", Value = ""
                });

                foreach (var a in query.Distinct().Distinct().OrderBy(it => it.Text))
                {
                    if (a.Value != null)
                    {
                        listStateID.Add(new SelectListItem()
                        {
                            Text = a.Text, Value = a.Value
                        });
                    }
                }
                ViewBag.LCityID = listStateID;
            }

            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(CityMain.CityMaintenanceList.ToPagedList(pageNumber, pageSize)));
        }