EnterpriseFrameWork框架基础功能之字典数据配置管理

发表于:2014-9-23 11:56

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:kakake    来源:51Testing软件测试网采编

  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>
22/2<12
《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号