fix:移成达培训
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
using System.Linq;
|
||||
using Model;
|
||||
using BLL;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
|
||||
namespace FineUIPro.Web.HSSE.EduTrain
|
||||
{
|
||||
@@ -46,7 +48,7 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
{
|
||||
this.GetButtonPower();
|
||||
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
|
||||
BoundTree(treeTestTraining.Nodes, "0");
|
||||
this.CompanyTrainingItemId = Request.QueryString["CompanyTrainingItemId"];
|
||||
this.CompanyTrainingId = Request.QueryString["CompanyTrainingId"];
|
||||
if (!string.IsNullOrEmpty(this.CompanyTrainingItemId))
|
||||
@@ -59,6 +61,25 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
txtCompanyTrainingItemName.Text = q.CompanyTrainingItemName;
|
||||
txtCompileMan.Text = q.CompileMan;
|
||||
hdCompileMan.Text = q.CompileMan;
|
||||
if (!string.IsNullOrEmpty(q.TestTrainingIds))
|
||||
{
|
||||
ddTestTraining.Values = q.TestTrainingIds.Split(',');
|
||||
string text = "";
|
||||
var trains = Funs.DB.Training_TestTraining.ToList();
|
||||
foreach (var ids in ddTestTraining.Values)
|
||||
{
|
||||
var t = trains.FirstOrDefault(x => x.TrainingId == ids);
|
||||
if (t != null)
|
||||
{
|
||||
text += "[" + t.TrainingCode + "]" + t.TrainingName + ",";
|
||||
}
|
||||
}
|
||||
ddTestTraining.Text = text.TrimEnd(new char[] { ',' });
|
||||
}
|
||||
if (q.LearningTime.HasValue)
|
||||
{
|
||||
txtLearningTime.Text = (q.LearningTime.Value/60).ToString();
|
||||
}
|
||||
if (q.CompileDate != null)
|
||||
{
|
||||
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", q.CompileDate);
|
||||
@@ -77,10 +98,49 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
private List<Model.Training_TestTraining> GetNewTraining(string parentId)
|
||||
{
|
||||
return (from x in Funs.DB.Training_TestTraining
|
||||
where x.SupTrainingId == parentId
|
||||
orderby x.TrainingCode
|
||||
select x).ToList();
|
||||
}
|
||||
private void BoundTree(TreeNodeCollection nodes, string parentId)
|
||||
{
|
||||
var dt = GetNewTraining(parentId);
|
||||
if (dt.Count() > 0)
|
||||
{
|
||||
TreeNode tn = null;
|
||||
foreach (var dr in dt)
|
||||
{
|
||||
string name = dr.TrainingName;
|
||||
if (!string.IsNullOrEmpty(dr.TrainingCode))
|
||||
{
|
||||
name = "[" + dr.TrainingCode + "]" + dr.TrainingName;
|
||||
}
|
||||
tn = new TreeNode
|
||||
{
|
||||
|
||||
Text = name,
|
||||
NodeID = dr.TrainingId,
|
||||
EnableClickEvent = true,
|
||||
ToolTip = dr.TrainingName
|
||||
};
|
||||
nodes.Add(tn);
|
||||
///是否存在下级节点
|
||||
var sup = Funs.DB.Training_TestTraining.FirstOrDefault(x => x.SupTrainingId == tn.NodeID);
|
||||
if (sup != null)
|
||||
{
|
||||
BoundTree(tn.Nodes, tn.NodeID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#region 保存
|
||||
/// <summary>
|
||||
/// 保存数据
|
||||
@@ -93,6 +153,14 @@ namespace FineUIPro.Web.HSSE.EduTrain
|
||||
CompanyTrainingItemName = this.txtCompanyTrainingItemName.Text.Trim(),
|
||||
CompileMan = hdCompileMan.Text.Trim()
|
||||
};
|
||||
if (ddTestTraining.Values != null && ddTestTraining.Values.Length > 0)
|
||||
{
|
||||
newCompanyTrainItem.TestTrainingIds = string.Join(",", ddTestTraining.Values);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtLearningTime.Text))
|
||||
{
|
||||
newCompanyTrainItem.LearningTime = int.Parse(txtLearningTime.Text)*60;
|
||||
}
|
||||
if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
|
||||
{
|
||||
newCompanyTrainItem.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
|
||||
|
||||
Reference in New Issue
Block a user