1、BPO新建服务端函数,在服务端业务提交后调用,参数:VCName
1 DBLayer.ProjectM.yq_projectplan objyq_projectplan = new DBLayer.ProjectM.yq_projectplan(); 2 DBLayer.ProjectM.yq_projectplanInfo objyq_projectplanInfo = new DBLayer.ProjectM.yq_projectplanInfo(); 3 string result = ""; 4 DataTable deltaTable = BC_projectplansLBase.deltaTable; 5 //获取VC字段 6 DataTable fieldArray = GetFieldArray(vcname); 7 //用户信息 8 string userID = base.loginUserInfo.UserOID.ToString(); 9 string userName = base.loginUserInfo.PersonName .ToString(); 10 string tableName = "yq_projectplan"; 11 string oldValue = "",newValue = ""; 12 UCMLCommon.DataChangeLog dlog = new UCMLCommon.DataChangeLog(); 13 14 for (int i = 0; i < deltaTable.Rows.Count; i++) 15 { 16 if (deltaTable.Rows[i].RowState == DataRowState.Modified){ 17 string COID = deltaTable.Rows[i]["yq_projectplanOID"].ToString();//数据主键 18 string NewOID = Guid.NewGuid().ToString(); 19 for(int j=0;j<fieldArray.Rows.Count;j++){ 20 string fieldname = fieldArray.Rows[j]["FieldName"].ToString(); 21 string fielddesc = fieldArray.Rows[j]["ChineseName"].ToString(); 22 //遍历判断每个字段 23 if (!deltaTable.Rows[i][""+fieldname+""].Equals(deltaTable.Rows[i][""+fieldname+"", DataRowVersion.Original])) 24 { 25 oldValue = deltaTable.Rows[i][""+fieldname+"", DataRowVersion.Original].ToString(); 26 newValue = deltaTable.Rows[i][""+fieldname+""].ToString();
//插入单个字段的修改记录 27 string resultlog = dlog.SetInsertLog(NewOID,userID,userName,tableName,COID,fieldname,fielddesc,oldValue,newValue,"修改","数据修改"); 28 } 29 } 30 //插入针对数据行变更的修改记录 31 string resultlogm = dlog.SetInsertLogM(NewOID,userID,userName,tableName,COID,"修改","修改保存成功"); 32 } 33 }
2、辅助函数
//查询当前VC前台显示的字段集合,用作辅助遍历判断是否修改值
StringBuilder commandText = new StringBuilder(); commandText.Append(" select FieldName,ChineseName from AppletColumn where AppletOID =(select AppletOID from Applet where AppletName = '"+vcname+"')"); SysDBModel.CodeValue Codeobj = new SysDBModel.CodeValue(); DataTable CodeTable = new DataTable(); Codeobj.ExecuteQuery(commandText.ToString(), CodeTable); return CodeTable;