3)通用字典管理核心业务流程图与数据库表关系图
4)通用字典管理关键点技术实现
1.字典保存数据实现
//保存数据 public Object SaveResultDataTable(int titleId, string IdName, object IdValue, Dictionary<string, object> fieldAndValue) { if (IdValue.Equals(System.DBNull.Value) == true)//插入数据 { string fields = ""; string values = ""; string strsql = "insert into {0} ({1}) values({2})"; foreach (KeyValuePair<string, object> val in fieldAndValue) { fields += (fields == "" ? "" : ",") + val.Key; values += (values == "" ? "" : ",") + ConvertDBValue(val.Value); } BaseGeneralTitle title = NewObject<BaseGeneralTitle>().getmodel(titleId) as BaseGeneralTitle; IdValue = oleDb.InsertRecord(string.Format(strsql, title.TableName, fields, values)); } else//更新数据 { string field_values = ""; string strsql = "update {0} set {1} where {2}"; foreach (KeyValuePair<string, object> val in fieldAndValue) { field_values += (field_values == "" ? "" : ",") + val.Key + "=" + ConvertDBValue(val.Value); } BaseGeneralTitle title = NewObject<BaseGeneralTitle>().getmodel(titleId) as BaseGeneralTitle; oleDb.DoCommand(string.Format(strsql, title.TableName, field_values, IdName + "=" + ConvertDBValue(IdValue))); } return IdValue; } |
2.Web版JqueryEasyUI的Gird控件动态列
<div id="resulttool" class="toolbar"> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-search" onclick="btnresult_search();">查询</a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-add" onclick="btnresult_addData();">增加</a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-edit" onclick="btnresult_editData();">编辑</a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-cancel" onclick="btnresult_delData();">删除</a> </div> <table id="resultGird" class="easyui-datagrid" fit="true" border="false" toolbar="#resulttool" iconCls="icon-edit" pagination="true" idField="<%=Session["resulstDataKeyName"]%>"> <thead> <tr> <th field="ck" checkbox="true"></th> <%=Session["resulstDatacolmodel"]%> </tr> </thead> </table> |