Solution Design - Architecture : Auto-generate from and submit form events - c#

This is a design issue i would like to discuses before starting development so , any opinion may help, there is no specific way to do it except that the system should be delivered under sharepoint 2010 and SP 2007 because of licensing issue.
My case as below
One user can define new service ( let say vacation request service), then he define the field with type ( let say Field1 (type:TextBox; DisplayName:employeeName) / field2 (Type:FileUpload;DisplayName:documentOne) then he define which users they can use ( from FBA asp membership users)
this comes under (Dynamic Data Entry User Interfaces) .
After the form is submitted , it will go throw normal approval process. with some common events and business rules.
what i am thinking to do :-
1) build page that let you generate ASP.NET form ,
2) for each generate form , i create a list based on SharePoint list definition and by the event receiver i can set and remove users who can view / edit / add items using the SP Security module.
3) build my own D/B that saves each generate service what is the approval steps for it and any data i need to complete the approval workflow.
My Questions :-
***1) after i generate the form , how can i also write form events ( Submit event, onLoad event..etc), because each generated form will submit to different place to save data.
2) is this is the best practice to implement such system ?!
3) Should i save the form data in SharePoint list or i should save it to DB also because i have two SharePoint environment and i may have performance issue while my data is separated between DB and SP. but in this case i need to implement my own security module.
4) we have around 200 from will be generated for phase one . so i am afraid that thing may get out of control if the design were not solid enough,

submit everything to the same place with different parameters:
form table : (form filler id, form type id, form parameters id)
parameters table: (form id (Foreign Key), parameter id, parameter type, parameter text value)
this way its generic.
?
save it in your database so that you would not be restricted to sharepoint structure.
do it lean - first build just a part of your solution and run it only on 1 or 2 forms. design the solution gradually rather then trying to predict everything from the beginning.

Related

Best way of sharing user specific variables around my MVC4 app

I am building an MVC4 app using razor, I have done many in the past but I want to roll some best practice in to this one in terms of dealing with variables.
The situation is that I have a logged in user (logged in meaning a windows authentication, with that user name matched to a user in my user table). That user comes with a set of profile options such as "canViewReports", "canEditPerson" etc etc.
Now, there are two prongs to those profile options. First is that my presentation layer needs to customise itself depending on what is presented to it. So profile 1 has canViewReport set to false so the tab for reports will be hidden. Profile 2 has it true so the tab will be shown.
The second prong is that if my savvy users type in /reports/index, I need to pick that up and block access for profile 1 but allow profile 2.
Ok, so at the moment I am using a base controller that is decorated with a [UserDataFilter], that user data filter calls a method that checks the current session for a set of keys and if they are missing assigns them. I put each of those profile options for the current user in to the session. I can then use the session variables in my presentation layer and also in code.
My concern is that that is messy looking in my code having to put this kind of thing everywhere:
(bool)session["canViewReports"] everywhere in my razor.
That lead me to try using the viewstart.cshtml and setting App variables in there that I can use in my razor a bit cleaner. In viewstart I set:
App.canViewReports = (bool)HttpContext.Current.Session["canViewReports"];
I can then just use App.canViewreports everyhwere in my views without too much trouble.
My questions are:
1) Is App.canViewReports for the entire application at an IIS level, or does each connection to IIS get its own pool of App. variables. The thing I want to avoid is the first user setting the variable and every other user that subsequently uses the application getting that value! (on different computers)
2) Is there a better way of doing this!!!
Many thanks
Iain
I would use User.IsInRole("canViewReports") in my razor logic to hide and show the menus item. If you build you menu in you layout you only need to do this once.
I would then further protect the action method by decorating the method with
[AuthorizeUser("canViewReports")]
You could create an ISessionService that stores the session information you need.In this way,you can implement it however you want and have full control over it.It could be retrieved easily via a DI container and it's easy to mock.

How to have flexible Data Entry form of 150 columns in ASP.NET ? Perhaps DevExpress or other thirdparty Tools?

