Asp.net 5 mvc 6 get query string to view - query-string

I have been googling for a few hours. But still not able to get the answer. I need to get a query string parameter in a razor view.
Here is my code:
if #(Request.Query["value"]=="P"){
<strong>Active (#ViewData["activeCount"]) </strong>
In-Active (#ViewData["inActiveCount"])
Delete (#ViewData["deleteCount"])
}else{
Active (#ViewData["activeCount"])
<strong>In-Active (#ViewData["inActiveCount"])<strong>
Delete (#ViewData["deleteCount"])
}
But i get the error "The name 'Request' does not exist in the current context"
The screenshot
Anyone got solution? Thanks

Use Context.Request.Query["value"] rather than Request.Query["value"]

Yes you finally can. The answer is Context.Request.Query ["value"]

Related

How to get comments by instanceId from the COMMENTS table in Activiti 5.22.0?

I am trying to get the comments associated with a Process Instance.
I thought these comments were being populated into the ACT_HI_COMMENT
table, but they are found in the COMMENTS table instead, so
I am not able to get them using taskService.getProcessInstanceComments
nor the
historyService.createProcessInstanceHistoryLogQuery(processInstanceService).includeComments().singleResult()
Does anyone know which is the correct service call to get this records
in Activiti 5.22.0 / Alfresco APS 1.9.0?
Thanks for your help!
I just found that this can be done by using:
com.activiti.service.runtime.CommentService
Like this:
commentService.getCommentsForProcessInstance(instanceId, true);

Sulu: How to get the exact location of template errors in preview?

When I develop templates in Sulu 1.6 and an error occurs, where can I find the full error or exact error location? Is there some kind of special log or do I need to change the default location?
The corresponding /admin/websocket/admin response contains only this (basically the same information):
{
"handler":"sulu_preview.preview",
"message":{
"code":9903,
"message":"Unclosed \"block\".",
"type":"Sulu\\Bundle\\PreviewBundle\\Preview\\Exception\\TwigException"
},
"options":[],
"error":true
}
Currently I only see messages like this:
It would be also helpful to know, where the catch block for this is, in case it is not jet implemented.
Thx a lot!
So it turned out, that there is no logging enabled, and because the PreviewRendere throws a new Exception, the original information is pretty much lost. It can be added in this way: https://github.com/sulu/sulu/pull/4363
Best wishes
Andreas

Reading Issue Fields via Workfront-API

Please tell me how to read Issue Fields like resolveProjectID & resolveTaskID:
****.workfront.com/attask/api/OPTASK/search?id=5bf801f101b144a12aabb51f2c068caa
returns:
{"data":
[{"ID":"5bf801f101b144a12aabb51f2c068caa",
"name":"test-dev-issue","objCode":"OPTASK",
"plannedCompletionDate":"2018-11-27T00:00:00:000+0200",
"status":"NEW",
"primaryAssignment":null}]
}
According to the API-Explorer guide (https://support.workfront.com/hc/en-us/articles/220633507-API-Explorer), resolveProjectID & resolveTaskID should be located within OPTASK fields. I couldn't find anything helpful yet within their documentation.
Thank you!
The search you're executing will work, but if you know the ID of the record you're retrieving then you should call it directly (/api/v9.0/OPTASK/5bf801f101b144a12aabb51f2c068caa).
The return value is, by default, a small set of fields providing some basic data. If you want more fields, add a parameter (fields=).

Displaying name after login asp.net webmatrix

I built a site using the starter site template in Webmatrix that uses a log in. After a user logs in, it displays near the top "Hello, (email address)!"
Looking at the html code, I see
Hello, <a id="logname" class="email" href="~/Account/Manage" title="Manage">#WebSecurity.CurrentUserName</a>!
I'm just a beginner with asp.net but can work things out following logic, so what I have done is added a 'Name' field to the database where the email and password is stored and edited the registration page so users can enter their name as well, it writes to the database no problems.
Now I assumed it's just a matter of finding where #WebSecurity.CurrentUserName is referring to the user's email address and make it point to the Name field instead. However I've searched high and low and can not seem to find it anywhere.
So my next approach was to use code from a Bakery database tutorial that fetches data from a field and modify it to grab the name and display it where I want, the code I tried to use here:
#foreach(var row in db.Query(selectQueryString))
This appeared to work at first, It displayed "Hello, Ben!" but then if I made any more accounts it started to display them too, so after a while I was getting "Hello, Ben, Steve, Grace, etc..."
Even though I'm a beginner I do realize that this code isn't quite what I need, but something similar that takes that single Name field but only from the currently logged in user... I've googled and searched and seen many people wanting the same thing, except it's using PHP or VB or something that isn't Webmatrix.
If it's a quick answer I'd appreciate the code I need, or otherwise pointed in the right direction, any help would be greatly appreciated. Thanks in advance..
OK ironically I find the solution moments after posting the question, so here goes..
This is the code needed to be put at the very top of the file _SiteLayout.chtml
#{
var authenticatedUser = "";
if (WebSecurity.IsAuthenticated) {
authenticatedUser = WebSecurity.CurrentUserName;
var db = Database.Open("StarterSite");
var UserData = db.QuerySingle("SELECT Name FROM UserProfile WHERE LOWER(Email) = LOWER(#0)", authenticatedUser);
authenticatedUser = UserData.Name;
}
}
StarterSite is the name of the database, and UserProfile is the name of the Table, and I labeled the name field Name (explained for the purpose of beginners like me who might be reading this)
Then in the html markup I changed #WebSecurity.CurrentUserName to #authenticatedUser so now it reads:
Hello, <a id="logname" class="email" href="~/Account/Manage" title="Manage">#authenticatedUser</a>!
resulting in the desired outcome of it now displaying the user's name instead of their email address.

How to create a User in Alfresco?

I tried creating a user. But when I tried, it displayed the following error:
Failed to create the user: 05190030 Wrapped Exception (with status template): 05192817 Failed to execute script 'classpath*:alfresco/templates/webscripts/org/alfresco/repository/person/people.‌​post.json.js': Non-unique path:found : /app:company_home/app:user_homes 0." I am new to Alfresco. Can anyone help me?
This pretty much sounds like you try to create a user which already exists (username property is unique).
As stated in my comment to your other question, it's a known issue when you move, delete or rename User Homes.

Resources