明源售楼系统技术解析—诚意认购(一)
2015-05-28 20:38
387 查看
明源售楼系统技术解析—诚意认购(一)
诚意认购主要包括房间的诚意认购、诚意认购退订与诚意认购转号,以及修改和删除。在开盘前客户往往可交一定的诚意金,对项目或者房间进行预先排队,待开盘时再正式对房间进行认购,如有不满还可以进行退订与转好操作,且该操作记录可以在该窗体的分页面中查询出来。本次分析的是添加诚意认购前逻辑处理。
![](http://img.blog.csdn.net/20150528204047433?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
从界面上可以看到我们这里用到的控件有
在打开窗体之前绑定诚意单数据到Dgv的功能实现:
控件使用方法
1、窗体控件(easyui-window)
控件效果截图:
![](http://img.blog.csdn.net/20150528204422520?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
html代码
jQuery代码
2、选择卡(easyui-tabs)
作用:用于在同一个窗体内,多个界面之间进行跳转。
控件效果截图:
![](http://img.blog.csdn.net/20150528204610831?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
html代码
3、表格(easyui-datagrid)
作用:用于同一类的数据批量的绑定
控件效果截图:
![](http://img.blog.csdn.net/20150528205222587?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
html代码
jQuery代码
1.表格数据的绑定
第一步:数据库
1、表与表之间的关系
![](http://img.blog.csdn.net/20150528205509155?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
表1:SYS_ProjectTable(SYS_项目表)
用于存放项目录入的消息
表2:SYS_AttributeAssembleDetailTable(SYS属性集合明细表)
用于记录简单的数据
表3:SYS_HouseTable(SYS 楼栋表)
表4:SYS_RoomDataTable (SYS_房间资料表)
表5:PW_SinceritySubscribeTable(诚意认购表)
表6:SYS_ProjectSubregionTable(项目分区)
表7:SYS_ClientDatumTable(客户资料表)
2、储存过程
下面是查询诚意认购单的具体储存过程的代码:
3、逻辑层(BLL层)
BLL代码解析如下图
![](http://img.blog.csdn.net/20150528205748921?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
具体代码如下:
4、控制器代码
首先我们新建一个控制器,写一个转换list格式的数据的方法(是一个被其他控制器调用的封装的方法)如下图:
![](http://img.blog.csdn.net/20150528205942269?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
![](http://img.blog.csdn.net/20150528210007064?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
然后再新建一个新的控制器:
查询诚意认购单的控制器具体代码如下:
5、视图层代码
html代码
jquer代码
![](http://img.blog.csdn.net/20150528210148103?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
具体代码如下:
当点击添加按钮时弹出一个输入客户资料的窗体
![](http://img.blog.csdn.net/20150528210237880?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
功能实现代码如下
Html代码:
Jquer代码:
若属于新客户时,则点击〖新增〗按钮,进行第三步:填写客户详细资料。打开的窗口如下
![](http://img.blog.csdn.net/20150528210835703?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
录入客户信息后,点击〖下一步〗按钮添加客户并进入“诚意认购资料”窗体
第一步:数据库
表与表之间的关系
![](http://img.blog.csdn.net/20150528210903308?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
储存过程
第二步:BLL层
第三步:控制器代码
第四步:View代码
html代码
jQuery代码
若输入的客户名称已经登记在本系统中时,点击〖下一步〗按钮,打开“第二步:请选择匹配客户”窗口如下图,系统将所有与输入的名称相匹配的客户全部列出供用户选择。
![](http://img.blog.csdn.net/20150528211310392?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
第一步:数据库
表与表之间的关系
![](http://img.blog.csdn.net/20150528211335176?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvR1hfTmllTWluSmlhbg==/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
储存过程
第二步:BLL层
第三步:控制器代码
第四部:View代码
html代码
JQuery代码
仅供于学习,禁止用于商业用途
诚意认购主要包括房间的诚意认购、诚意认购退订与诚意认购转号,以及修改和删除。在开盘前客户往往可交一定的诚意金,对项目或者房间进行预先排队,待开盘时再正式对房间进行认购,如有不满还可以进行退订与转好操作,且该操作记录可以在该窗体的分页面中查询出来。本次分析的是添加诚意认购前逻辑处理。
从界面上可以看到我们这里用到的控件有
控件名称 | 说明 |
窗体控件(easyui-window) | 第一要设置每个控件的id,第二设置大小不设置也有默认,第三(data-options)是数据操作:可以设置控件的一些属性和事件 |
下拉树(easyui-tree) | |
选项卡(easyui-tabs) | |
单行文本控件(easyui-textbox) | |
按钮(easyui-linkbutton) | |
表格(easyui-datagrid) |
控件使用方法
1、窗体控件(easyui-window)
控件效果截图:
html代码
<div class="easyui-window" id="w输入客户资料" title="输入客户资料" style="width:450px;height:210px"> </div>
jQuery代码
$('#w输入客户资料').window('close');//根据窗体的ID控制窗体关闭 $('#w输入客户资料').window('open'); //根据窗体的ID控制窗体打开
2、选择卡(easyui-tabs)
作用:用于在同一个窗体内,多个界面之间进行跳转。
控件效果截图:
html代码
<div class="easyui-window" title="诚意认购" data-options="fit:true" style="width:1108px;height:585px"> <div id="tt" class="easyui-tabs" data-options="maxminzed:true">//选项卡控件 <div title="诚意认购管理">//设置选项卡一的名称 <div class="easyui-panel">//容器 @*控件内容*@ </div> </div> <div title="诚意认购退订查询">//设置选项卡二的名称 <div class="easyui-panel">//容器 @*控件内容*@ </div> </div> <div title="诚意认购转号查询">//设置选项卡三的名称 <div class="easyui-panel">//容器 @*控件内容*@ </div> </div> </div> </div>
3、表格(easyui-datagrid)
作用:用于同一类的数据批量的绑定
控件效果截图:
html代码
<table class="easyui-datagrid" id="dg_诚意认购" style="width:935px;height:475px" data-options="singleSelect:true "> <thead> <tr> <th data-options="field:'SinceritySubscribeID',width:120,hidden:true,align:'center'">诚意认购ID</th>//【hidden】是指在界面隐藏属于这一列的数据 <th data-options="field:'XuHao',width:80,align:'center'">序号</th>//【field】是指从数据库传递过来的数据的列名 <th data-options="field:'BusinessCode',width:140,align:'center'">业务编码</th> <th data-options="field:'RoomCode',width:120,align:'center'">房间代码</th> <th data-options="field:'ClientName',width:120,align:'center'">客户名称</th> <th data-options="field:'YeWuZhuangTai',width:120,align:'center'">状态</th> <th data-options="field:'XiangMuPaiHao',width:120,align:'center'">项目排号</th> <th data-options="field:'ShiJiPaiHao',width:120,align:'center'">实际排号</th> <th data-options="field:'DengJiRiQi',width:120,align:'center'">登记日期</th> <th data-options="field:'YouXiaoRiQi',width:120,align:'center'">有效日期</th> <th data-options="field:'SincerityMoney',width:120,align:'center'">诚意金额</th> <th data-options="field:'BieZhong',width:120,align:'center'">币种</th> <th data-options="field:'UserName',width:120,align:'center'">经办人</th> <th data-options="field:'SinceritySubscribeRemarks',width:120,align:'center'">详情备注</th> </tr> </thead> </table>
jQuery代码
1.表格数据的绑定
$.getJSON("/XiaoShouQianTai/SelectSinceritySubscribeTable", function (data) { $('#dg_诚意认购').datagrid('loadData', data); });2.获取表格的所有数据赋值给变量data
var data = $('#dg_诚意认购').datagrid('getData');3.获取表格当前选中的行的数据赋值给变量data
var data = $('#dg_诚意认购').datagrid('getSelected');
第一步:数据库
1、表与表之间的关系
表1:SYS_ProjectTable(SYS_项目表)
用于存放项目录入的消息
列名 | 类型 | 主键/外键 | 说明 |
ProjectID | int - Identity | 主键 | 项目ID |
PremisesName | nchar (100) | 楼盘名称 | |
ProjectCode | nchar (100) | 项目代码 | |
ProjectName | nchar (100) | 项目名称 | |
BuildingPropertyID | int | 外键 | 建筑性质ID |
StructureID | int | 外键 | 结构ID |
PlotRatio | decimal (18, 3) | 容积率 | |
RealEstateNumber | nchar (100) | 项目房地产证号 | |
DomesticLicence | nchar (100) | 内销许可证 | |
ExportLicence | nchar (100) | 外销许可证 | |
SupervisionInstitutionID | int | 外键 | 监理机构ID |
ProjectRowNumber | int | 项目排号 | |
MassifNumber | nchar (100) | 项目地块编号 | |
LandArea | nchar (100) | 项目土地面积 | |
LandSellContractNumber | nchar (100) | 项目土地出让合同号 | |
LandUserBeginTime | nchar (100) | 项目土地使用开始时间 | |
LandUserEndTime | nchar (100) | 项目土地使用结束时间 | |
LandPurpose | nchar (100) | 项目土地用途 | |
AreaTypeID | int | 外键 | 项目面积类型ID |
用于记录简单的数据
列名 | 类型 | 主键/外键 | 说明 |
AttributeAssembleDetailID | int - Identity | 主键 | 属性集合明细ID |
AttributeAssembleDetailName | nchar (100) | 属性集合ID | |
AttributeAssembleID | int | 外键 | 属性集合明细名称 |
AttributeAssembleDetailFar_ID | int | 属性集合明细Far_ID |
列名 | 类型 | 主键/外键 | 说明 |
HouseID | int - Identity | 主键 | 楼栋ID |
HouseCode | nchar (40) | 楼栋代码 | |
HouseName | nchar (40) | 楼栋名称 | |
RoomNumberModelTypeID | int | 外键 | 房间编号模式类型ID |
ContractHouseName | nchar (40) | 合同栋号名称 | |
GiveHouseStandardID | int | 外键 | 交屋标准ID |
ShouldGiveHouseDate | date | 应交房日期 | |
BriefRemarks | nchar (80) | 简要备注 | |
NumberOfPlies | int | 层数 | |
BuildingPropertyID | int | 外键 | 建筑性质ID |
SupervisionInstitutionID | int | 外键 | 监理机构ID |
EstateNumber | nchar (80) | 楼栋房地产证号 | |
MassifNumber | nchar (80) | 楼栋地块编号 | |
LandArea | decimal (18, 3) | 楼栋土地面积 | |
LandSellAgreementNumber | nchar (80) | 楼栋土地出让合同号 | |
LandUserBeginDate | date | 楼栋土地使用开始时间 | |
LandUserEndDate | date | 楼栋土地使用结束时间 | |
HouseLandUse | nchar (80) | 楼栋土地用途 | |
HouseAreaTypeID | int | 外键 | 楼栋面积类型ID |
ProjectSubregionID | int | 外键 | 项目所属ID |
StructureID | int | 外键 | 架构ID |
列名 | 类别 | 主键/外键 | 说明 |
RoomDataID | int - Identity | 主键 | 房间资料ID |
HouseID | int | 外键 | 楼栋ID |
RoomCode | nchar (50) | 房间代码 | |
RoomUnit | nchar (10) | 房间单元 | |
RoomNumber | nchar (20) | 房号 | |
natureNumber | nchar (20) | 自然层号 | |
Floor | nchar (20) | 楼层号 | |
ColumnNumber | nchar (20) | 列号 | |
CoveredArea | decimal (18, 3) | 建筑面积 | |
BuilDingExceptArea | decimal (18, 3) | 套内面积 | |
AreaShare | decimal (18, 3) | 分摊面积 | |
BalconyArea | decimal (18, 3) | 阳台面积 | |
RoomFaceDirectionID | int | 外键 | 朝 向 |
LandscapeID | int | 外键 | 景观ID |
HouseTypeID | int | 外键 | 户型ID |
RoomTypeID | int | 外键 | 房间类型ID |
RoomRanking | nchar (20) | 房间排号 | |
OnbuildingExceptAreaCountNot | bit | 按套内面积计算否 | |
LockNot | bit | 是否锁定 | |
CountWayID | int | 外键 | 计算方式ID |
RoomDescribeID | int | 外键 | |
SellStatusID | int | 外键 | 销售状态ID |
AffiliatedHousePropertyNot | bit | ||
BuildingPropertiesID | int | ||
BuildingNot | bit | ||
ZhuangTaiWeiZhenFou | bit | 状态为真否 |
Field | Type | 主键/外键 | 说明 |
SinceritySubscribeID | int - Identity | 主键 | 诚意认购表,诚意认购ID |
DecorateStandardID | int | 外键 | 业务状态表,业务状态ID |
BusinessCode | nchar (100) | 业务代码 | |
RoomDataID | int | 外键 | 房间资料表,房间资料ID |
ClientDatumID | int | 外键 | 客户资料表,客户资料ID |
SinceritySubscribeStatusID | int | 外键 | 属性明细表,诚意认购状态ID |
ItemNumber | nchar (100) | 项目排号 | |
RealityNumber | nchar (100) | 实际排号 | |
SinceritySubscribeRegisterDate | date | 诚意认购登记日期 | |
SinceritySubscribeValidDate | date | 诚意认购有效期 | |
SincerityMoney | money | 诚意金额 | |
CurrencyID | int | 外键 | 属性明细表,币种ID |
SinceritySubscribeRemarks | nchar (100) | 诚意认购详情备注 | |
CountermandNot | bit | 退订否 | |
CountermandDate | date | 退订日期 | |
CountermandMoney | money | 退订金额 | |
CountermandReason | nchar (100) | 退订原因 | |
DeleteNot | bit | 报废否 | |
ChangeNot | bit | 变更否 | |
ChangeNumBerDate | date | 变更日期 | |
ChangeNumberIltemID | int | 外键 | 转号后项目ID |
AfterChangeNumberRoomID | int | 外键 | 转号后房间ID |
FirstChangeRoomID | int | 外键 | 转号前房间ID |
ChangeReason | nchar (100) | 转号原因 | |
UpdateNot | bit | 修改否 | |
FirstUpadteSubscribeIID | int | 外键 | 修改前认购ID |
AfterUpdateSubscribeIID | int | 外键 | 修改后认购ID |
DiscardNot | bit | 报废否 | |
ProfessionalWorkStatusID | int | 外键 | 业务状态表,业务状态ID |
UserID | int | 外键 | 用户表,用户ID |
Field | Type | 主键/外键 | 说明 |
ProjectSubregionID | int - Identity | 主键 | 项目分区ID |
ProjectSubregionName | nchar (100) | 外键 | 项目分区名称 |
ProjectID | int | 外键 | 项目ID |
Field | Type | 主键/外键 | 说明 |
ClientDatumID | int - Identity | 主键 | 客户资料ID |
ClientCode | nchar (30) | 客户代码 | |
ClientTypeID | int | 外键 | 客户类型ID |
SalesmanID | int | 外键 | 业务员ID |
ClientName | nchar (20) | 客户名称 | |
Nationality | nchar (20) | 国籍 | |
Sex | nchar (10) | 性别 | |
ClientContactNumber | int | 客户联系电话 | |
ClientMobilePhone | int | 客户手机 | |
ClientPortraiture | nchar (30) | 客户传真 | |
ClientAddress | nchar (80) | 客户地址 | |
ClientZipCode | nchar (50) | 客户邮编 | |
ClientcredentialsNumber | nchar (70) | 客户证件号码 | |
ClientcredentialsName | nchar (30) | 客户证件名称 | |
ClientVisitDate | date | 客户到访日期 | |
ClientBirthday | date | 客户出生日期 | |
ClientEmail | nchar (40) | 客户电子邮件 | |
ClientJobUnit | nchar (40) | 客户工作单位 | |
ClientDuties | nchar (40) | 客户职务 | |
ClientDatumRemarks | nchar (80) | 客户资料备注 | |
LiveArea | nchar (50) | 居住区域 | |
JobArea | nchar (50) | 工作区域 | |
Education | nchar (40) | 教育程度 | |
AgeGroup | nchar (40) | 年龄段 | |
FamilyStructure | nchar (40) | 家庭结构 | |
MaritalStatus | nchar (10) | 婚姻状况 | |
FamilyIncome | nchar (80) | 家庭收入 | |
Occupation | nchar (50) | 职业 | |
KnowRoad | nchar (50) | 认识途径 | |
ManagerSuggestion | nchar (80) | 经理意见 | |
DuplicateMarkingNot | bit | 重复标识否 | |
CorporationName | nchar (50) | 公司名称 | |
CorporationJuridicalPerson | nchar (40) | 公司法人 | |
JuridicalPersonCD | nchar (80) | 法人证件 | |
CorporationPhone | int | 公司电话 | |
CorporationAddress | nchar (80) | 公司地址 | |
ClientDatumDiscardNot | bit |
下面是查询诚意认购单的具体储存过程的代码:
if @Type='SelectSinceritySubscribeTable' begin SELECT PW_SinceritySubscribeTable.SinceritySubscribeID, PW_SinceritySubscribeTable.BusinessCode, SYS_RoomDataTable.RoomCode, SYS_ClientDatumTable.ClientName, LTRIM(RTRIM(SYS_AttributeAssembleDetailTable.AttributeAssembleDetailName)) AS YeWuZhuangTai, PW_SinceritySubscribeTable.ItemNumber, PW_SinceritySubscribeTable.RealityNumber, PW_SinceritySubscribeTable.SinceritySubscribeRegisterDate, PW_SinceritySubscribeTable.SinceritySubscribeValidDate, PW_SinceritySubscribeTable.SincerityMoney, SYS_AttributeAssembleDetailTable_1.AttributeAssembleDetailName AS BieZhong, PW_SinceritySubscribeTable.SinceritySubscribeRemarks, SYS_UserTable.UserName, PW_SinceritySubscribeTable.ProfessionalWorkStatusID, SYS_ProjectTable.ProjectName, PW_SinceritySubscribeTable.CurrencyID, SYS_ClientDatumTable.ClientDatumID FROM SYS_HouseTable INNER JOIN SYS_RoomDataTable ON SYS_HouseTable.HouseID = SYS_RoomDataTable.HouseID INNER JOIN SYS_ProjectSubregionTable ON SYS_HouseTable.ProjectSubregionID = SYS_ProjectSubregionTable.ProjectSubregionID INNER JOIN SYS_ProjectTable ON SYS_ProjectSubregionTable.ProjectID = SYS_ProjectTable.ProjectID RIGHT OUTER JOIN PW_SinceritySubscribeTable INNER JOIN SYS_UserTable ON PW_SinceritySubscribeTable.UserID = SYS_UserTable.UserID ON SYS_RoomDataTable.RoomDataID = PW_SinceritySubscribeTable.RoomDataID LEFT OUTER JOIN SYS_ClientDatumTable ON PW_SinceritySubscribeTable.ClientDatumID = SYS_ClientDatumTable.ClientDatumID LEFT OUTER JOIN SYS_AttributeAssembleDetailTable ON PW_SinceritySubscribeTable.ProfessionalWorkStatusID = SYS_AttributeAssembleDetailTable.AttributeAssembleDetailID LEFT OUTER JOIN SYS_AttributeAssembleDetailTable AS SYS_AttributeAssembleDetailTable_1 ON PW_SinceritySubscribeTable.CurrencyID = SYS_AttributeAssembleDetailTable_1.AttributeAssembleDetailID where PW_SinceritySubscribeTable.DeleteNot='False' end
3、逻辑层(BLL层)
BLL代码解析如下图
具体代码如下:
<pre name="code" class="csharp"> public DataTable SelectSinceritySubscribeTable() { SqlParameter[] SQLCMDpas = { new SqlParameter("@Type",SqlDbType.Char), }; SQLCMDpas[0].Value = "SelectSinceritySubscribeTable"; DataTable dt = myDALMethod.DAL_SelectDB_Par("PW_SinceritySubscribe", SQLCMDpas); return dt; }
</pre><pre>
4、控制器代码
首先我们新建一个控制器,写一个转换list格式的数据的方法(是一个被其他控制器调用的封装的方法)如下图:
然后再新建一个新的控制器:
查询诚意认购单的控制器具体代码如下:
BLL销售前台.frmChengYiRenGou myfrmChengYiRenGou = new BLL销售前台.frmChengYiRenGou();//实例化逻辑层 public ActionResult SelectSinceritySubscribeTable() { DataTable dt = myfrmChengYiRenGou.SelectSinceritySubscribeTable(); dt.Columns.Add("DengJiRiQi", typeof(string));//在表格dt中新增一列,用于登记日期格式转换 dt.Columns.Add("YouXiaoRiQi", typeof(string));//在表格dt中新增一列,用于有效日期格式转换 dt.Columns.Add("XuHao", typeof(string)); dt.Columns.Add("XiangMuPaiHao", typeof(string)); dt.Columns.Add("ShiJiPaiHao", typeof(string)); int PaiHaoShu = 0;//用于储存当前排号数 for (int i = 0; i < dt.Rows.Count; i++) { DateTime DengJiRiQi = Convert.ToDateTime(dt.Rows[i]["SinceritySubscribeRegisterDate"].ToString());//获取表格中第i行的登记日期 DateTime YouXiaoRiQi = Convert.ToDateTime(dt.Rows[i]["SinceritySubscribeValidDate"].ToString());//获取表格中第i行的有效日期 dt.Rows[i]["DengJiRiQi"] = DengJiRiQi.Year + "-" + DengJiRiQi.Month + "-" + DengJiRiQi.Day;//获取表格中第i行的登记日期的年月日加上格式在拼接起来 dt.Rows[i]["YouXiaoRiQi"] = YouXiaoRiQi.Year + "-" + YouXiaoRiQi.Month + "-" + YouXiaoRiQi.Day;//获取表格中第i行的有效日期的年月日加上格式在拼接起来 dt.Rows[i]["XiangMuPaiHao"] = dt.Rows[i]["SinceritySubscribeID"].ToString(); dt.Rows[i]["XuHao"] = i + 1; if (dt.Rows[i]["YeWuZhuangTai"].ToString() == "排号") { dt.Rows[i]["ShiJiPaiHao"] = PaiHaoShu + 1; PaiHaoShu++; } else { dt.Rows[i]["ShiJiPaiHao"] = 0; } } List<Dictionary<string, object>> ListReturn = ConvertHelper.DtToList(dt);//通过附加的类的方法ConvertHelper.DtToList()转换dt的格式 return Json(ListReturn, JsonRequestBehavior.AllowGet);//用Json的方法将数据传递到视图层 }
5、视图层代码
html代码
<div data-options="region:'center'" style="width:958px;height:475px"> <table class="easyui-datagrid" id="dg_诚意认购" style="width:935px;height:475px" data-options="singleSelect:true,onClickRow:onClickRowGetRenGouID"> <thead> <tr> <th data-options="field:'SinceritySubscribeID',width:120,hidden:true,align:'center'">诚意认购ID</th> <th data-options="field:'XuHao',width:80,align:'center'">序号</th> <th data-options="field:'BusinessCode',width:140,align:'center'">业务编码</th> <th data-options="field:'RoomCode',width:120,align:'center'">房间代码</th> <th data-options="field:'ClientName',width:120,align:'center'">客户名称</th> <th data-options="field:'YeWuZhuangTai',width:120,align:'center'">状态</th> <th data-options="field:'XiangMuPaiHao',width:120,align:'center'">项目排号</th> <th data-options="field:'ShiJiPaiHao',width:120,align:'center'">实际排号</th> <th data-options="field:'DengJiRiQi',width:120,align:'center'">登记日期</th> <th data-options="field:'YouXiaoRiQi',width:120,align:'center'">有效日期</th> <th data-options="field:'SincerityMoney',width:120,align:'center'">诚意金额</th> <th data-options="field:'BieZhong',width:120,align:'center'">币种</th> <th data-options="field:'UserName',width:120,align:'center'">经办人</th> <th data-options="field:'SinceritySubscribeRemarks',width:120,align:'center'">详情备注</th> </tr> </thead> </table> </div>
jquer代码
具体代码如下:
<script type="text/javascript"> function SelectSinceritySubscribeTable() { $.getJSON("/XiaoShouQianTai/SelectSinceritySubscribeTable", function (data) { $('#dg_诚意认购').datagrid('loadData', data); }); } </script>
当点击添加按钮时弹出一个输入客户资料的窗体
功能实现代码如下
Html代码:
<td><a id="btnTianJia" onclick="OpenChuangTi('#w输入客户资料'),QingKongKeHuZhi()" class="easyui-linkbutton">添加</a></td>
Jquer代码:
function OpenChuangTi(KongJianID) {// 参数KongJianID为Html代码传递过来的目标窗体的ID $(KongJianID).window('open'); }
若属于新客户时,则点击〖新增〗按钮,进行第三步:填写客户详细资料。打开的窗口如下
录入客户信息后,点击〖下一步〗按钮添加客户并进入“诚意认购资料”窗体
第一步:数据库
表与表之间的关系
储存过程
if @Type='AddClient'//添加客户资料 begin Insert into SYS_ClientDatumTable(ClientTypeID, SalesmanID, ClientcredentialsNumber, ClientcredentialsName, ClientAddress, ClientZipCode, ClientContactNumber, ClientMobilePhone, ClientPortraiture, Nationality, ClientBirthday, Sex, ClientDuties, ClientEmail, ClientJobUnit, CorporationName, CorporationJuridicalPerson, JuridicalPersonCD, CorporationPhone, CorporationAddress,ClientName,ClientCode) values (@ClientTypeID, @SalesmanID, @ClientcredentialsNumber, @ClientcredentialsName, @ClientAddress, @ClientZipCode, @ClientContactNumber, @ClientMobilePhone, @ClientPortraiture, @Nationality, @ClientBirthday, @Sex, @ClientDuties, @ClientEmail, @ClientJobUnit,@CorporationName, @CorporationJuridicalPerson, @JuridicalPersonCD, @CorporationPhone, @CorporationAddress, @ClientName,@ClientCode) select @@IDENTITY end if @Type='SelectRoomSubordinate'//根据业务员ID跟客户业务ID查询客户所属 业务状态 begin SELECT ClientBusinessStatusSubordinateID, UserID, ClientBusinessStatusID FROM SYS_ClientBusinessStatusSubordinateTable where SYS_ClientBusinessStatusSubordinateTable.UserID=@YongHuID and SYS_ClientBusinessStatusSubordinateTable.ClientBusinessStatusID= @KeHuYeWuZhuangTaiID end if @Type='AddClientSubordinate'//添加客户所属的项目 begin Insert into SYS_ClientSubordinateTable(ClientDatumID, ProjectID, ClientBusinessStatusSubordinateID, StatusFollowUpDate, ClientSubordinateDiscardNot) values(@KeHuZiLiaoID, @XiangMuID, @KeHuYeWuZhuangTaiSuoShuID, @ZhuangTaiGengJinRiQi, @KeHuSuoShuBaoFeiFou) end
第二步:BLL层
//添加客户基本资料 public DataTable AddClient(int ClientTypeID,int SalesmanID, int ClientcredentialsNumber, string ClientcredentialsName, string ClientAddress, string ClientZipCode, int ClientContactNumber, string ClientMobilePhone, string ClientPortraiture, string Nationality, string ClientBirthday, string Sex, string ClientDuties,string ClientEmail, string ClientJobUnit, string CorporationName, string CorporationJuridicalPerson, string JuridicalPersonCD, string CorporationPhone, string CorporationAddress, string ClientName, int ClientCode) { SqlParameter[] SQLCMDpas = { new SqlParameter("@Type",SqlDbType.Char), new SqlParameter("@ClientTypeID",SqlDbType.Int), new SqlParameter("@SalesmanID",SqlDbType.Int), new SqlParameter("@ClientcredentialsNumber",SqlDbType.Int), new SqlParameter("@ClientcredentialsName",SqlDbType.Char), new SqlParameter("@ClientAddress",SqlDbType.Char), new SqlParameter("@ClientZipCode",SqlDbType.Char), new SqlParameter("@ClientContactNumber",SqlDbType.Int), new SqlParameter("@ClientMobilePhone",SqlDbType.Char), new SqlParameter("@ClientPortraiture",SqlDbType.Char), new SqlParameter("@Nationality",SqlDbType.Char), new SqlParameter("@ClientBirthday",SqlDbType.Char), new SqlParameter("@Sex",SqlDbType.Char), new SqlParameter("@ClientDuties",SqlDbType.Char), new SqlParameter("@ClientEmail",SqlDbType.Char), new SqlParameter("@ClientJobUnit",SqlDbType.Char), new SqlParameter("@CorporationName",SqlDbType.Char), new SqlParameter("@CorporationJuridicalPerson",SqlDbType.Char), new SqlParameter("@JuridicalPersonCD",SqlDbType.Char), new SqlParameter("@CorporationPhone",SqlDbType.Char), new SqlParameter("@CorporationAddress",SqlDbType.Char), new SqlParameter("@ClientName",SqlDbType.Char), new SqlParameter("@ClientCode",SqlDbType.Int), }; SQLCMDpas[0].Value="AddClient"; SQLCMDpas[1].Value=ClientTypeID; SQLCMDpas[2].Value=SalesmanID; SQLCMDpas[3].Value=ClientcredentialsNumber; SQLCMDpas[4].Value=ClientcredentialsName; SQLCMDpas[5].Value=ClientAddress; SQLCMDpas[6].Value=ClientZipCode; SQLCMDpas[7].Value=ClientContactNumber; SQLCMDpas[8].Value=ClientMobilePhone; SQLCMDpas[9].Value=ClientPortraiture; SQLCMDpas[10].Value=Nationality; SQLCMDpas[11].Value=ClientBirthday; SQLCMDpas[12].Value=Sex; SQLCMDpas[13].Value=ClientDuties; SQLCMDpas[14].Value=ClientEmail; SQLCMDpas[15].Value=ClientJobUnit; SQLCMDpas[16].Value=CorporationName; SQLCMDpas[17].Value=CorporationJuridicalPerson; SQLCMDpas[18].Value=JuridicalPersonCD; SQLCMDpas[19].Value=CorporationPhone; SQLCMDpas[20].Value=CorporationAddress; SQLCMDpas[21].Value = ClientName; SQLCMDpas[22].Value = ClientCode; DataTable dt = myDALMethod.DAL_SelectDB_Par("PW_SinceritySubscribe", SQLCMDpas); return dt; } //根据业务员ID跟客户业务ID查询客户所属业务状态 public DataTable ChaXunFangJianSuoShu(int YongHuID, int KeHuYeWuZhuangTaiID) { SqlParameter[] SQLCMDpas = { new SqlParameter("@Type",SqlDbType.Char), new SqlParameter("@YongHuID",SqlDbType.Char), new SqlParameter("@KeHuYeWuZhuangTaiID",SqlDbType.Char), }; SQLCMDpas[0].Value = "SelectRoomSubordinate"; SQLCMDpas[1].Value = YongHuID; SQLCMDpas[2].Value = KeHuYeWuZhuangTaiID; DataTable dt = myDALMethod.DAL_SelectDB_Par("SYS_ForegroundClientManage", SQLCMDpas); return dt; } //添加客户所属的项目 public int TianJianKeHuSuoShu(string KeHuZiLiaoID, string XiangMuID, string KeHuYeWuZhuangTaiSuoShuID, string ZhuangTaiGengJinRiQi) { SqlParameter[] SQLCMDpas = { new SqlParameter("@Type",SqlDbType.Char), new SqlParameter("@KeHuZiLiaoID",SqlDbType.Char), new SqlParameter("@XiangMuID",SqlDbType.Char), new SqlParameter("@KeHuYeWuZhuangTaiSuoShuID",SqlDbType.Char), new SqlParameter("@ZhuangTaiGengJinRiQi",SqlDbType.Char), new SqlParameter("@KeHuSuoShuBaoFeiFou",SqlDbType.Char), }; SQLCMDpas[0].Value = "AddClientSubordinate"; SQLCMDpas[1].Value = KeHuZiLiaoID; SQLCMDpas[2].Value = XiangMuID; SQLCMDpas[3].Value = KeHuYeWuZhuangTaiSuoShuID; SQLCMDpas[4].Value = ZhuangTaiGengJinRiQi; SQLCMDpas[5].Value = "False"; int i = myDALMethod.DAL_OPTableDB_Par("SYS_ForegroundClientManage", SQLCMDpas); return i; }
第三步:控制器代码
//添加客户基本资料 public ActionResult AddClient(int ClientTypeID, int SalesmanID, int ClientcredentialsNumber, string ClientcredentialsName, string ClientAddress, string ClientZipCode, int ClientContactNumber, string ClientMobilePhone, string ClientPortraiture, string Nationality, string ClientBirthday, string Sex, string ClientDuties, string ClientEmail, string ClientJobUnit, string CorporationName, string CorporationJuridicalPerson, string JuridicalPersonCD, string CorporationPhone, string CorporationAddress, string ClientName) { DataTable dt2 = myfrmKeHuGuanLi.SelectBianHaoBiao(); int KeHuDaiMa2 = Convert.ToInt32(dt2.Rows[0]["ClientCode"]); DataTable dt = myfrmChengYiRenGou.AddClient(ClientTypeID, SalesmanID, ClientcredentialsNumber, ClientcredentialsName, ClientAddress, ClientZipCode, ClientContactNumber, ClientMobilePhone, ClientPortraiture, Nationality, ClientBirthday, Sex, ClientDuties, ClientEmail, ClientJobUnit, CorporationName, CorporationJuridicalPerson, JuridicalPersonCD, CorporationPhone, CorporationAddress, ClientName, KeHuDaiMa2); string ID = dt.Rows[0][0].ToString(); return Content(ID); } //根据业务员ID跟客户业务ID查询客户所属业务状态 public ActionResult ChaXunFangJianSuoShu(int YongHuID, int KeHuYeWuZhuangTaiID) { DataTable dt = myfrmKeHuGuanLi.ChaXunFangJianSuoShu(YongHuID, KeHuYeWuZhuangTaiID); string KeHuYeWuZhuangTaiSuoShuID = dt.Rows[0]["ClientBusinessStatusSubordinateID"].ToString(); return Content(KeHuYeWuZhuangTaiSuoShuID); } //添加客户所属的项目 public ActionResult TianJianKeHuSuoShu(string KeHuZiLiaoID, string XiangMuID, string KeHuYeWuZhuangTaiSuoShuID ) { string strMon = DateTime.Now.Month.ToString();//时间格式转换 if (Convert.ToInt32(strMon) < 10) { strMon = "0" + strMon; } string strDay = DateTime.Now.Day.ToString(); if (Convert.ToInt32(strDay) < 10) { strDay = "0" + strDay; } string ZhuangTaiGengJinRiQi = DateTime.Now.Year.ToString() + "-" + strMon + "-" + strDay; int i = myfrmKeHuGuanLi.TianJianKeHuSuoShu(KeHuZiLiaoID, XiangMuID, KeHuYeWuZhuangTaiSuoShuID, ZhuangTaiGengJinRiQi); return Content(i.ToString()); }
第四步:View代码
html代码
<div class="easyui-window" id="w客户资料" title="输入客户资料" style="width:580px;height:380px"> <table> <tr><td style="color: #FF0000; font-family: 华文行楷; font-size: large;">第三步:填写客户详细资料</td></tr> </table> <table> <tr> <td>客户名称</td> <td><input id="txtClientName" type="text" style="width:100px" /></td> <td style="width:5px"></td> <td>类型</td> <td><input id="cboClientTypeID" class="easyui-combobox" style="width:100px" /></td> <td style="width:5px"></td> <td>业务员</td> <td><input id="cboSalesmanID" class="easyui-combobox" style="width:100px" /></td> </tr> <tr> <td>证件号码</td> <td colspan=4><input id="txtClientcredentialsNumber" type="text" style="width:270px" /></td> <td style="width:5px"></td> <td>证件名称</td> <td><input id="txtClientcredentialsName" type="text" style="width:100px" /></td> <td style="width:5px"></td> </tr> <tr> <td>地址</td> <td colspan=4><input id="txtClientAddress" type="text" style="width:270px" /></td> <td style="width:5px"></td> <td>邮编</td> <td><input id="txtClientZipCode" type="text" style="width:100px" /></td> <td style="width:5px"></td> </tr> <tr> <td>联系电话</td> <td><input id="txtClientContactNumber" type="text" style="width:100px" /></td> <td style="width:5px"></td> <td>手机</td> <td><input id="txtClientMobilePhone" type="text" style="width:100px" /></td> <td style="width:5px"></td> <td>传真</td> <td><input id="txtClientPortraiture" type="text" style="width:100px" /></td> </tr> <tr> <td>国籍</td> <td><input id="txtNationality" type="text" style="width:100px" /></td> <td style="width:5px"></td> <td>出生日期</td> <td><input id="dtClientBirthday" class="easyui-datebox" style="width:100px" data-options="formatter:myformatter"/></td> <td style="width:5px"></td> <td>性别</td> <td><input id="cboSex" class="easyui-combobox" style="width:100px" /></td> </tr> <tr> <td>所属项目</td> <td><input id="cboClientDSProjectID" class="easyui-combobox" style="width:100px" /></td> <td style="width:5px"></td> <td>职务</td> <td><input id="txtClientDuties" type="text" style="width:100px" /></td> <td style="width:5px"></td> <td>电子邮件</td> <td><input id="txtClientEmail" type="text" style="width:100px" /></td> </tr> <tr> <td>工作单位</td><td colspan=7><input id="txtClientJobUnit" type="text" style="width:445px" /></td> </tr> <tr><td style="height:15px"></td></tr> <tr> <td>公司名称</td> <td colspan=4><input id="txtCorporationName" type="text" style="width:270px" /></td> <td style="width:5px"></td> <td>公司法人</td> <td><input id="txtCorporationJuridicalPerson" type="text" style="width:100px" /></td> <td style="width:5px"></td> </tr> <tr> <td>法人证件</td> <td colspan=4><input id="txtJuridicalPersonCD" type="text" style="width:270px" /></td> <td style="width:5px"></td> <td>法人电话</td> <td><input id="txtCorporationPhone" type="text" style="width:100px" /></td> <td style="width:5px"></td> </tr> <tr> <td>公司地址</td><td colspan=7><input id="txtCorporationAddress" type="text" style="width:445px" /></td> </tr> <tr> <td><a class="easyui-linkbutton" id="" onclick="AddClient()">下一步</a></td> <td><a class="easyui-linkbutton" id="" onclick="CloseChuangTi('#w客户资料')">取消</a></td> </tr> </table> </div>
jQuery代码
function AddClient() { var strKeHuID = ""; $.getJSON("/XiaoShouQianTai/AddClient?ClientTypeID=" + $('#cboClientTypeID').combobox("getValue") + "&" + "SalesmanID=" + $('#cboSalesmanID').combobox("getValue") + "&" + "ClientcredentialsNumber=" + $('#txtClientcredentialsNumber').val() + "&" + "ClientcredentialsName=" + $('#txtClientcredentialsName').val() + "&" + "ClientAddress=" + $('#txtClientAddress').val() + "&" + "ClientZipCode=" + $('#txtClientZipCode').val() + "&" + "ClientContactNumber=" + $('#txtClientContactNumber').val() + "&" + "ClientMobilePhone=" + $('#txtClientMobilePhone').val() + "&" + "ClientPortraiture=" + $('#txtClientPortraiture').val() + "&" + "Nationality=" + $('#txtNationality').val() + "&" + "ClientBirthday=" + $('#dtClientBirthday').datebox("getValue") + "&" + "Sex=" + $('#cboSex').combobox("getValue") + "&" + "ClientDuties=" + $('#txtClientDuties').val() + "&" + "ClientEmail=" + $('#txtClientEmail').val() + "&" + "ClientJobUnit=" + $('#txtClientJobUnit').val() + "&" + "CorporationName=" + $('#txtCorporationName').val() + "&" + "CorporationJuridicalPerson=" + $('#txtCorporationJuridicalPerson').val() + "&" + "JuridicalPersonCD=" + $('#txtJuridicalPersonCD').val() + "&" + "CorporationPhone=" + $('#txtCorporationPhone').val() + "&" + "CorporationAddress=" + $('#txtCorporationAddress').val() + "&" + "ClientName=" + $('#txtClientName').val() + "&", function (data) { strKeHuID = data; alert(strKeHuID); $.getJSON("/XiaoShouQianTai/GengXinClientCode", function (data) { }); $.getJSON("/XiaoShouQianTai/ChaXunFangJianSuoShu?YongHuID=" + $('#cboSalesmanID').combobox("getValue") + "&" + "KeHuYeWuZhuangTaiID=59" + "&", function (data2) { $.getJSON("/XiaoShouQianTai/TianJianKeHuSuoShu?KeHuZiLiaoID=" + strKeHuID + "&" + "XiangMuID=" + $('#cboClientDSProjectID').combobox("getValue") + "&" + "KeHuYeWuZhuangTaiSuoShuID=" + data2 + "&", function (data4) { if (data4 != null) { alert("添加成功!"); $('#w客户资料').window('close'); var KeHuMC = $('#txtClientName').val(); BangDingChengYiRenGou(KeHuMC); $('#hiddenID').val(strKeHuID); $('#w添加诚意认购').window('open'); } }); }); }); }
若输入的客户名称已经登记在本系统中时,点击〖下一步〗按钮,打开“第二步:请选择匹配客户”窗口如下图,系统将所有与输入的名称相匹配的客户全部列出供用户选择。
第一步:数据库
表与表之间的关系
储存过程
if @Type='SelectClientData' begin SELECT SYS_ClientDatumTable.ClientDatumID, SYS_ClientDatumTable.ClientName, SYS_ClientDatumTable.ClientContactNumber, SYS_ClientDatumTable.ClientcredentialsNumber, SYS_ProjectTable.ProjectName, SYS_UserTable.UserName FROM SYS_ClientSubordinateTable INNER JOIN SYS_ClientDatumTable ON SYS_ClientSubordinateTable.ClientDatumID = SYS_ClientDatumTable.ClientDatumID INNER JOIN SYS_ProjectTable ON SYS_ClientSubordinateTable.ProjectID = SYS_ProjectTable.ProjectID INNER JOIN SYS_UserTable ON SYS_ClientDatumTable.SalesmanID = SYS_UserTable.UserID where SYS_ClientDatumTable.ClientName = @ClientName end
第二步:BLL层
public DataTable SelectClientData(string ClientName) { SqlParameter[] SQLCMDpas = { new SqlParameter("@Type",SqlDbType.Char), new SqlParameter("@ClientName",SqlDbType.Char), }; SQLCMDpas[0].Value = "SelectClientData"; SQLCMDpas[1].Value = ClientName; DataTable dt = myDALMethod.DAL_SelectDB_Par("PW_SinceritySubscribe", SQLCMDpas); return dt; }
第三步:控制器代码
public ActionResult SelectClientData(string ClientName) { DataTable dt = myfrmChengYiRenGou.SelectClientData(ClientName); List<Dictionary<string, object>> ListReturn = ConvertHelper.DtToList(dt); return Json(ListReturn, JsonRequestBehavior.AllowGet); }
第四部:View代码
html代码
<td><a class="easyui-linkbutton" id="" onclick="OpenChuangTi('#w选择客户'),CloseChuangTi('#w输入客户资料'),SelectClient()">下一步</a></td>
JQuery代码
function CloseChuangTi(KongJianID) {//关闭目标窗体 $(KongJianID).window('close'); } function OpenChuangTi(KongJianID) {//打开目标窗体 $(KongJianID).window('open'); } function SelectClient() {条件查询客户 $.getJSON("/XiaoShouQianTai/SelectClientData?ClientName=" + $('#ChaXunKeHuMc').val(),//获取第一步输入客户资料窗体的文本框控件的值(客户名称)作为参数 function (data) { $('#w客户基本资料').datagrid('loadData', data); }); }
仅供于学习,禁止用于商业用途
相关文章推荐
- HDU 2222 Keywords Search (AC自动机)
- 集合总结(三)
- linux core dump
- 25-网易新闻iOS版使用的开源组件
- 2-3.归并排序详解
- ARM 64位处理器架构ARMv8技术浅析
- UML简单介绍(八)——时序图的基本概念与解析
- C++线程基础
- 第四章 冒泡排序法 潘璠
- 03-Xcode 6 插件失效的临时解决方案
- angular 实现modal windows效果(即模态窗口,半透明的遮罩层),以及bootstrap(css,components,js)的初步学习
- Scrapy中的item是什么
- 多项式求和(SDUTOJ_2504)
- 秒杀核心设计(减库存部分)-防超卖与高并发
- 杭电oj 1328
- linux 琐碎知识点
- Android 怎么使用Bitmap+Canvas 自适应屏幕
- openstack Juno版部署记录
- C语言做的键盘操作的五子棋
- 并查集的简单应用——HDU