I am encountering a situation such as, I want to offer a data entry form of almost more than 100 fields of certain Database Table. It was an old database of Invoice of a particular company and cannot be altered.
So, I would have obviously a resultant Data Grid ( Probably HTML Table ) or MVC Grid containing user entered data inside. But the problem is How to Offer 120 fields in an entry form? ( Could be a partial View contained inside JQuery )? This comes an idea about inline editable Grid. Would that be better? Or DevExpress offers such controls? Would Spreadsheet be helpfull?
or any other technique would be helpfull to adopt for this?
Any body having any idea?
Regards
Usman
OK. I don't think a Grid would be a good way: that would just be too wide. I think the best way would be a series of Tabs each of which contains the data pertaining to one logical section of the invoice (e.g. a section for Forwarder, another for Client, etc etc).
As a design note, try to group items into sections small enough that the user doesn't need to scroll. Everything is a section should be visible of a normal sized screen. This makes it easier for the user.
Not sure if this is possible in your case but since you mentioned
any other technique would be helpfull
This is what I can suggest: In Visual Studio (download free copy here http://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx), in your MVC project:
Add Entity Framework package from nuget if you don't already have it (Install-Package EntityFramework from Package Manager console in VS)
Add an EF model in VS by dragging you database table to model designer
Add an Entity Framework controller with Read/Write Actions
This will create views in your project where a user can go an CRUD the table rows. And will also ensure basic constraint checking.
Check this tutorial for Entity Framework details: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application

How to create Spotfire datasource with multiple tables

I am developing spotfire data source and using this, my datasource is going to get data from multiple URL's. For each URL I have to create a table in spotfire. Could you please show me some code to achieve this.
First, note that a single data source object can only produce a single table. That is, you cannot "hardcode" a list of URLs in your DataSource class. However, you can supply a single URL as parameter and require your user of the Spotfire Professional Client to enter the URL when he creates the data table (e.g., by clicking File -> Add Data Table) and have him/her do that multiple times.
The important step in implementing this is to make Spotfire aware of the information supplied as a parameter and make this information serializable (Spotfire Prof. has to store it somewhere in the DXP after all). You do this by writing a "PromptModel" class, registering together with the associated View (the form that will be displayed to the user to prompt for the URL), and then doing some wiring (registering, implementing the right constructor, etc.).
The example that you linked glances over this stuff unfortunately (you see some comments saying "Not shown..."). However if the Spotfire SDK (TIB_spotfdev*.zip), you'll find a more extensive example called "SpotfireDeveloper.CustomDataSourceExample" that takes care of all these steps.

Using InfoPath for importing and exporting data

The application I'm writing has a need for a solution to the following situation:
Salesman and customer is located offsite. They are finalizing a list of requirements, and will input business data that at some point need to be inputed in the onsite database.
My idea is that the salesperson gets a InfoPath document that is almost completed with default values and heads over to the customer. While at the customer the document is updated to satisfy the customer's need. I must also cover that the document is passed back and forth by email between the salesperson and the customer.
When the salesperson returns to the office he uploads the InfoPath into the database and the order is updated with few user interactions.
Now to the questions:
Is this a workable/sensible solution? Other suggestions to how to solve this?
How do I ensure that form and data stays together when the salesperson takes the document on a USB stick or it's emailed to the customer?
How do I (with C# code) fill a form with default values?
How do I read back the changes?
Sharepoint is not an option.
Some issues that you will need to think about
will customer have infopath installed and therfore may not be able to view the document.
If you email the document or need a customer to view it, generally only the data is transmitted with a pointer to the Form Template. If you want the customer to update it and send it back, then the template will need to be located somewhere publicily accesseable.
The data is stored as an XML document so as part of the startup you could detect that it is a new form set the defaults that you need.
when you publish a form to a networked folder it will also ask for a local path for the form. this allows for a disconected scenarios.
From my experience, InfoPath is a great tool when you have control over the environment. It starts to break down as a viable option once you get outside a controled environment, because you then have to start jumping through hoops to make it work as it should.
EDIT
One you loose control of the environment I think that a web interface would be the way to go.
The sales person could create a new document on the website with the back-end populating all the defaults necessary. A link to the document could be emailed to the customer, who could update their stuff via the web interface and then sales person can then finalise the process.

Adding columns to the CreateUserWizard control using FBA

I'm wanting to create a user account creation section for unregistered users on our internet site. I want to ask the same questions as the CreateUserWizard control but have a few changes. I want the question to come from a question lookup table in SQL. The user will have a dropdown of available questions and I'll store the questionid they selected and the answer. Also, I want to store 1 other piece of data about the user (SSN).
My questions are:
1) Is forms based authentication an acceptable solution for this if using SSL?
2) Can I add additional columns (questionid and ssn) to the membership table or another table and how do I do that so I can save the info in the 'blessed' way? Will the solution have any negative effect if down the road I want to add password reset/recovery?
When adding columns, does it make sense to invoke Membership.CreateUser rather than using the CreateUserWizard?
Thanks!!
1) Yes it is. You can extend Membership with Profiles, and add any arbitrary fields you like
2) You can customize the CreateUserWizard a great deal, but behind the scenes it just ends up calling Membership.Create user. Personally, I would just roll my own (since it really isn't all that hard) unless you want to use the default wizard. But that is more personal preference then anything else.
NOTE: the link I provided for Profiles assumes you are using a WebSite project. If you are using Web Application projects, there are a few additional steps you can read about here.

Categories

Resources