7、EnterpriseFrameWork框架基礎功能之字典數據配置管理

        框架中的「通用字典數據配置管理」主要解決的問題是,全部的行業軟件給客戶實施第一步通常都是基礎數據的維護,一個系統的字典是少不了的,涉及業務範圍越廣字典就越多,若是每個字典數據都作一個界面來進行維護數據的話,那開發工做量仍是比較大的,因此得考慮設計一個通用的模塊來管理這些字典數據;sql

本文要點:數據庫

 

1)功能清單介紹框架

2)功能界面展現ide

3)核心業務流程圖與數據庫表關係圖ui

4)關鍵點的技術實現代碼spa

 

1)通用字典管理功能清單

模塊名稱設計

功能名稱3d

功能說明code

系統字典數據orm

基礎數據配置

字典分類目錄,新增、修改、刪除
字典管理,
1)選擇數據庫表添加字典
2)根據數據庫表字段,生成界面控件元素
3)對數據庫表進行增、刪、改、查操做

數據權限設置

配置系統角色能夠操做的字典

基礎數據管理

根據用戶登陸的角色顯示能夠操做的字典
字典維護,增、刪、改、查操做

 

2)通用字典管理界面展現,包括Winform版和Web版

 

 

 

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;
        }
View Code

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>
View Code
相關文章
相關標籤/搜索