安全会议,教育培训接口
This commit is contained in:
@@ -59,8 +59,16 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
{
|
||||
this.ProjectId = Request.Params["projectId"];
|
||||
}
|
||||
this.ucTree.UnitId = this.CurrUser.UnitId;
|
||||
this.ucTree.ProjectId = this.ProjectId;
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
this.panelLeftRegion.Hidden = true;
|
||||
//权限按钮方法
|
||||
this.GetButtonPower();
|
||||
}
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
//this.GetButtonPower();
|
||||
this.btnMenuDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请至少选择一项!");
|
||||
this.btnMenuDelete.ConfirmText = String.Format("你确定要删除选中的 <b><script>{0}</script></b> 行数据吗?", Grid1.GetSelectedCountReference());
|
||||
this.ddlPageSize.SelectedValue = this.Grid1.PageSize.ToString();
|
||||
@@ -69,6 +77,27 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
this.InitTreeMenu();//加载树
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 公司级树加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void changeTree(object sender, EventArgs e)
|
||||
{
|
||||
this.ProjectId = this.ucTree.ProjectId;
|
||||
this.InitTreeMenu();
|
||||
this.BindGrid();
|
||||
this.GetButtonPower();
|
||||
if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
btnNew.Hidden = true;
|
||||
btnImport.Hidden = true;
|
||||
btnPersonOut.Hidden = true;
|
||||
btnMenuEdit.Hidden = true;
|
||||
btnMenuDelete.Hidden = true;
|
||||
//btnMenuBlackList.Hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载树
|
||||
@@ -79,46 +108,18 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(this.ProjectId);
|
||||
if (project != null)
|
||||
{
|
||||
//var personLists = BLL.PersonService.GetPersonList(project.ProjectId);
|
||||
|
||||
String strSql1 = @"select UnitId,count( * ) num from SitePerson_Person
|
||||
where ProjectId='" + this.CurrUser.LoginProjectId + @"'
|
||||
group by UnitId";
|
||||
|
||||
String strSql2 = @" select UnitId,count( * ) num from SitePerson_Person
|
||||
where ProjectId='" + this.CurrUser.LoginProjectId + @"' and IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
|
||||
group by UnitId";
|
||||
|
||||
|
||||
DataTable dt1 = SQLHelper.GetDataTableRunText(strSql1, null);
|
||||
DataTable dt2 = SQLHelper.GetDataTableRunText(strSql2, null);
|
||||
int proTotal = 0;
|
||||
int proIn = 0;
|
||||
if (dt1 != null && dt1.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow row in dt1.Rows)
|
||||
{
|
||||
proTotal += int.Parse(row["num"].ToString());
|
||||
}
|
||||
}
|
||||
if (dt2 != null && dt2.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow row in dt2.Rows)
|
||||
{
|
||||
proIn += int.Parse(row["num"].ToString());
|
||||
}
|
||||
}
|
||||
var personLists = BLL.PersonService.GetPersonList(project.ProjectId);
|
||||
TreeNode rootNode = new TreeNode();
|
||||
rootNode = new TreeNode
|
||||
{
|
||||
Text = project.ProjectName,
|
||||
NodeID = project.ProjectId
|
||||
};
|
||||
if (proTotal > 0)
|
||||
if (personLists.Count() > 0)
|
||||
{
|
||||
//var personIn = personLists.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true
|
||||
// && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
|
||||
rootNode.ToolTip = "当前项目人员总数:" + proTotal + ";在场人员数:" + proIn + ";离场人员数:" + (proTotal - proIn);
|
||||
var personIn = personLists.Where(x => x.ProjectId == this.ProjectId && x.IsUsed == true
|
||||
&& x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
|
||||
rootNode.ToolTip = "当前项目人员总数:" + personLists.Count() + ";在场人员数:" + personIn.Count() + ";离场人员数:" + (personLists.Count() - personIn.Count());
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -126,7 +127,117 @@ namespace FineUIPro.Web.HSSE.SitePerson
|
||||
}
|
||||
rootNode.Expanded = true;
|
||||
this.tvProjectAndUnit.Nodes.Add(rootNode);
|
||||
GetUnitLists(rootNode.Nodes, this.ProjectId, dt1, dt2);
|
||||
GetUnitLists(rootNode.Nodes, this.ProjectId, personLists);
|
||||
|
||||
////var personLists = BLL.PersonService.GetPersonList(project.ProjectId);
|
||||
|
||||
//String strSql1 = @"select UnitId,count( * ) num from SitePerson_Person
|
||||
// where ProjectId='" + this.CurrUser.LoginProjectId + @"'
|
||||
// group by UnitId";
|
||||
|
||||
//String strSql2 = @" select UnitId,count( * ) num from SitePerson_Person
|
||||
// where ProjectId='" + this.CurrUser.LoginProjectId + @"' and IsUsed =1 and InTime<='" + DateTime.Now.ToString("yyyy-MM-dd") + "' and (OutTime is null or OutTime>'" + DateTime.Now.ToString("yyyy-MM-dd") + @"' )
|
||||
// group by UnitId";
|
||||
|
||||
|
||||
//DataTable dt1 = SQLHelper.GetDataTableRunText(strSql1, null);
|
||||
//DataTable dt2 = SQLHelper.GetDataTableRunText(strSql2, null);
|
||||
//int proTotal = 0;
|
||||
//int proIn = 0;
|
||||
//if (dt1 != null && dt1.Rows.Count > 0)
|
||||
//{
|
||||
// foreach (DataRow row in dt1.Rows)
|
||||
// {
|
||||
// proTotal += int.Parse(row["num"].ToString());
|
||||
// }
|
||||
//}
|
||||
//if (dt2 != null && dt2.Rows.Count > 0)
|
||||
//{
|
||||
// foreach (DataRow row in dt2.Rows)
|
||||
// {
|
||||
// proIn += int.Parse(row["num"].ToString());
|
||||
// }
|
||||
//}
|
||||
//TreeNode rootNode = new TreeNode();
|
||||
//rootNode = new TreeNode
|
||||
//{
|
||||
// Text = project.ProjectName,
|
||||
// NodeID = project.ProjectId
|
||||
//};
|
||||
//if (proTotal > 0)
|
||||
//{
|
||||
// //var personIn = personLists.Where(x => x.ProjectId == this.CurrUser.LoginProjectId && x.IsUsed == true
|
||||
// // && x.InTime <= DateTime.Now && (!x.OutTime.HasValue || x.OutTime > DateTime.Now)).ToList();
|
||||
// rootNode.ToolTip = "当前项目人员总数:" + proTotal + ";在场人员数:" + proIn + ";离场人员数:" + (proTotal - proIn);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// rootNode.ToolTip = "当前项目人员总数:0";
|
||||
//}
|
||||
//rootNode.Expanded = true;
|
||||
//this.tvProjectAndUnit.Nodes.Add(rootNode);
|
||||
//GetUnitLists(rootNode.Nodes, this.ProjectId, dt1, dt2);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载单位
|
||||
/// </summary>
|
||||
/// <param name="nodes"></param>
|
||||
/// <param name="parentId"></param>
|
||||
private void GetUnitLists(TreeNodeCollection nodes, string parentId, List<Model.SitePerson_Person> personLists)
|
||||
{
|
||||
List<Model.Base_Unit> unitLists = BLL.UnitService.GetUnitByProjectIdList(parentId);
|
||||
if (unitLists.Count() > 0)
|
||||
{
|
||||
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(parentId, this.CurrUser.UnitId))
|
||||
{
|
||||
unitLists = unitLists.Where(x => x.UnitId == this.CurrUser.UnitId).ToList();
|
||||
}
|
||||
|
||||
//添加其他单位/无单位人员
|
||||
Model.Base_Unit otherUnit = new Model.Base_Unit
|
||||
{
|
||||
UnitId = "0",
|
||||
UnitName = "其他"
|
||||
};
|
||||
unitLists.Add(otherUnit);
|
||||
|
||||
TreeNode newNode = null;
|
||||
foreach (var q in unitLists)
|
||||
{
|
||||
newNode = new TreeNode
|
||||
{
|
||||
Text = q.UnitName,
|
||||
NodeID = q.UnitId + "|" + parentId,
|
||||
ToolTip = q.UnitName
|
||||
};
|
||||
if (personLists.Count() > 0)
|
||||
{
|
||||
var personUnitLists = personLists.Where(x => x.UnitId == q.UnitId);
|
||||
if (q.UnitId == "0")
|
||||
{
|
||||
personUnitLists = personLists.Where(x => x.UnitId == null);
|
||||
}
|
||||
|
||||
if (personUnitLists.Count() > 0)
|
||||
{
|
||||
var personIn = personUnitLists.Where(x => x.InTime <= System.DateTime.Now && x.IsUsed == true
|
||||
&& (!x.OutTime.HasValue || x.OutTime >= System.DateTime.Now));
|
||||
newNode.ToolTip = q.UnitName + "人员总数:" + personUnitLists.Count() + ";在场人员数:" + personIn.Count() + ";离场人员数:" + (personUnitLists.Count() - personIn.Count());
|
||||
}
|
||||
else
|
||||
{
|
||||
newNode.ToolTip = q.UnitName + "人员总数:0";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newNode.ToolTip = q.UnitName + "人员总数:0";
|
||||
}
|
||||
newNode.EnableClickEvent = true;
|
||||
nodes.Add(newNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user