开发者

Mapping xml screen to a form

I need to design a .Net Form for a C# 3.5/winforms application.This form would enable the user to manually enter data and on clicking save button on this form, an xml would be generated with the schema as shown below:

<Request ID="1" Type="testTyp开发者_开发技巧e" requestedBy="admin" Date="20081128 19:30:00" date="20100122 00:00:00">
<List>
<Data name="A" date="04/27/2009" region="NA" /> 
  <Data name="B" userName="johnc" /> 
  <Data name="C" date="04/27/2009" region="TR" /> 
  <Data name="D" date="04/27/2009" region="NA" /> 
  <Data name="E" file="C:\Test\ABC.txt" outFile="C:\Test\ABCOut.txt" businessDate="04/27/2009" userName="testuser1"/> 
  <Data name="F" file="C:\Test\EFG.txt" outFile="C:\Test\EFGOut.txt" businessDate="05/21/2009" userName="testuser2"/> 
</List>
</Request>

The design of this form should be user-friendly and intuitive as it would be used by Non-IT users as well.

This xml has various data nodes each having different set of attributes. A data node with the same number of attributes with different values can repeat[for example:data nodes having names "E" and "F"]

Just thinking what would be the best way to have this form design?

Shall I put a dropdown list at the top of the winform, which would show a list of different data node names[A,B.C...]? And then changing the item in this dropdown list would dynamically change the form below. For example:Selecting C in the ddList would show textboxes for date and region..and likewise... Or how to make use of gridview in this case?

Please suggest.

Thanks for reading.


Regardless of whether you WinForms of WPF, you should be make it easy to convert DataLayer to xml.

  • Get the schema of the xml (xsd one) and using Visual Studio xsd tool, convert it to C# class;
  • Then you can design your GUI around DataLayer and when you want to persist(save) you can use XmlSerializer to the work for you.
  • That way you will work against DataLayer and dont worry about persistance as it will be based on Xml Schema of your contract/request
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