修改培训穿透页面和安全月报

This commit is contained in:
2024-09-06 14:03:48 +08:00
parent 3d1e4f6338
commit 9eabdbdac8
6 changed files with 440 additions and 37 deletions
+8 -4
View File
@@ -16,7 +16,7 @@
ShowHeader="true" Layout="VBox" BoxConfigAlign="Stretch">
<Items>
<f:Grid ID="Grid1" ShowBorder="true" ShowHeader="false" Title="教育培训" EnableCollapse="true"
runat="server" BoxFlex="1" DataKeyNames="TrainingId" DataIDField="TrainingId" AllowSorting="true"
runat="server" BoxFlex="1" DataKeyNames="TrainingId,Ttype" DataIDField="TrainingId" AllowSorting="true"
SortField="ProjectCode,TrainStartDate" SortDirection="ASC" OnSort="Grid1_Sort" EnableColumnLines="true" AllowPaging="true"
IsDatabasePaging="true" PageSize="20" OnPageIndexChange="Grid1_PageIndexChange" ForceFit="true"
EnableRowDoubleClickEvent="true" OnRowDoubleClick="Grid1_RowDoubleClick"
@@ -30,9 +30,9 @@
<f:ToolbarSeparator runat="server"></f:ToolbarSeparator>
<f:RadioButtonList runat="server" ID="rbType" Width="600px" Label="类型" LabelWidth="50px"
AutoPostBack="true" OnSelectedIndexChanged="TextBox_TextChanged" AutoColumnWidth="true">
<f:RadioItem Text="三级教育培训" Value="1" Selected="true" />
<f:RadioItem Text="专项培训" Value="2" />
<f:RadioItem Text="特种作业培训" Value="3" />
<f:RadioItem Text="入场" Value="dfb6a37e-4412-4ba9-ad59-3bc505bc21f7" Selected="true" />
<f:RadioItem Text="其他" Value="c1a513bb-a547-45b0-944d-b0dd88f06f82" />
<f:RadioItem Text="专项" Value="0e7fdf78-eaa0-4d00-a60b-490040bbea18" />
</f:RadioButtonList>
<f:DatePicker ID="txtStartTime" runat="server" Label="时间" LabelAlign="Right"
AutoPostBack="true" OnTextChanged="TextBox_TextChanged" Width="200px" LabelWidth="80px">
@@ -62,6 +62,10 @@
<f:RenderField Width="100px" ColumnID="TrainTitle" DataField="TrainTitle"
FieldType="String" HeaderText="名称" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="Ttype" DataField="Ttype"
FieldType="String" HeaderText="来源" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="110px" ColumnID="TrainStartDate" DataField="TrainStartDate"
FieldType="Date" Renderer="Date" RendererArgument="yyyy-MM-dd"
+150 -17
View File
@@ -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