public static string drop(string strEventTypeID) { DataStorage storage = new DataStorage(); // 删除角色权限 string strSQL = "DELETE FROM ROLEPOWER WHERE EVENTTYPEID='" + strEventTypeID + "'"; storage.addSQL(strSQL); // 删除对应的事件 strSQL = "DELETE FROM EVENTTYPE WHERE EVENTTYPEID='" + strEventTypeID + "'"; storage.addSQL(strSQL); // 执行 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) { 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(); }
/// <summary> /// 删除角色 /// </summary> /// <param name="strRoleID"></param> /// <returns></returns> public static string DropRole(string strRoleID) { DataStorage storage = new DataStorage(); string str_SQL = "DELETE FROM ROLEBASIC WHERE ROLEID='" + strRoleID + "'"; storage.addSQL(str_SQL); str_SQL = "DELETE FROM ROLEPOWER WHERE ROLEID='" + strRoleID + "'"; storage.addSQL(str_SQL); str_SQL = "DELETE FROM ROLEUSER WHERE ROLEID='" + strRoleID + "'"; storage.addSQL(str_SQL); // 执行 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(); }
/// <summary> /// 统一处理标准的业务操作型XML文档,将文档分析称T-SQL封装到DataStorage类中作为一个事务执行 /// </summary> /// <param name="strXML">标准业务操作型XML文档</param> /// <returns>标准 XML 返回文档字符串</returns> public static string dealWithXml(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); // 创建插入数据的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(); }
/// <summary> /// 记录系统日志 /// </summary> /// <param name="arrSys"> /// 系统信息数组 /// 数组说明: /// arrSys[0] 用户编号 /// arrSys[1] 用户名称 /// arrSys[2] 用户姓名 /// arrSys[3] 用户人要素编号 /// arrSys[4] 用户单位编号 /// arrSys[5] 用户单位名称 /// arrSys[6] 登录计算机IP /// arrSys[7] 登录计算机网卡Mac地址 /// </param> /// <returns>系统登录编号</returns> public static string addSysLog(string[] arrSys) { /// 获得最大系统日志编号 string str_LogID = NumAssign.assignID_A(Common.MAX_SYSTEM_LOGID); string str_FieldList = General.addBracket(Field.LOGID + Common.COMMA + Field.USERID + Common.COMMA + Field.USERTITLE + Common.COMMA + Field.USERNAME + Common.COMMA + Field.PERSONID + Common.COMMA + Field.UNITID + Common.COMMA + Field.UNITNAME + Common.COMMA + Field.LOGINIP + Common.COMMA + Field.MAC + Common.COMMA + Field.ENTERTIME); string str_ValueList = General.addBracket(General.addQuotes(str_LogID) + Common.COMMA + General.addQuotes(arrSys[0]) + Common.COMMA + General.addQuotes(arrSys[1]) + Common.COMMA + General.addQuotes(arrSys[2]) + Common.COMMA + General.addQuotes(arrSys[3]) + Common.COMMA + General.addQuotes(arrSys[4]) + Common.COMMA + General.addQuotes(arrSys[5]) + Common.COMMA + General.addQuotes(arrSys[6]) + Common.COMMA + General.addQuotes(arrSys[7]) + Common.COMMA + General.dbDatetime()); string str_SQL = Common.INSERT + Table.SYSLOG + Common.SPACE + str_FieldList + Common.S_VALUES + str_ValueList; DataStorage obj_Storage = new DataStorage(); obj_Storage.addSQL(str_SQL); obj_Storage.runSQL(); return str_LogID; }
public static string psnDel(string strPersonID) { /// 创建执行对象 DataStorage obj_Storage = new DataStorage(); ReturnDoc obj_ReturnDoc = new ReturnDoc(); // 手工构造sql语句 string str_SQL = "DELETE FROM PERSON WHERE PERSONID='" + strPersonID + "'"; obj_Storage.addSQL(str_SQL); /// 执行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); } return obj_ReturnDoc.getXml(); }
/// <summary> /// 添加数据库操作错误日志 /// </summary> /// <param name="lst_SQL">错误的sqlList</param> public static void addErrorLog(List<string> lst_SQL) { DataStorage obj_Storage = new DataStorage(); foreach (string strSQL in lst_SQL) { string strPre = General.curYear2() + General.curMonth() + General.curDay(); string strObjID = NumAssign.assignID_B("000011", strPre); string str_SQL = "INSERT INTO SQLSTORAGE(OBJID,SQLSCRIPT) VALUES ('" + strObjID + "','" + strSQL.Replace(Common.QUOTE, Common.MARK) + "')"; obj_Storage.addSQL(str_SQL); } obj_Storage.runSQL(); }