修改培训穿透页面和安全月报
This commit is contained in:
@@ -34,38 +34,167 @@ namespace FineUIPro.Web.DataShow
|
||||
{
|
||||
string strSql = string.Empty;
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
List<SqlParameter> listStrSum = new List<SqlParameter>();
|
||||
//strSql = @"select TrainRecord.TrainTypeId,TrainRecord.TrainingId,
|
||||
// TrainRecord.TrainTitle,
|
||||
// Project.ProjectId,
|
||||
// Project.ProjectCode,
|
||||
// Project.ProjectName,
|
||||
// TrainRecord.TrainStartDate,
|
||||
// TrainRecord.TrainEndDate,
|
||||
// TrainRecord.TrainPersonNum,
|
||||
// UnitName= STUFF((SELECT ',' + UnitName FROM dbo.Base_Unit where PATINDEX('%,' + RTRIM(UnitId) + ',%',',' +TrainRecord.UnitIds + ',')>0 FOR XML PATH('')), 1, 1,'')
|
||||
// from EduTrain_TrainRecord AS TrainRecord
|
||||
// LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId
|
||||
// LEFT JOIN Base_Project AS Project ON TrainRecord.ProjectId=Project.ProjectId
|
||||
// WHERE 1=1 ";
|
||||
|
||||
strSql = @"select TrainRecord.TrainingId,TrainRecord.TrainTitle,TrainType.TrainTypeName,Project.ProjectId,Project.ProjectCode,Project.ProjectName
|
||||
,TrainRecord.TrainStartDate,TrainRecord.TrainEndDate,TrainRecord.TrainPersonNum,TrainRecord.UnitIds
|
||||
,UnitName= STUFF((SELECT ',' + UnitName FROM dbo.Base_Unit where PATINDEX('%,' + RTRIM(UnitId) + ',%',',' +TrainRecord.UnitIds + ',')>0 FOR XML PATH('')), 1, 1,'')
|
||||
from EduTrain_TrainRecord AS TrainRecord
|
||||
LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId
|
||||
LEFT JOIN Base_Project AS Project ON TrainRecord.ProjectId=Project.ProjectId
|
||||
WHERE 1=1 ";
|
||||
//strSql += " AND TrainRecord.TrainTypeId =@TrainType";
|
||||
//listStr.Add(new SqlParameter("@TrainType", this.rbType.SelectedValue));
|
||||
|
||||
strSql += " AND TrainType.TrainType =@TrainType";
|
||||
listStr.Add(new SqlParameter("@TrainType", this.rbType.SelectedValue));
|
||||
//当前页数
|
||||
int pageIndex = Grid1.PageIndex + 1;
|
||||
//每页显示条数
|
||||
int pageSize = Grid1.PageSize;
|
||||
strSql = @"select*from(
|
||||
select ROW_NUMBER() OVER(Order by ProjectCode desc) AS RowNumber,
|
||||
* from (
|
||||
select
|
||||
'本系统' as Ttype,
|
||||
TrainRecord.TrainTypeId,
|
||||
TrainRecord.TrainingId,
|
||||
TrainRecord.TrainTitle,
|
||||
Project.ProjectId,
|
||||
Project.ProjectCode,
|
||||
Project.ProjectName,
|
||||
TrainRecord.TrainStartDate,
|
||||
TrainRecord.TrainEndDate,
|
||||
TrainRecord.TrainPersonNum,
|
||||
UnitName= STUFF((SELECT ',' + UnitName FROM dbo.Base_Unit where PATINDEX('%,' + RTRIM(UnitId) + ',%',',' +TrainRecord.UnitIds + ',')>0 FOR XML PATH('')), 1, 1,'')
|
||||
from EduTrain_TrainRecord AS TrainRecord
|
||||
LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId
|
||||
LEFT JOIN Base_Project AS Project ON TrainRecord.ProjectId=Project.ProjectId
|
||||
|
||||
UNION ALL
|
||||
|
||||
select
|
||||
'博晟' as Ttype,
|
||||
TrainType as TrainTypeId,
|
||||
Id as TrainingId,
|
||||
RecordName as TrainTitle,
|
||||
Project.ProjectId,
|
||||
Project.ProjectCode,
|
||||
Project.ProjectName,
|
||||
TrainStartDate,
|
||||
TrainEndDate,
|
||||
PersonCount as TrainPersonNum,
|
||||
TrainDepart as UnitName
|
||||
From Bo_Sheng_Train F
|
||||
LEFT JOIN Base_Project AS Project ON F.ProjectId=Project.ProjectId
|
||||
)f WHERE 1=1 ";
|
||||
|
||||
#region 总数
|
||||
var strSqlSum = @"select Count(*)as allCount from(
|
||||
select ROW_NUMBER() OVER(Order by ProjectCode desc) AS RowNumber,
|
||||
* from (
|
||||
select
|
||||
'1' as Ttype,
|
||||
TrainRecord.TrainTypeId,
|
||||
TrainRecord.TrainingId,
|
||||
TrainRecord.TrainTitle,
|
||||
Project.ProjectId,
|
||||
Project.ProjectCode,
|
||||
Project.ProjectName,
|
||||
TrainRecord.TrainStartDate,
|
||||
TrainRecord.TrainEndDate,
|
||||
TrainRecord.TrainPersonNum,
|
||||
UnitName= STUFF((SELECT ',' + UnitName FROM dbo.Base_Unit where PATINDEX('%,' + RTRIM(UnitId) + ',%',',' +TrainRecord.UnitIds + ',')>0 FOR XML PATH('')), 1, 1,'')
|
||||
from EduTrain_TrainRecord AS TrainRecord
|
||||
LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId
|
||||
LEFT JOIN Base_Project AS Project ON TrainRecord.ProjectId=Project.ProjectId
|
||||
|
||||
UNION ALL
|
||||
|
||||
select
|
||||
'博晟' as Ttype,
|
||||
TrainType as TrainTypeId,
|
||||
Id as TrainingId,
|
||||
RecordName as TrainTitle,
|
||||
Project.ProjectId,
|
||||
Project.ProjectCode,
|
||||
Project.ProjectName,
|
||||
TrainStartDate,
|
||||
TrainEndDate,
|
||||
PersonCount as TrainPersonNum,
|
||||
TrainDepart as UnitName
|
||||
From Bo_Sheng_Train F
|
||||
LEFT JOIN Base_Project AS Project ON F.ProjectId=Project.ProjectId
|
||||
)f WHERE 1=1";
|
||||
|
||||
#endregion
|
||||
if (this.drpProject.SelectedValue != Const._Null)
|
||||
{
|
||||
strSql += " AND TrainRecord.ProjectId = @ProjectId";
|
||||
strSql += " AND ProjectId = @ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.drpProject.SelectedValue));
|
||||
|
||||
strSqlSum += " AND ProjectId = @ProjectId";
|
||||
listStrSum.Add(new SqlParameter("@ProjectId", this.drpProject.SelectedValue));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtStartTime.Text))
|
||||
{
|
||||
strSql += " AND TrainRecord.TrainEndDate >=@StartTime";
|
||||
strSql += " AND TrainStartDate >=@StartTime";
|
||||
listStr.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
|
||||
|
||||
strSqlSum += " AND TrainStartDate >=@StartTime";
|
||||
listStrSum.Add(new SqlParameter("@StartTime", this.txtStartTime.Text));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtEndTime.Text))
|
||||
{
|
||||
strSql += " AND TrainRecord.TrainEndDate <=@EndTime";
|
||||
strSql += " AND TrainStartDate <=@EndTime";
|
||||
listStr.Add(new SqlParameter("@EndTime", this.txtEndTime.Text));
|
||||
|
||||
strSqlSum += " AND TrainStartDate <=@EndTime";
|
||||
listStrSum.Add(new SqlParameter("@EndTime", this.txtStartTime.Text));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.rbType.SelectedValue))
|
||||
{
|
||||
strSql += " And ( TrainTypeId='" + rbType.SelectedValue + "' or ";
|
||||
|
||||
strSqlSum+= " And ( TrainTypeId='" + rbType.SelectedValue + "' or ";
|
||||
if (rbType.SelectedValue == "dfb6a37e-4412-4ba9-ad59-3bc505bc21f7")
|
||||
{
|
||||
strSql += " TrainTypeId like '%入场%' ) ";
|
||||
|
||||
strSqlSum += " TrainTypeId like '%入场%' ) ";
|
||||
}
|
||||
else if (rbType.SelectedValue == "c1a513bb-a547-45b0-944d-b0dd88f06f82")
|
||||
{
|
||||
strSql += " TrainTypeId like '%其他%' ) ";
|
||||
strSqlSum += " TrainTypeId like '%其他%' ) ";
|
||||
}
|
||||
else {
|
||||
strSql += " TrainTypeId like '%专项%' ) ";
|
||||
strSqlSum += " TrainTypeId like '%专项%' ) ";
|
||||
}
|
||||
}
|
||||
|
||||
strSql += " ) b where b.RowNumber BETWEEN(@pageIndex-1)*@pageSize + 1 and @pageIndex*@pageSize order by RowNumber asc";
|
||||
strSqlSum+= " ) b ";
|
||||
|
||||
listStr.Add(new SqlParameter("@pageIndex", pageIndex));
|
||||
listStr.Add(new SqlParameter("@pageSize", pageSize));
|
||||
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
#region 总数
|
||||
DataTable tbSum = SQLHelper.GetDataTableRunText(strSqlSum, listStrSum.ToArray());
|
||||
Grid1.RecordCount = Convert.ToInt32(tbSum.Rows[0]["allcount"].ToString());
|
||||
#endregion
|
||||
|
||||
|
||||
Grid1.DataSource = tb;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
#endregion
|
||||
@@ -78,6 +207,7 @@ namespace FineUIPro.Web.DataShow
|
||||
/// <param name="e"></param>
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = 0;
|
||||
this.BindGrid();
|
||||
}
|
||||
#endregion
|
||||
@@ -147,8 +277,11 @@ namespace FineUIPro.Web.DataShow
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HSSE/EduTrain/TrainRecordView.aspx?TrainingId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||||
var tType= Grid1.SelectedRow.DataKeys[1].ToString();
|
||||
if (tType!="博晟")
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../HSSE/EduTrain/TrainRecordView.aspx?TrainingId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user