public ActionResult RQItemDescElement(string rqitemId, string fieldName, string subFieldIndex)
        {
            if (!string.IsNullOrEmpty(fieldName) && !string.IsNullOrEmpty(rqitemId))
            {
                try
                {
                    RQItem rqitem = modelRepository.GetModel("$access$" + rqitemId, UserState.States.ItemViewState).RQItems.FirstOrDefault(p => p.DocNo == rqitemId);

                    return(View("ServIndRQItem", rqitem.GetLinkedData(fieldName, System.Convert.ToInt16(subFieldIndex))));
                }
                catch (Exception)
                {
                    throw;
                };
            }
            return(null);
        }
Exemple #2
0
        public RQItem Post(string dbname, [FromBody] RQItem newRQItem)
        {
            if (ModelState.IsValid)
            {
                RQItem      rqitem = null;
                RQItemModel model  = new RQItemModel(true);

                rqitem = model.Add(newRQItem);
                model.Update();
                CacheManager.Clear();
                return(Get("rqitems", rqitem.DocNo, "rqi", "edititem", ""));
            }
            else
            {
                throw new HttpResponseException(JsonErrorResponse.InvalidData());
            }
        }
Exemple #3
0
        public RQItem Get(string dbname, string id, string format, string verb = "", string queryString = "")
        {
            if (System.Web.HttpContext.Current.Request.Headers.Get("Accept").ToLower().Contains("text/html"))
            {
                throw new HttpResponseException(JsonErrorResponse.Redirect(Request.RequestUri.ToString().Replace("rqds/" + dbname + "/" + id + "/" + format, dbname + "/" + "RQItemLD/" + id + "?verb=" + format)));
            }
            else
            {
                UserState.States state;
                bool             forEdit;

                RQItemModelRepository repo = new RQItemModelRepository(new FormatParameter((FormatParameter.FormatEnum)Enum.Parse(typeof(FormatParameter.FormatEnum), format + ((format == "rqi") ? "_single_item" : ""))));
                if (!string.IsNullOrEmpty(verb))
                {
                    switch (verb.ToLower())
                    {
                    case "queryitem":
                        state   = UserState.States.ListViewState;
                        forEdit = false;
                        break;

                    case "browseitem":
                        state   = UserState.States.BrowseViewState;
                        forEdit = false;
                        break;

                    case "edititem":
                        state   = RQItem.IsExternal(id) ? UserState.States.ListViewState : UserState.States.EditState;
                        forEdit = RQItem.IsExternal(id) ? false : true;
                        break;

                    default:
                        state   = UserState.States.ListViewState;
                        forEdit = false;
                        break;
                    }
                }
                else
                {
                    state   = UserState.States.ListViewState;
                    forEdit = false;
                }
                return(repo.GetRQItem(id, state, forEdit));
            }
        }
