现project相关资源
2011-03-31 17:09
106 查看
获得所有user以及相关person
fn_User_GetAllUserPerson
with userSectorCte(userid, sectorid)
as
(
select u.id, us.SectorId
from [User] u
inner join User_Sector us on us.UserId = u.id
where u.Validity = 1 and u.Level = @UserLevel
UNION ALL
SELECT userid,s.Id
FROM Sector s
INNER JOIN userSectorCte us ON us.sectorid = s.ParentId
)
--select * from userSectorCte
select distinct usCte.userid as 'UserId', sp.PersonId
from userSectorCte usCte
inner join Sector s on s.Id = usCte.sectorid
inner join Service serv on serv.SectorId = s.Id and serv.Validity = 1
inner join Service_Person sp on sp.ServiceId = serv.Id
inner join Person p on p.id = sp.PersonId and p.Validity = 1
where s.Level = 2
self.comboActionPlan = new Ext.form.ComboBox({
id: 'TraceActionPlan.cbActionPlan',
columnWidth: 0.5,
mode: 'local',
triggerAction: 'all',
store: self.Controller.ActionPlanStore,
valueField: 'ID',
displayField: 'PacName',
listeners: {
select: self.cbActionPlan_select,
render: function(combo) {
combo.store.load({});
}
}
});
//displayfield Population
self.dfPopulation = new Ext.form.DisplayField({
columnWidth:0.3,
value:translate('Population')
});
//combo Population
self.comboPopulation = new Ext.form.ComboBox({
columnWidth: 0.5,
typeAhead: true,
triggerAction: 'all',
lazyRender: true,
id: 'TraceActionPlan.view.comboPopulation',
listeners: {
select: self.comboPopulation_handler,
render: function(combo) {
combo.store.load({
params: {
userId: Application.Main.State.User.ID,
userLevel: Application.Main.State.User.Level,
loadOnlyMaxLevel: true,
loadNetworks: true,
lang: Application.Main.State.LanguageCode
}
});
}
},
minListWidth: 250,
mode: 'local',
store: self.Controller.userStore,
valueField: 'Id',
displayField: 'Name'
});
self.Controller.userStore.on({
'load':function(store){
try{
if(store.data.length == 1){
var data = store.data.items[0].data;
self.comboPopulation.setValue(data.Name);
self.Controller.criteriaActionPlanSearch.PopulationId = data.Id;
self.Controller.criteriaActionPlanSearch.PopulationType = data.Type;
}
}catch(ext){
ExceptionHandler.report('TraceActionPlan.userStore.onLoad');
}
}
});
self.Controller.ActionPlanStore.on({
'load': function(store){
try {
var combo = Ext.getCmp('TraceActionPlan.cbActionPlan');
var record = store.getAt(0);
combo.fireEvent('select',combo,record);
} catch(exc) {
ExceptionHandler.report('Targeting.cbActionPlanStore.onLoad');
}
}
});
fn_User_GetAllUserPerson
with userSectorCte(userid, sectorid)
as
(
select u.id, us.SectorId
from [User] u
inner join User_Sector us on us.UserId = u.id
where u.Validity = 1 and u.Level = @UserLevel
UNION ALL
SELECT userid,s.Id
FROM Sector s
INNER JOIN userSectorCte us ON us.sectorid = s.ParentId
)
--select * from userSectorCte
select distinct usCte.userid as 'UserId', sp.PersonId
from userSectorCte usCte
inner join Sector s on s.Id = usCte.sectorid
inner join Service serv on serv.SectorId = s.Id and serv.Validity = 1
inner join Service_Person sp on sp.ServiceId = serv.Id
inner join Person p on p.id = sp.PersonId and p.Validity = 1
where s.Level = 2
self.comboActionPlan = new Ext.form.ComboBox({
id: 'TraceActionPlan.cbActionPlan',
columnWidth: 0.5,
mode: 'local',
triggerAction: 'all',
store: self.Controller.ActionPlanStore,
valueField: 'ID',
displayField: 'PacName',
listeners: {
select: self.cbActionPlan_select,
render: function(combo) {
combo.store.load({});
}
}
});
//displayfield Population
self.dfPopulation = new Ext.form.DisplayField({
columnWidth:0.3,
value:translate('Population')
});
//combo Population
self.comboPopulation = new Ext.form.ComboBox({
columnWidth: 0.5,
typeAhead: true,
triggerAction: 'all',
lazyRender: true,
id: 'TraceActionPlan.view.comboPopulation',
listeners: {
select: self.comboPopulation_handler,
render: function(combo) {
combo.store.load({
params: {
userId: Application.Main.State.User.ID,
userLevel: Application.Main.State.User.Level,
loadOnlyMaxLevel: true,
loadNetworks: true,
lang: Application.Main.State.LanguageCode
}
});
}
},
minListWidth: 250,
mode: 'local',
store: self.Controller.userStore,
valueField: 'Id',
displayField: 'Name'
});
self.Controller.userStore.on({
'load':function(store){
try{
if(store.data.length == 1){
var data = store.data.items[0].data;
self.comboPopulation.setValue(data.Name);
self.Controller.criteriaActionPlanSearch.PopulationId = data.Id;
self.Controller.criteriaActionPlanSearch.PopulationType = data.Type;
}
}catch(ext){
ExceptionHandler.report('TraceActionPlan.userStore.onLoad');
}
}
});
self.Controller.ActionPlanStore.on({
'load': function(store){
try {
var combo = Ext.getCmp('TraceActionPlan.cbActionPlan');
var record = store.getAt(0);
combo.fireEvent('select',combo,record);
} catch(exc) {
ExceptionHandler.report('Targeting.cbActionPlanStore.onLoad');
}
}
});
相关文章推荐
- [置顶] 传播知识,分享快乐--我的相关资源下载(不定期更新)
- ADMM算法相关资源
- JXL(JExcelApi)相关资源
- 相关网络资源
- 已发布文章相关资源下载地址
- WP7入门篇(一)开发环境搭建以及相关学习资源
- 线程的退出与其相关资源的释放
- 关于Microsoft Office Project 的网络资源
- ArcGis 在线地图相关资源
- redis相关资源汇总
- 文档处理相关资源
- 福州教育相关教育资源介绍
- Android应用开发相关下载资源
- WIN8相关资源汇总
- 流媒体相关资源
- 机器学习入门相关资源
- 图像和视觉相关的一些常用的代码和学习资源
- 常用资源与相关链接 转载网友的
- VR开发相关资源
- unicode及gbk相关资源