XMLopr xmlpro = new XMLopr (); string xmlpath = WebConfigurationManager. appSettings ["fileinfo_Filexmlpath"]. toString (); xmlpath = Server. mapPath (xmlpath); Dictionary <string, string> filedmap = xmlpro. readXmlFiled (xmlpath); if (filedmap = null) {result = "An error occurred while reading the field matching setting document! "; Return result;} int I = 0; foreach (KeyValuePair <string, string> keypair in filedmap) {// obtain the string value = dr [keypair. key. trim ()] = null? "": Dr [keypair. key. trim ()]. toString (). trim (); // obtain the string ing field string mapfiled = keypair. value. trim (); // determine the ing field type PropertyInfo property = fileModel. getType (). getProperty (mapfiled); if (property. propertyType. name. toLower (). equals ("string") {property. setValue (fileModel, value, null);} else if (property. propertyType. name. equals ("int32") {property. setValue (fileModel, int. parse (value), null);} else if (property. propertyT Ype. Name. Equals ("DateTime") {if (value. Trim ()! = String. Empty) property. SetValue (fileModel, DateTime. Parse (value), null );}}
This article is from the "technician" blog, please be sure to keep this source http://1777783.blog.51cto.com/1767783/1281586