This project has moved and is read-only. For the latest updates, please go here.

Adding a customer name in registratiion page

Nov 1, 2014 at 10:21 AM
Hi iam using ticketdesk2

i wanted to add customer name filed in registration page because based on customer
i wanted to listed out all the ticket which are related to this particular customer

can i add new field in registration page

thanks in advance

best regards
Swamy P
Nov 1, 2014 at 6:12 PM
The answer is yes; however, in TicketDesk 2.1, this may not work out quite as easily as you might think. In TicketDesk 2.5 and 3.0 this is a little simpler to achieve.

TicketDesk 2.1:

Adding a field to the user account is simple. TD 2 uses the standard Sql Membership, Role, and Profile providers that first shipped with 2.0. To add a new field to registration, just define a field in web.config in the profile section, drop a textbox in the UI, then in the controller push that value to the user's profile. The ProfileProvider system will save the data to the database automatically.

If you want to get fancy, you can also add support for the new profile field in the domain model's UserSettingsService class (follow the pattern used by the "OpenEditorWithPreview" setting.

The difficulty will be in using the values stored in a user's profile for rendering lists. The way the old profile provider is designed, it is super easy and fast to get the current user's settings back out of the profile. But it is exceedingly difficult to read profile data for other users. You have some methods on the profile provider you can use to get the data, but since the data is stored as serialized objects, querying the entire list of profiles is VERY slow. In your case, what you'd likely try to do is pull out every user's profile then cross-link it with the data in the grid so you can sort/filter the grid based on one of the profile values... this isn't that hard to code, but is very slow and clunky. If you go that route, make sure you cache the profile data using a memory cache so the application doesn't have to re-query the entire profile collection every time it draws the ticketcenter.

Another, perhaps better option, would be to add the profile field and registration textbox as described above, but don't directly use the profile values to filter the list. Instead, add a column to the ticket itself for storing the customer name. When a user creates a ticket (or when the owner changes) just set the value for ticket's customer field from the user's profile. Then in the ticketcenter, you get the data straight from the ticket, without needing to involve the profile provider.

TicketDesk 2.5 and 3.0:

The new versions use the aspnet.identity framework for security and profile information. These use entity framework code-first entities (POCOs), so it is super easy to extend them to include additional fields directly on the user entity (which serve the same purpose as profile fields). Since this model stores the data in regular columns, not as serialized objects, you can query profile data very quickly using standard linq to entity queries.

Again though, I'd recommend extending the ticket to include a customer property and populating it when the ticket is created or the owner changes.... just to make it easier to work with the data in the ticketcenter. Either way though, it would perform fairly well.