Using InfoPath for importing and exporting data - c#

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.

Related

How can I copy HTML textbox values from one domain to another domain's textboxes?

I'm trying to help save time at work with for a lot of tedious copy/paste tasks we have.
So, we have a propitiatory CRM (with proper HTML ID's, etc for accessing elements) and I'd like to copy those vales from the CRM to textboxes on other web pages (outside of the CRM, so sites like Twitter, Facebook, Google, etc)
I'm aware browsers limit this for security and I'm open to anything, it can be a C#/C++ application, Adobe AIR, etc. We only use Firefox at work so even an extension would work. (We do have GreaseMonkey installed so if that's usable too, sweet).
So, any ideas on how to copy values from one web page to another? Ideally, I'm looking to click a button and have it auto-populate fields. If that button has to launch the web pages that need to be copied over to, that's fine.
Example: Copy customers Username from our CRM, paste it in Facebook's Username field when creating a new account.
UPDATE: To answer a user below, the HTML elements on each domain have specific HTML ID's. The data won't need to be manipulated or cleaned up, just a simple copy from ourCRM.com to facebook.com / twitter.com
Ruby Mechanize is a good bet for scraping the data. Then you can store it and post it however you please.
First, I'd suggest that you more clearly define exactly what it is you're looking to do. I read this as you're trying to take some unstructured data from Point A and copy it to Point B. Do the names of these fields remain constant every time you do the operation? Do you need to simply pull any textbox elements from the page and copy them all over? Do some sort of filtering of this data before writing it over?
Once you've got a clear idea of the requirements, if you go the C# route, I'd use something like SimpleBrowser. Judging by the example on their Github page, you could give it the URL of the page you're looking to copy, then name each of the fields you're looking to obtain the value of, perhaps store these in an IDictionary, then open a new URL and copy those values back into the page (and submit the form).
Alternatively, if you don't know the names of the fields, perhaps there's a provided function in that or a similar project that will allow you to simply enumerate all the text fields on the page and retrieve the values for all of them. Then you'd simply apply some logic of your own to filter those options down to whatever is on the destination form.
SO we thought of an easier way to do this (in case anyone else runs into this issue).
1) From our CRM, we added a "Sign up for Facebook" button
2) The button opens a new window with GET variables in the URL
3) Use a greasemonkey script to read those GET variables and fill in textbox values
4) SUCCESS!
Simple, took about 10 minutes to get working. Thanks for you suggestions.

Customizing or Catching SharePoint ribbon action "New Document" in document library

I was wondering if it is possible to catch or customize the "New Document" action in the ribbon when you create a new document in a document library.
The reason is the following: I would like to fill in some data into the document (pragmatically through the properties) before it opens in Word. This way some default data is filled in for the user. What data is filled in depends on the Site name. This would represent a Project number, what would be used to get the specific data from a list or database.
I've come up with some other solutions that basically fill in the data, but at another point of the process of the document:
using a combination of a Workflow & filling in the data through InfoPath. This works for a library with only 1 content type (the default). Once we want to use multiple Content types it is nearly impossible to get the site name because InfoPath is not able to use the function SPContext.Current.Web.Title.
To solve the content type problem I used the Event Receiver "ItemAdding". This way the data is added when the document is being added. The disadvantage that this gives is that the data will only be visible in the document if the users opens it a second time, what isn't really user friendly.
So to optimize the user experiences and usability I would like to add the data before the document opens in word. But is it possible?
I'm using SharePoint 2010 Server, Office 2010 Professorial and Visual studio 2010 Ultimate.
Thanks in advance,
Oxillery

crystal report as website

