Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

asp.net , c#

Posted on 2012-04-12
9
286 Views
Last Modified: 2012-04-30
I have a project to build web-based insurance / auto quoting app. in asp.net c#, In  the survey, there is over 200 questions, so step by step application is required.

1. in asp.net world, what is the best approach to create the codes? using wizard, panel? or 3rd party solution? Remember, the user should be able to update after the steps by steps procedure is completed.

2. Saving the data into the database is another issue. Since there is so many data for each columns. I am trying to find a better solution instead of creating 200+ columns for the tables.

My approach is getting all of the information and create xml string like.
<quote id=1>
   <firstname>John</firstname>
  <lastname>Smiths</lastname>
</quote>

And save the xml string into the database.

However, I need some idea how to code in the frontend aspx/c#. Like create a session to store xml string during the step by step procedures....or other.

I hope experts can give me some idea how to generate the xml string
and be able to update xml string after the survey is completed.

Sound complex but actually it happens all the time in the real world app. If you need any third party asp.net component that working ... please let me know
0
Comment
Question by:Webboy2008
  • 6
  • 3
9 Comments
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 37841327
This kind of thing is very easy in asp.net.   You don't have to create the session, it is already there.  You can store information for the current user session without effort just by saying Session["field name"] = value;
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 37841333
There are classes built in to the common library that handle the creation of xml, updating databases, and make it easy to get data from the database to the user interface and back again with a minimum amount of effort.  Of course, there is a learning curve, and you have to learning the techniques.  

If your user has been through a login process, I would collect the answers in a database so they can continue where they left off.  If the user is anonymous (and it sounds like that is the case), then just use the current session to collect the data.
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 37841356
Here is a c# code snippet that builds xml.  There are lots of ways to do it, some more advanced than others and some are not available in all versions of .Net.  

 XmlDocument doc = new XmlDocument();            
 XmlElement root = CreateElement(doc,"root");            
 doc.AppendChild(root);    
 XmlElement xFirstName = CreateElement(doc,"firstName");
root.AppendChild(xFirstName);

and there are methods to add children, attributes, inner text, etc.

very simple!

Here is one way to convert that document to a string.

public static string StringFromXmlDocument(XmlDocument xmlDoc)
        {
            StringWriter sw = new StringWriter();
            XmlTextWriter xw = new XmlTextWriter(sw);
            xw.Formatting = Formatting.Indented;
            xmlDoc.WriteTo(xw);
            return sw.ToString();
        }
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:Webboy2008
ID: 37842280
Thank. But I would like more details. Assume I have three steps quoting asp.net web app.
How can I save/build xml string/save into Db in one class.

And when the user want to update those information, how can I extract the data from xml string, land the data into the UI, and save again in the Db.

Thanks
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 37843774
Wow, that is a lot of questions for one question.  Which aspect do you want to work on first, populating the data from the XML string into the UI,  creating the XML string from the UI, or storing and retrieiving the XML string to/from the DB?

Which database are you using?
0
 

Author Comment

by:Webboy2008
ID: 37845467
I use sql db 2008
0
 
LVL 11

Expert Comment

by:MajorBigDeal
ID: 37845601
Great,  please don't be offended if this is a dumb question:  Do you already have code that lets you update a field in the database?  Not necessarily XML but any field?
0
 

Author Comment

by:Webboy2008
ID: 37849587
MajorBigDeal: No I have not started yet. Saving one single xml in one column's purpose is to avoid unlimited columns in the database. Moving forward, we don't have to manage so many columns....
0
 
LVL 11

Accepted Solution

by:
MajorBigDeal earned 500 total points
ID: 37863148
OK, so I guess the first thing we have to do is to establish a small test application that lets you write a field to the database and then read it back again.  Do you want to do that?
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question