public PartialViewResult ArchiveSearchInCollection(string searchstring) { if (!StaticObjects.Initiated) StaticObjects.Init(Request.MapPath("~/")); VIPars pars = (VIPars)Session["VIPars"]; if (pars == null) { // cassetterootcollection P1_1001 pars = new VIPars() { collection_id = "P1_cassetteId" }; } Session["VIPars"] = pars; ArchModels am = new ArchModels(pars); ViewData["searchresults"] = am.CList.Where(r => { var nameEl = r.Elements("field").FirstOrDefault(f => f.Attribute("prop").Value == "name"); return nameEl != null && nameEl.Value.EndsWith(searchstring); }).ToArray(); return PartialView(); }
//public ActionResult ViewArchive() //{ // if (!StaticObjects.Initiated) StaticObjects.Init(Request.MapPath("~/")); // VIPars pars = (VIPars)Session["VIPars"]; // if (pars == null) // { // // cassetterootcollection P1_1001 // pars = new VIPars() { collection_id = "P1_cassetteId" }; // } // string co = Request.Params["co"]; // if (co != null) { pars.collection_id = co; pars.page_id = null; } // string pg = Request.Params["pg"]; // if (pg != null) { pars.page_id = pg; } // string mp = Request.Params["mp"]; // if (mp != null) { pars.mpd_id = mp; } // Session["VIPars"] = pars; // ArchModels am = new ArchModels(pars); // return View("ViewArch", am); //} private void Podval(VIPars pars) { if (pars == null) { string cid = null; try { var dirs = Sema2012.Engine.SearchByName(User.Identity.Name + "_directory", "collection", false).ToArray(); if (dirs.Length > 0) cid = dirs[0].Attribute("id").Value; else return; } catch (Exception) { return; } pars = new VIPars() { collection_id = cid, root_collection_id = cid }; } string co = Request.Params["co"]; if (co != null) { pars.collection_id = co; pars.page_id = null; } string pg = Request.Params["pg"]; if (pg != null) { if (pg == "up") pars.page_id = pars.collection_id; else if (pg == "beg") { string cid = null; try { var dirs = Sema2012.Engine.SearchByName(User.Identity.Name + "_directory", "collection", false).ToArray(); if (dirs.Length > 0) cid = dirs[0].Attribute("id").Value; else return; } catch (Exception) { return; } pars = new VIPars() { collection_id = cid, root_collection_id = cid }; } else pars.page_id = pg; } //string mp = Request.Params["mp"]; //if (mp != null) { pars.mpd_id = mp; } Session["VIPars"] = pars; var AM = new ArchModels(pars); ViewData["ArchModels"] = AM; }