public static string addNew(string strXml) { DataDoc doc = new DataDoc(strXml); // 创建执行对象 DataStorage storage = new DataStorage(); int size = doc.getDataNum(Table.USERLIST); // 解析sql语句 for (int i = 0; i < size; i++) { XmlElement ele = (XmlElement)doc.getDataNode(Table.USERLIST, i); string a = ele.InnerXml; XmlNode node = XmlFun.getNode(ele, Field.USERID); string strId = NumAssign.assignID_A("000002"); XmlFun.setNodeValue(node, strId); storage.addSQL(SQLAnalyse.analyseXMLSQL(ele)); } // 执行 string strReturn = storage.runSQL(); ReturnDoc returndoc = new ReturnDoc(); if (!General.empty(strReturn)) { returndoc.addErrorResult(Common.RT_FUNCERROR); returndoc.setFuncErrorInfo(strReturn); } else { returndoc.addErrorResult(Common.RT_SUCCESS); } return(returndoc.getXml()); }
public static string addNew(string strXml) { /// 创建执行对象 DataStorage obj_Storage = new DataStorage(); ReturnDoc obj_ReturnDoc = new ReturnDoc(); try { XmlDocument obj_Doc = XmlFun.CreateNewDoc(strXml); XmlNodeList nodeLst = obj_Doc.SelectNodes("//*[@operation][@operation!='']"); for (int i = 0; i < nodeLst.Count; i++) { XmlElement ele_Temp = (XmlElement)nodeLst.Item(i); // 分配学生编码 string strpersonid = NumAssign.assignID_B("100001", "1007"); XmlFun.setNodeValue(ele_Temp.SelectSingleNode("//PERSONID"), strpersonid); string stT = ele_Temp.InnerXml; // 创建插入数据的XML string str_SQL = SQLAnalyse.analyseXMLSQL(ele_Temp); obj_Storage.addSQL(str_SQL); } /// 执行 string str_Return = obj_Storage.runSQL(); if (!General.empty(str_Return)) { obj_ReturnDoc.addErrorResult(Common.RT_FUNCERROR); obj_ReturnDoc.setFuncErrorInfo(str_Return); } else { obj_ReturnDoc.addErrorResult(Common.RT_SUCCESS); } } catch (Exception e) { obj_ReturnDoc.addErrorResult(Common.RT_FUNCERROR); obj_ReturnDoc.setFuncErrorInfo(e.Message); } return(obj_ReturnDoc.getXml()); }