培训
This commit is contained in:
@@ -12,6 +12,8 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
{
|
||||
public partial class TrainRecord : PageBase
|
||||
{
|
||||
private static string trainType;
|
||||
|
||||
#region 定义项
|
||||
/// <summary>
|
||||
/// 培训记录主键
|
||||
@@ -27,6 +29,29 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
ViewState["TrainingId"] = value;
|
||||
}
|
||||
}
|
||||
public string ProjectId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["ProjectId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string UnitId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["UnitId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["UnitId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 加载页面
|
||||
@@ -39,6 +64,15 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
this.ProjectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
||||
{
|
||||
this.ProjectId = Request.Params["projectId"];
|
||||
}
|
||||
|
||||
this.ucTree.UnitId = this.CurrUser.UnitId;
|
||||
this.ucTree.ProjectId = this.ProjectId;
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
@@ -48,6 +82,11 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
|
||||
//培训类型
|
||||
BLL.TrainTypeService.InitTrainTypeDropDownList(this.drpTrainType, true);
|
||||
trainType = Request.Params["trainType"];
|
||||
if (!string.IsNullOrEmpty(trainType))
|
||||
{
|
||||
this.drpTrainType.Items.FindByText(trainType).Selected = true;
|
||||
}
|
||||
//培训级别;
|
||||
BLL.TrainLevelService.InitTrainLevelDropDownList(this.drpTrainLevel, true);
|
||||
|
||||
@@ -58,21 +97,44 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
{
|
||||
this.btnRefresh.Hidden = false;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
this.panelLeftRegion.Hidden = true;
|
||||
// this.Grid1.Columns[0].Hidden = true;
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void changeTree(object sender, EventArgs e)
|
||||
{
|
||||
this.ProjectId = this.ucTree.ProjectId;
|
||||
//新增UnitId
|
||||
this.UnitId = this.ucTree.UnitId;
|
||||
//判断 当有projectId的时候单位id为空
|
||||
if (!string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
this.UnitId = "";
|
||||
}
|
||||
this.BindGrid();
|
||||
this.GetButtonPower();
|
||||
if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
{
|
||||
btnNew.Hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string projectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"])) ///是否文件柜查看页面传项目值
|
||||
if (string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
projectId = Request.Params["projectId"];
|
||||
return;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(projectId))
|
||||
if (!string.IsNullOrEmpty(this.ProjectId) || !string.IsNullOrEmpty(this.UnitId)) //项目数据
|
||||
{
|
||||
|
||||
string strSql = "select TrainRecord.TrainingId"
|
||||
+ @",TrainRecord.TrainTitle"
|
||||
+ @",TrainType.TrainTypeName,TrainLevel.TrainLevelName"
|
||||
@@ -92,8 +154,25 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
+ @" LEFT JOIN Base_TrainLevel AS TrainLevel ON TrainRecord.TrainLevelId=TrainLevel.TrainLevelId "
|
||||
+ @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON TrainRecord.TrainingId=CodeRecords.DataId WHERE 1=1 ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
strSql += " AND TrainRecord.ProjectId = @ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", projectId));
|
||||
if (!string.IsNullOrEmpty(txtName.Text))
|
||||
{
|
||||
strSql += " AND TrainRecord.TrainTitle LIKE @TrainTitle";
|
||||
listStr.Add(new SqlParameter("@TrainTitle", "%" + this.txtName.Text + "%"));
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
strSql += " AND TrainRecord.ProjectId = @ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(UnitId))
|
||||
{
|
||||
strSql += " AND TrainRecord.UnitId = @UnitId";
|
||||
listStr.Add(new SqlParameter("@UnitId", UnitId));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"])) ///是否文件柜查看页面传项目值
|
||||
{
|
||||
strSql += " AND TrainRecord.States = @States"; ///状态为已完成
|
||||
@@ -119,16 +198,18 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
strSql += " AND TrainRecord.TrainStartDate <= @EndDate ";
|
||||
listStr.Add(new SqlParameter("@EndDate", this.txtEndDate.Text.Trim()));
|
||||
}
|
||||
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId))
|
||||
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
|
||||
{
|
||||
strSql += " AND TrainRecord.UnitIds LIKE @UnitId1";
|
||||
listStr.Add(new SqlParameter("@UnitId1", "%" + this.CurrUser.UnitId + "%"));
|
||||
}
|
||||
if (this.drpUnitId.SelectedValue != BLL.Const._Null)
|
||||
{
|
||||
strSql += " AND TrainRecord.UnitIds LIKE @UnitId";
|
||||
listStr.Add(new SqlParameter("@UnitId", "%" + this.drpUnitId.SelectedValue.Trim() + "%"));
|
||||
strSql += " AND TrainRecord.UnitIds LIKE @UnitIds";
|
||||
listStr.Add(new SqlParameter("@UnitIds", "%" + this.drpUnitId.SelectedValue.Trim() + "%"));
|
||||
}
|
||||
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
@@ -144,12 +225,101 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
}
|
||||
|
||||
JObject summary = new JObject
|
||||
{
|
||||
{ "TeachMan", "合计:" },
|
||||
{ "TrainPersonNum", totalPersonNum }
|
||||
};
|
||||
{
|
||||
{ "TeachMan", "合计:" },
|
||||
{ "TrainPersonNum", totalPersonNum }
|
||||
};
|
||||
|
||||
Grid1.SummaryData = summary;
|
||||
|
||||
|
||||
}
|
||||
#region 2023-6-27 15:03:28修改废弃代码
|
||||
//else //公司级数据
|
||||
//{
|
||||
|
||||
// string strSql = "select TrainRecord.TrainingId"
|
||||
// + @",TrainRecord.TrainTitle"
|
||||
// + @",TrainType.TrainTypeName,TrainLevel.TrainLevelName"
|
||||
// + @",TrainRecord.TrainStartDate"
|
||||
// + @",TrainRecord.TrainEndDate"
|
||||
// + @",TrainRecord.TeachHour"
|
||||
// + @",TrainRecord.TeachMan"
|
||||
// + @",TrainRecord.TrainPersonNum"
|
||||
// + @",TrainingCode"
|
||||
// // + @",CodeRecords.Code AS TrainingCode"
|
||||
// + @",(CASE WHEN TrainRecord.States = " + BLL.Const.State_0 + " OR TrainRecord.States IS NULL THEN '待['+OperateUser.UserName+']提交' WHEN TrainRecord.States = " + BLL.Const.State_2 + " THEN '审核/审批完成' ELSE '待['+OperateUser.UserName+']办理' END) AS FlowOperateName"
|
||||
// + @",TrainRecord.UnitIds"
|
||||
// + @" from EduTrain_TrainRecord AS TrainRecord "
|
||||
// + @" LEFT JOIN Sys_FlowOperate AS FlowOperate ON TrainRecord.TrainingId=FlowOperate.DataId AND FlowOperate.IsClosed <> 1"
|
||||
// + @" LEFT JOIN Sys_User AS OperateUser ON FlowOperate.OperaterId=OperateUser.UserId "
|
||||
// + @" LEFT JOIN Base_TrainType AS TrainType ON TrainRecord.TrainTypeId=TrainType.TrainTypeId "
|
||||
// + @" LEFT JOIN Base_TrainLevel AS TrainLevel ON TrainRecord.TrainLevelId=TrainLevel.TrainLevelId "
|
||||
// + @" LEFT JOIN Sys_CodeRecords AS CodeRecords ON TrainRecord.TrainingId=CodeRecords.DataId WHERE 1=1 ";
|
||||
// List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
// if (!string.IsNullOrEmpty(ProjectId))
|
||||
// {
|
||||
// strSql += " AND (TrainRecord.ProjectId = '' or TrainRecord.ProjectId is null) ";
|
||||
// //listStr.Add(new SqlParameter("@ProjectId", ProjectId));
|
||||
// }
|
||||
|
||||
|
||||
// if (this.drpTrainType.SelectedValue != BLL.Const._Null)
|
||||
// {
|
||||
// strSql += " AND TrainRecord.TrainTypeId = @TrainType";
|
||||
// listStr.Add(new SqlParameter("@TrainType", this.drpTrainType.SelectedValue));
|
||||
// }
|
||||
// if (this.drpTrainLevel.SelectedValue != BLL.Const._Null)
|
||||
// {
|
||||
// strSql += " AND TrainRecord.TrainLevelId = @TrainLevel";
|
||||
// listStr.Add(new SqlParameter("@TrainLevel", this.drpTrainLevel.SelectedValue));
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(this.txtStartDate.Text.Trim()))
|
||||
// {
|
||||
// strSql += " AND TrainRecord.TrainStartDate >= @StartDate ";
|
||||
// listStr.Add(new SqlParameter("@StartDate", this.txtStartDate.Text.Trim()));
|
||||
// }
|
||||
// if (!string.IsNullOrEmpty(this.txtEndDate.Text.Trim()))
|
||||
// {
|
||||
// strSql += " AND TrainRecord.TrainStartDate <= @EndDate ";
|
||||
// listStr.Add(new SqlParameter("@EndDate", this.txtEndDate.Text.Trim()));
|
||||
// }
|
||||
// if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.CurrUser.LoginProjectId, this.CurrUser.UnitId))
|
||||
// {
|
||||
// strSql += " AND TrainRecord.UnitIds LIKE @UnitId1";
|
||||
// listStr.Add(new SqlParameter("@UnitId1", "%" + this.CurrUser.UnitId + "%"));
|
||||
// }
|
||||
// strSql += " AND TrainRecord.UnitIds LIKE @UnitId";
|
||||
// listStr.Add(new SqlParameter("@UnitId", "%" + this.ucTree.UnitId.Trim() + "%"));
|
||||
|
||||
// SqlParameter[] parameter = listStr.ToArray();
|
||||
// DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
// Grid1.RecordCount = tb.Rows.Count;
|
||||
// //tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
// var table = this.GetPagedDataTable(Grid1, tb);
|
||||
|
||||
// Grid1.DataSource = table;
|
||||
// Grid1.DataBind();
|
||||
// int totalPersonNum = 0;
|
||||
// for (int i = 0; i < tb.Rows.Count; i++)
|
||||
// {
|
||||
// totalPersonNum += Funs.GetNewIntOrZero(tb.Rows[i][8].ToString());
|
||||
// }
|
||||
|
||||
// JObject summary = new JObject
|
||||
// {
|
||||
// { "TeachMan", "合计:" },
|
||||
// { "TrainPersonNum", totalPersonNum }
|
||||
// };
|
||||
|
||||
// Grid1.SummaryData = summary;
|
||||
//}
|
||||
#endregion
|
||||
string projectId = this.CurrUser.LoginProjectId;
|
||||
if (!string.IsNullOrEmpty(Request.Params["projectId"])) ///是否文件柜查看页面传项目值
|
||||
{
|
||||
projectId = Request.Params["projectId"];
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -186,7 +356,6 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.Grid1.PageSize = Funs.GetNewIntOrZero(this.ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
@@ -199,7 +368,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainRecordEdit.aspx", "编辑 - ")));
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainRecordEdit.aspx?trainType={0}", trainType, "编辑 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -238,7 +407,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
var trainRecord = EduTrain_TrainRecordService.GetTrainingByTrainingId(TrainingId);
|
||||
if (trainRecord != null)
|
||||
{
|
||||
if (this.btnMenuEdit.Hidden || trainRecord.States == BLL.Const.State_2) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
||||
if (this.btnMenuEdit.Hidden) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TrainRecordView.aspx?TrainingId={0}", TrainingId, "查看 - ")));
|
||||
}
|
||||
@@ -288,6 +457,8 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
}
|
||||
}
|
||||
}
|
||||
// Project_HSSEData_HSSEService.StatisticalData(this.CurrUser.LoginProjectId, Project_HSSEData_HSSEService.HSSEDateType.EducationAndTraining);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -335,11 +506,15 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (Request.Params["value"] == "0")
|
||||
{
|
||||
return;
|
||||
}
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectTrainRecordMenuId);
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.ProjectTrainRecordMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
@@ -506,8 +681,12 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
/// <param name="e"></param>
|
||||
protected void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var getTrainRecords = from x in Funs.DB.EduTrain_TrainRecord
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId && x.PlanId != null
|
||||
where x.ProjectId == this.ProjectId && x.PlanId != null
|
||||
select x;
|
||||
if (getTrainRecords.Count() > 0)
|
||||
{
|
||||
@@ -515,7 +694,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
{
|
||||
var getTrainRecordDetail = Funs.DB.EduTrain_TrainRecordDetail.Where(x => x.TrainingId == itemRecord.TrainingId);
|
||||
if (itemRecord.TrainPersonNum > getTrainRecordDetail.Count())
|
||||
{
|
||||
{
|
||||
var getTrainingTasks = from x in Funs.DB.Training_Task
|
||||
where x.PlanId == itemRecord.PlanId
|
||||
select x;
|
||||
@@ -596,13 +775,13 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
}
|
||||
|
||||
var getTestPlanStates = from x in Funs.DB.Training_TestPlan
|
||||
join y in Funs.DB.Training_Plan on x.PlanId equals y.PlanId
|
||||
where x.States == Const.State_3 && y.States == Const.State_2
|
||||
select x;
|
||||
join y in Funs.DB.Training_Plan on x.PlanId equals y.PlanId
|
||||
where x.States == Const.State_3 && y.States == Const.State_2
|
||||
select x;
|
||||
foreach (var item in getTestPlanStates)
|
||||
{
|
||||
////TODO 讲培训计划 考试记录 写入到培训记录
|
||||
BLL. APITrainRecordService.InsertTrainRecord(item);
|
||||
BLL.APITrainRecordService.InsertTrainRecord(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user