Ok I am not sure the question I need to ask so I am going to describe what I would like to be able to do I am wondering if this is possible.
I have some paper forms that I am creating webpages for so that the information can be stored in the database using a computer. I have already created one and the user enters the information it is stored in the database then the user has the option to print a crystal report that looks like the paper form with the information entered.
Is it possible to cut out the middle man and have a crystal report as a webpage that the user can hit enter the information into the report and then hit a save control on the page to save it to the database and print from there.
If I am not asking the right question or you need more information please feel free to ask. If it is possible to design the report and then use that on the page make it editable to the client then that would make my life a whole lot easier I just dont know what to look up.
If what you need is to let user fill out a form and the data can save to database, and then the user can access the form, then there are several options:
Use Adobe forms. In this way, you can create pdf forms and you can let people download or email the forms. The forms are fillable, and when they submit the form, all you need is handle it(in forms of xml) at your server side to save it to your database. You could pre-populate data so that when the user download the file and open it, it has some data filled out. The tool you will need to create Adobe forms is Adobe LiveCycle and you have to learn how to use it. Our company use it for some of our web forms because they are secure and can be emailed. Of course you will need to implement server side code to handle it.
Use asp.net web form. You create web form and linked to database. You handle the form data user entered and save them to the database by using ado.net. That give you the most flexibilities.
If you want user open the form they entered in a specific format so that it will looks like a "form", you have two options:
<1> Pass your raw data to a specific css to let user print out in a nicer format instead of just plain text or even the web page. Again, you get flexibilities through this way.
<2> Use SQL Server Report Services(If you use sql server). In this way, you can create print layouts by using visual studio, and then write a stored procedure to get data. If you do this way, the user will also get a pdf file. They can save it or print it.
Hope this helps.
It is possible (assuming you are using a version of SQL which allows you to write stored procedures), but it's a very bad idea:
Write a SQL stored procedure, with a parameter for each field to be entered, that updates the relevant database tables with the appropriate parameter values.
Generate a Crystal report from the stored procedure.
Note that the only functionality available to the data entry fields (lookups, validation, etc.) will be that available to Crystal Report parameters in whichever version of Crystal you are using - generally, this functionailty is minimal.

Setting up user permissions for reading and writing document files in IIS7

I want to make a very simple CMS for my sites. So what I am thinking is this a user logs in and a list of their pages shows up. Now they change their ends and save it. My C# code would then write over the file/section.
So I don't think it would be to bad to do this however I am not sure about how it works with read and write premission and how to set it up.
Like I want the user to only be able to read and write to their files they own.
So if User A has Page1.html and Page2.html they can only read those files and write to those files they can touch User B's page3.html and Page4.html
So how would I setup this up?
Thanks
When you create your list of files, you will be reading that list from a database repository. Include in that code conditions that allow only those records for which the user has permission.
The most straightforward way to do this is to create a table with two columns: UserID and DocumentID. A presence of a record in the table indicates that the user has permission to that particular document. Add records to this table that give the user permissions to the appropriate documents.
Then, when you read the documents from the database, you can join this table to the documents table via the DocumentID, and filter the table by UserID. This will return only those records for which the user has permission. You can then use that set of records as the basis for the list of documents that you display to the user.
You could employ a cms the SharePoint way. You begin with a base file on the network. If a change to it is made then the page is stored in a database. each subsequent change is a db change and the application renders the last entry in the table for that page.
this does two things. first, you can see revisions and re-instate them. you can see a complete history of the page, who made the changes and when.
it also allows you to lock pages within the database and assign roles/users against the pages. you can then apply a decoration to the controller which checks rights and either renders the page or displays a access denied page and then log the attempted access to the page.
i know this sounds complex but can you foresee a time when after you've gone live with your cms that the client is going to want more from it? you need to implement a solution that's adaptable to needs.
if it's worth writing then it's worth writing well.

Complex lookup metadata in document library

A client wants to have a lookup field for customer name found in a database as metadata on a Word document in a document library. They have a code which represents a group of customers and one of them should be used as customer name as metadata as well as the customer code inside the document.
Since editing the metadata in Word leaves no room for extra logic like external database lookup, right?, we have to tweak the EditForm.aspx with Asp.Net or java script to add the functionality to lookup external data.
The hard part is that we need to make the user fill in the metadata in SharePoint before the document is opened. Otherwise the user must create, close, edit metadata and then re open the document. The default behavior of SharePoint is to open the document first and let the user edit the metadata inside Word.
My first thought was to create a custom action for each content type and redirects the user to a page that creates the document in code and then brings the user to the EditForm page. Alternatively use codebehind for the custom action to create the document and let the user edit metadata in the EditForm. Clicking OK after that would save the metadata and bring up the document itself.
Then I stumbled upon EventRecievers and thought that might solve my problem. To intercept the creation of the document and send the user to the EditForm page first.
What is your thoughts on this, and how would you solve this problem?
This sounds like a job for the Business Data Catalog, that allows for incorporating external data inside your sharepoint lists (i.e. as a column). This does require a SharePoint 2007 Enterprise license.

Categories

Resources