Exemple #4
0
        public RQItem Post(string dbname, string id, [FromBody] RQItem changeRQItem)
        {
            if (ModelState.IsValid)
            {
                RQItemModelRepository repo  = new RQItemModelRepository((new FormatParameter(FormatParameter.FormatEnum.rqi)));
                RQItemModel           model = null;
                RQItem rqitem = null;

                model  = repo.GetModel("$access$" + id, UserState.States.EditState, true);
                rqitem = model.RQItems.FirstOrDefault(p => p.DocNo == id);
                rqitem.Change(changeRQItem);
                model.Update();
                CacheManager.Clear();
                return(Get("rqitems", id, "rqi", "edititem", ""));
            }
            else
            {
                throw new HttpResponseException(JsonErrorResponse.InvalidData());
            }
        }
        public ActionResult UpdateItem(string verb, string rqitemId, string serviceId, RQItem changeRQItem)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }
            if ((rqitemId != null) && (rqitemId != ""))
            {
                if ((verb.ToLower() == "cancel") || (verb == RQResources.Views.Shared.SharedStrings.cancel))
                {
                    return(this.RedirectToRoute("RQItemList", new { dbname = "rqitems" }));
                }
                else if ((verb.ToLower() == "finalize") || (verb == RQResources.Views.Shared.SharedStrings.finish))
                {
                    return(this.RedirectToRoute("RQItemList", new { dbname = "rqitems" }));
                }
                else
                {
                    if (MvcRQ.Helpers.AccessRightsResolver.HasAddAccess())
                    {
                        RQItemModel model  = null;
                        RQItem      rqitem = null;
                        try
                        {
                            model  = modelRepository.GetModel("$access$" + rqitemId, UserState.States.EditState, true);
                            rqitem = model.RQItems.FirstOrDefault(p => p.DocNo == rqitemId);
                            if ((verb.ToLower() == "update") || (verb == RQResources.Views.Shared.SharedStrings.update))
                            {
                                rqitem.Change(changeRQItem);
                            }
                            else if ((verb.ToLower() == "new") || (verb == RQResources.Views.Shared.SharedStrings.add))
                            {
                                rqitem = model.Add(changeRQItem);
                            }
                            else if ((verb.ToLower() == "delete") || (verb == RQResources.Views.Shared.SharedStrings.delete))
                            {
                            }   // not yet implemented
                            model.Update();
                        }
                        catch (Exception ex)
                        {
                            string    message = "Update operation failed. ";
                            Exception iex     = ex;

                            while (iex != null)
                            {
                                if (!string.IsNullOrEmpty(iex.Message))
                                {
                                    message += "\n - " + iex.Message;
                                }
                                iex = iex.InnerException;
                            }
                            throw new Exception(message);
                        };
                        CacheManager.Clear();
                        ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.finish;
                        if (AccessRightsResolver.HasAddAccess())
                        {
                            ViewBag.EditButton3     = RQResources.Views.Shared.SharedStrings.copy;
                            ViewBag.EditButton3Link = "/RQItems/" + rqitem.DocNo + "?verb=copy";
                            ViewBag.EditButton4     = RQResources.Views.Shared.SharedStrings.add;
                            ViewBag.EditButton4Link = "/RQItems?verb=new";
                        }
                        return(RQItemRecord((verb == "") ? verb : "edititem", rqitem.DocNo, serviceId));
                    }
                    else
                    {
                        throw new System.AccessViolationException(RQResources.Views.Shared.SharedStrings.err_not_authorized);
                    }
                }
            }
            throw new NotImplementedException("No item for update specified.");
        }
        public ActionResult RQItemRecord(string verb, string rqitemId, string serviceId)
        {
            RQItem rqitem = null;
            string view   = "";

            if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "edit")))
            {
                if (MvcRQ.Helpers.AccessRightsResolver.HasEditAccess())
                {
                    ViewBag.Title  = "RiQuest | Edit";
                    ViewBag.Header = "Dokument editieren";
                    if (bClientEditing)
                    {
                        ViewBag.RQItemId = rqitemId;
                        return(View("ClientEditor"));
                    }
                    else
                    {
                        ViewBag.EditButton1 = RQResources.Views.Shared.SharedStrings.update;
                        ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.cancel;
                        view   = "EditRQItem";
                        rqitem = modelRepository.GetRQItem(rqitemId, UserState.States.EditState, true);
                    }
                }
                else
                {
                    throw new AccessViolationException("Not authorized for this function!");
                }
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "copy")))
            {
                if (MvcRQ.Helpers.AccessRightsResolver.HasAddAccess())
                {
                    ViewBag.Title  = "RiQuest | Copy";
                    ViewBag.Header = "Dokument kopieren";
                    if (bClientEditing)
                    {
                        ViewBag.RQItemId = rqitemId;
                        return(View("ClientEditor"));
                    }
                    else
                    {
                        ViewBag.EditButton1 = RQResources.Views.Shared.SharedStrings.add;
                        ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.cancel;
                        rqitem       = new RQItem(modelRepository.GetRQItem(rqitemId, (RQItem.IsExternal(rqitemId) ? UserState.States.ListViewState : UserState.States.EditState), true)._resultItem);
                        rqitem.DocNo = "";
                        rqitem.ID    = "";
                        view         = "EditRQItem";
                    }
                }
                else
                {
                    throw new AccessViolationException("Not authorized for this function!");
                }
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "queryitem")))
            {
                rqitem = modelRepository.GetRQItem(rqitemId, UserState.States.ListViewState, false);
                if (HttpContext.Request.AcceptTypes.Contains("text/html"))
                {
                    return(this.Content(rqitem.TransformItem(RQItem.DisplFormat.single_item), "text/html", System.Text.Encoding.UTF8));
                }
                else
                {
                    view = "DisplRQItem";
                }
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "browseitem")))
            {
                rqitem = modelRepository.GetRQItem(rqitemId, UserState.States.BrowseViewState, false);
                if (HttpContext.Request.AcceptTypes.Contains("text/html"))
                {
                    return(this.Content(rqitem.TransformItem(RQItem.DisplFormat.single_item), "text/html", System.Text.Encoding.UTF8));
                }
                else
                {
                    view = "DisplRQItem";
                }
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "edititem")))
            {
                view   = "EditRQItem";
                rqitem = modelRepository.GetRQItem(rqitemId, (RQItem.IsExternal(rqitemId) ? UserState.States.ListViewState : UserState.States.EditState), RQItem.IsExternal(rqitemId) ? false : true);
            }
            else
            {
                rqitem = modelRepository.GetRQItem(rqitemId, UserState.States.ItemViewState, false);
                if (string.IsNullOrEmpty(serviceId))
                {
                    modelRepository.GetQuery(rqitemId);
                    ViewBag.docNo = HttpContext.Request.QueryString.Get("d") != null?HttpContext.Request.QueryString.Get("d") : "";

                    ViewBag.HasAddPermit  = MvcRQ.Helpers.AccessRightsResolver.HasAddAccess(); // Enable the add new button if user is allowed to add RQItems ti the database.
                    ViewBag.GetRQItemVerb = "QueryItem";                                       // Tell GetRQItem() in ResultViewer the appropiate verb for saving the user state.
                    return(View("Index"));
                }
                else
                {
                    view = "ServRQItem";
                    ViewBag.ServiceType = serviceId;
                    ViewBag.TextSeg0    = "an individual RQItem";
                }
                switch (serviceId)
                {
                case "mods":
                    throw new NotImplementedException("RiQuest data service not yet implemented for mods format.");

                case "oai_dc":
                    EnableXmlAttribute.XSLTransform = "~/xslt/rqi2dc.xslt";
                    break;

                case "srw_dc":
                    throw new NotImplementedException("RiQuest data service not yet implemented for srw_dc format.");

                case "info_ofi":
                    throw new NotImplementedException("RiQuest data service not yet implemented for info_ofi format.");

                case "rqi":
                    EnableXmlAttribute.XSLTransform = "";
                    break;

                case "rq":
                    EnableXmlAttribute.XSLTransform = "~/xslt/rqi2rq.xslt";
                    break;

                default:
                    throw new NotImplementedException("RiQuest data service not yet implemented for unknown format.");
                }
            }
            if (rqitem == null)
            {
                throw new NotImplementedException("Could not find a RiQuest item with requested document number.");
            }
            else
            {
                bool bClassificationLinkedData = false;  //all semantic web servers for classification data not working properly

                if (bClassificationLinkedData == true)
                {
                    rqitem.LoadLinkedData("Classification");
                }
                return(View(view, rqitem));
            }
        }
        public ActionResult RQItemList(string verb, string queryString, RQItem newRQItem)
        {
            if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "new") || (verb == RQResources.Views.Shared.SharedStrings.add)))
            {
                if (MvcRQ.Helpers.AccessRightsResolver.HasAddAccess())
                {
                    RQItem rqitem = null;

                    if (ModelState.IsValid)
                    {
                        try
                        {
                            RQItemModel model = new RQItemModel(true);

                            rqitem = model.Add(newRQItem);
                            model.Update();
                        }
                        catch (Exception ex)
                        {
                            string    message = "Add operation failed. ";
                            Exception iex     = ex;

                            while (iex != null)
                            {
                                if (!string.IsNullOrEmpty(iex.Message))
                                {
                                    message += "\n - " + iex.Message;
                                }
                                iex = iex.InnerException;
                            }
                            throw new Exception(message);
                        }
                        CacheManager.Clear();
                        if (bClientEditing)
                        {
                        }
                        else
                        {
                            ViewBag.EditButton2     = RQResources.Views.Shared.SharedStrings.finish;
                            ViewBag.EditButton3     = RQResources.Views.Shared.SharedStrings.copy;
                            ViewBag.EditButton3Link = "/RQItems/" + rqitem.DocNo + "?verb=copy";
                            ViewBag.EditButton4     = RQResources.Views.Shared.SharedStrings.add;
                            ViewBag.EditButton4Link = "/RQItems?verb=new";
                        }
                        return(RQItemRecord((verb == "") ? verb : "edititem", rqitem.DocNo, null));
                    }
                    else
                    {
                        if (bClientEditing)
                        {
                            ViewBag.RQItemId = "";
                            return(View("ClientEditor"));
                        }
                        else
                        {
                            ViewBag.EditButton1 = RQResources.Views.Shared.SharedStrings.add;
                            ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.cancel;
                            return(View("EditRQItem", newRQItem));
                        }
                    }
                }
                else
                {
                    throw new AccessViolationException("Not authorized for this function!");
                }
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "cancel") || (verb == RQResources.Views.Shared.SharedStrings.cancel)))
            {
                return(this.RedirectToRoute("RQItemList", new { dbname = "rqitems" }));
            }
            else
            {
                ViewBag.HasAddPermit  = MvcRQ.Helpers.AccessRightsResolver.HasAddAccess(); // Enable the add new button if user is allowed to add RQItems ti the database.
                ViewBag.GetRQItemVerb = "QueryItem";                                       // Tell GetRQItem() in ResultViewer the appropiate verb for saving the user state.
                return(View("Index"));
            }
        }
        public ActionResult UpdateItem(string verb, string rqitemId, string serviceId, RQItem changeRQItem)
        {
            if (!ModelState.IsValid)
                return View();
            if ((rqitemId != null) && (rqitemId != ""))
            {
                if ((verb.ToLower() == "cancel") || (verb == RQResources.Views.Shared.SharedStrings.cancel))
                    return this.RedirectToRoute("RQItemList", new { dbname = "rqitems" });
                else if ((verb.ToLower() == "finalize") || (verb == RQResources.Views.Shared.SharedStrings.finish))
                {
                    return this.RedirectToRoute("RQItemList", new { dbname = "rqitems" });
                }
                else
                {
                    if (MvcRQ.Helpers.AccessRightsResolver.HasAddAccess())
                    {
                        RQItemModel model = null;
                        RQItem rqitem = null;
                        try
                        {
                            model = modelRepository.GetModel("$access$" + rqitemId, UserState.States.EditState, true);
                            rqitem = model.RQItems.FirstOrDefault(p => p.DocNo == rqitemId);
                            if ((verb.ToLower() == "update") || (verb == RQResources.Views.Shared.SharedStrings.update))
                                rqitem.Change(changeRQItem);
                            else if ((verb.ToLower() == "new") || (verb == RQResources.Views.Shared.SharedStrings.add))
                                rqitem = model.Add(changeRQItem);
                            else if ((verb.ToLower() == "delete") || (verb == RQResources.Views.Shared.SharedStrings.delete))
                            { } // not yet implemented
                            model.Update();
                        }
                        catch (Exception ex)
                        {
                            string message = "Update operation failed. ";
                            Exception iex = ex;

                            while (iex != null)
                            {
                                if (!string.IsNullOrEmpty(iex.Message))
                                    message += "\n - " + iex.Message;
                                iex = iex.InnerException;
                            }
                            throw new Exception(message);
                        };
                        CacheManager.Clear();
                        ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.finish;
                        if (AccessRightsResolver.HasAddAccess())
                        {
                            ViewBag.EditButton3 = RQResources.Views.Shared.SharedStrings.copy;
                            ViewBag.EditButton3Link = "/RQItems/" + rqitem.DocNo + "?verb=copy";
                            ViewBag.EditButton4 = RQResources.Views.Shared.SharedStrings.add;
                            ViewBag.EditButton4Link = "/RQItems?verb=new";
                        }
                        return RQItemRecord((verb == "") ? verb : "edititem", rqitem.DocNo, serviceId);
                    }
                    else
                        throw new System.AccessViolationException(RQResources.Views.Shared.SharedStrings.err_not_authorized);
                }
            }
            throw new NotImplementedException("No item for update specified.");
        }
        public ActionResult RQItemRecord(string verb, string rqitemId, string serviceId )
        {
            RQItem rqitem = null;
            string view = "";

            if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "edit")))
            {
                if (MvcRQ.Helpers.AccessRightsResolver.HasEditAccess())
                {
                    ViewBag.Title = "RiQuest | Edit";
                    ViewBag.Header = "Dokument editieren";
                    if (bClientEditing)
                    {
                        ViewBag.RQItemId = rqitemId;
                        return View("ClientEditor");
                    }
                    else
                    {
                        ViewBag.EditButton1 = RQResources.Views.Shared.SharedStrings.update;
                        ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.cancel;
                        view = "EditRQItem";
                        rqitem = modelRepository.GetRQItem(rqitemId, UserState.States.EditState, true);
                    }
                }
                else
                    throw new AccessViolationException("Not authorized for this function!");
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "copy")))
            {
                if (MvcRQ.Helpers.AccessRightsResolver.HasAddAccess())
                {
                    ViewBag.Title = "RiQuest | Copy";
                    ViewBag.Header = "Dokument kopieren";
                    if (bClientEditing)
                    {
                        ViewBag.RQItemId = rqitemId;
                        return View("ClientEditor");
                    }
                    else
                    {
                        ViewBag.EditButton1 = RQResources.Views.Shared.SharedStrings.add;
                        ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.cancel;
                        rqitem = new RQItem(modelRepository.GetRQItem(rqitemId, (RQItem.IsExternal(rqitemId) ? UserState.States.ListViewState : UserState.States.EditState), true)._resultItem);
                        rqitem.DocNo = "";
                        rqitem.ID = "";
                        view = "EditRQItem";
                    }
                }
                else
                    throw new AccessViolationException("Not authorized for this function!");
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "queryitem")))
            {
                rqitem = modelRepository.GetRQItem(rqitemId, UserState.States.ListViewState, false);
                if (HttpContext.Request.AcceptTypes.Contains("text/html"))
                    return this.Content(rqitem.TransformItem(RQItem.DisplFormat.single_item), "text/html", System.Text.Encoding.UTF8);
                else
                    view = "DisplRQItem";
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "browseitem")))
            {
                rqitem = modelRepository.GetRQItem(rqitemId, UserState.States.BrowseViewState, false);
                if (HttpContext.Request.AcceptTypes.Contains("text/html"))
                    return this.Content(rqitem.TransformItem(RQItem.DisplFormat.single_item), "text/html", System.Text.Encoding.UTF8);
                else
                    view = "DisplRQItem";
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "edititem")))
            {
                view = "EditRQItem";
                rqitem = modelRepository.GetRQItem(rqitemId, (RQItem.IsExternal(rqitemId) ? UserState.States.ListViewState : UserState.States.EditState), RQItem.IsExternal(rqitemId) ? false : true);
            }
            else
            {
                rqitem = modelRepository.GetRQItem(rqitemId, UserState.States.ItemViewState, false);
                if (string.IsNullOrEmpty(serviceId))
                {
                    modelRepository.GetQuery(rqitemId);
                    ViewBag.docNo = HttpContext.Request.QueryString.Get("d") != null ? HttpContext.Request.QueryString.Get("d") : "";
                    ViewBag.HasAddPermit = MvcRQ.Helpers.AccessRightsResolver.HasAddAccess(); // Enable the add new button if user is allowed to add RQItems ti the database.
                    ViewBag.GetRQItemVerb = "QueryItem"; // Tell GetRQItem() in ResultViewer the appropiate verb for saving the user state.
                    return View("Index");
                }
                else
                {
                    view = "ServRQItem";
                    ViewBag.ServiceType = serviceId;
                    ViewBag.TextSeg0 = "an individual RQItem";
                }
                switch (serviceId)
                {
                    case "mods":
                        throw new NotImplementedException("RiQuest data service not yet implemented for mods format.");
                    case "oai_dc":
                        EnableXmlAttribute.XSLTransform = "~/xslt/rqi2dc.xslt";
                        break;
                    case "srw_dc":
                        throw new NotImplementedException("RiQuest data service not yet implemented for srw_dc format.");
                    case "info_ofi":
                        throw new NotImplementedException("RiQuest data service not yet implemented for info_ofi format.");
                    case "rqi":
                        EnableXmlAttribute.XSLTransform = "";
                        break;
                    case "rq":
                        EnableXmlAttribute.XSLTransform = "~/xslt/rqi2rq.xslt";
                        break;
                    default:
                        throw new NotImplementedException("RiQuest data service not yet implemented for unknown format.");
                }
            }
            if (rqitem == null)
                throw new NotImplementedException("Could not find a RiQuest item with requested document number.");
            else
            {
                bool bClassificationLinkedData = false;  //all semantic web servers for classification data not working properly

                if (bClassificationLinkedData == true)
                    rqitem.LoadLinkedData("Classification");
                return View(view, rqitem);
            }
        }
        public ActionResult RQItemList(string verb, string queryString, RQItem newRQItem)
        {
            if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "new") || (verb == RQResources.Views.Shared.SharedStrings.add)))
            {
                if (MvcRQ.Helpers.AccessRightsResolver.HasAddAccess())
                {
                    RQItem rqitem = null;

                    if (ModelState.IsValid)
                    {
                        try
                        {
                            RQItemModel model = new RQItemModel(true);

                            rqitem = model.Add(newRQItem);
                            model.Update();
                        }
                        catch (Exception ex)
                        {
                            string message = "Add operation failed. ";
                            Exception iex = ex;

                            while (iex != null)
                            {
                                if (!string.IsNullOrEmpty(iex.Message))
                                    message += "\n - " + iex.Message;
                                iex = iex.InnerException;
                            }
                            throw new Exception(message);
                        }
                        CacheManager.Clear();
                        if (bClientEditing)
                        {
                        }
                        else
                        {
                            ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.finish;
                            ViewBag.EditButton3 = RQResources.Views.Shared.SharedStrings.copy;
                            ViewBag.EditButton3Link = "/RQItems/" + rqitem.DocNo + "?verb=copy";
                            ViewBag.EditButton4 = RQResources.Views.Shared.SharedStrings.add;
                            ViewBag.EditButton4Link = "/RQItems?verb=new";
                        }
                        return RQItemRecord((verb == "") ? verb : "edititem", rqitem.DocNo, null);
                    }
                    else
                    {
                        if (bClientEditing)
                        {
                            ViewBag.RQItemId = "";
                            return View("ClientEditor");
                        }
                        else
                        {
                            ViewBag.EditButton1 = RQResources.Views.Shared.SharedStrings.add;
                            ViewBag.EditButton2 = RQResources.Views.Shared.SharedStrings.cancel;
                            return View("EditRQItem", newRQItem);
                        }
                    }
                }
                else
                    throw new AccessViolationException("Not authorized for this function!");
            }
            else if ((!string.IsNullOrEmpty(verb)) && ((verb.ToLower() == "cancel") || (verb == RQResources.Views.Shared.SharedStrings.cancel)))
                return this.RedirectToRoute("RQItemList", new { dbname = "rqitems" });
            else
            {
                ViewBag.HasAddPermit = MvcRQ.Helpers.AccessRightsResolver.HasAddAccess(); // Enable the add new button if user is allowed to add RQItems ti the database.
                ViewBag.GetRQItemVerb = "QueryItem"; // Tell GetRQItem() in ResultViewer the appropiate verb for saving the user state.
                return View("Index");
            }
        }