自主管理加分项
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using Microsoft.SqlServer.Dts.Runtime;
|
||||
using Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -19,65 +22,81 @@ namespace BLL
|
||||
/// <returns></returns>
|
||||
public static Model.Training_Plan GetPlanById(string planId)
|
||||
{
|
||||
return Funs.DB.Training_Plan.FirstOrDefault(e => e.PlanId == planId);
|
||||
return db.Training_Plan.FirstOrDefault(e => e.PlanId == planId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据检查Id获取培训计划
|
||||
/// </summary>
|
||||
/// <param name="checkId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.Training_Plan GetPlanByCheckId(string checkId)
|
||||
{
|
||||
return db.Training_Plan.FirstOrDefault(e => e.CheckId == checkId && e.IsRetakeCourse == 1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加培训计划
|
||||
/// </summary>
|
||||
/// <param name="plan"></param>
|
||||
public static void AddPlan(Model.Training_Plan trainingPlan)
|
||||
/// <param name="model"></param>
|
||||
public static void AddPlan(Model.Training_Plan model)
|
||||
{
|
||||
Model.Training_Plan newPlan = new Model.Training_Plan
|
||||
Model.Training_Plan newModel = new Model.Training_Plan
|
||||
{
|
||||
PlanId = trainingPlan.PlanId,
|
||||
PlanCode = trainingPlan.PlanCode,
|
||||
ProjectId = trainingPlan.ProjectId,
|
||||
DesignerId = trainingPlan.DesignerId,
|
||||
PlanName = trainingPlan.PlanName,
|
||||
TrainContent = trainingPlan.TrainContent,
|
||||
TrainStartDate = trainingPlan.TrainStartDate,
|
||||
TeachHour = trainingPlan.TeachHour,
|
||||
TeachMan = trainingPlan.TeachMan,
|
||||
TeachAddress = trainingPlan.TeachAddress,
|
||||
TrainTypeId = trainingPlan.TrainTypeId,
|
||||
TrainLevelId = trainingPlan.TrainLevelId,
|
||||
DesignerDate =trainingPlan.DesignerDate,
|
||||
UnitIds = trainingPlan.UnitIds,
|
||||
WorkPostId = trainingPlan.WorkPostId,
|
||||
States = trainingPlan.States,
|
||||
Cycle=trainingPlan.Cycle
|
||||
PlanId = model.PlanId,
|
||||
PlanCode = model.PlanCode,
|
||||
ProjectId = model.ProjectId,
|
||||
DesignerId = model.DesignerId,
|
||||
PlanName = model.PlanName,
|
||||
TrainContent = model.TrainContent,
|
||||
TrainStartDate = model.TrainStartDate,
|
||||
TeachHour = model.TeachHour,
|
||||
TeachMan = model.TeachMan,
|
||||
TeachAddress = model.TeachAddress,
|
||||
TrainTypeId = model.TrainTypeId,
|
||||
TrainLevelId = model.TrainLevelId,
|
||||
DesignerDate = model.DesignerDate,
|
||||
UnitIds = model.UnitIds,
|
||||
WorkPostId = model.WorkPostId,
|
||||
States = model.States,
|
||||
Cycle = model.Cycle,
|
||||
IsRetakeCourse = model.IsRetakeCourse,
|
||||
CheckType = model.CheckType,
|
||||
CheckId = model.CheckId
|
||||
};
|
||||
db.Training_Plan.InsertOnSubmit(newPlan);
|
||||
db.Training_Plan.InsertOnSubmit(newModel);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改培训计划
|
||||
/// </summary>
|
||||
/// <param name="plan"></param>
|
||||
public static void UpdatePlan(Model.Training_Plan newTrainingPlan)
|
||||
/// <param name="model"></param>
|
||||
public static void UpdatePlan(Model.Training_Plan model)
|
||||
{
|
||||
Model.Training_Plan isUpdate = Funs.DB.Training_Plan.FirstOrDefault(e => e.PlanId == newTrainingPlan.PlanId);
|
||||
Model.Training_Plan isUpdate = Funs.DB.Training_Plan.FirstOrDefault(e => e.PlanId == model.PlanId);
|
||||
if (isUpdate != null)
|
||||
{
|
||||
isUpdate.PlanName = newTrainingPlan.PlanName;
|
||||
isUpdate.TrainContent = newTrainingPlan.TrainContent;
|
||||
isUpdate.TrainStartDate = newTrainingPlan.TrainStartDate;
|
||||
isUpdate.TeachHour = newTrainingPlan.TeachHour;
|
||||
isUpdate.TrainEndDate = newTrainingPlan.TrainEndDate;
|
||||
isUpdate.TeachMan = newTrainingPlan.TeachMan;
|
||||
isUpdate.TeachAddress = newTrainingPlan.TeachAddress;
|
||||
isUpdate.TrainTypeId = newTrainingPlan.TrainTypeId;
|
||||
isUpdate.TrainLevelId = newTrainingPlan.TrainLevelId;
|
||||
isUpdate.DesignerDate = newTrainingPlan.DesignerDate;
|
||||
isUpdate.UnitIds = newTrainingPlan.UnitIds;
|
||||
isUpdate.WorkPostId = newTrainingPlan.WorkPostId;
|
||||
isUpdate.States = newTrainingPlan.States;
|
||||
isUpdate.Cycle = newTrainingPlan.Cycle;
|
||||
Funs.DB.SubmitChanges();
|
||||
isUpdate.PlanName = model.PlanName;
|
||||
isUpdate.TrainContent = model.TrainContent;
|
||||
isUpdate.TrainStartDate = model.TrainStartDate;
|
||||
isUpdate.TeachHour = model.TeachHour;
|
||||
isUpdate.TrainEndDate = model.TrainEndDate;
|
||||
isUpdate.TeachMan = model.TeachMan;
|
||||
isUpdate.TeachAddress = model.TeachAddress;
|
||||
isUpdate.TrainTypeId = model.TrainTypeId;
|
||||
isUpdate.TrainLevelId = model.TrainLevelId;
|
||||
isUpdate.DesignerDate = model.DesignerDate;
|
||||
isUpdate.UnitIds = model.UnitIds;
|
||||
isUpdate.WorkPostId = model.WorkPostId;
|
||||
isUpdate.States = model.States;
|
||||
isUpdate.Cycle = model.Cycle;
|
||||
isUpdate.IsRetakeCourse = model.IsRetakeCourse;
|
||||
isUpdate.CheckType = model.CheckType;
|
||||
isUpdate.CheckId = model.CheckId;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,11 +106,11 @@ namespace BLL
|
||||
/// <param name="planId"></param>
|
||||
public static void DeletePlanById(string planId)
|
||||
{
|
||||
Model.Training_Plan plan = Funs.DB.Training_Plan.FirstOrDefault(e => e.PlanId == planId);
|
||||
Model.Training_Plan plan = db.Training_Plan.FirstOrDefault(e => e.PlanId == planId);
|
||||
if (plan != null)
|
||||
{
|
||||
Funs.DB.Training_Plan.DeleteOnSubmit(plan);
|
||||
Funs.DB.SubmitChanges();
|
||||
db.Training_Plan.DeleteOnSubmit(plan);
|
||||
db.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,5 +122,122 @@ namespace BLL
|
||||
{
|
||||
return (from x in db.Training_Plan orderby x.PlanCode select x).ToList();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检查重修,并生成培训计划、任务
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
public static void RetakeCourseProducePlan(RetakeCourseProducePlanInfo info)
|
||||
{
|
||||
var plan = GetPlanByCheckId(info.CheckId);
|
||||
var person = PersonService.GetPersonById(info.PersonId);
|
||||
var companyTrainingItem = CompanyTrainingItemService.GetCompanyTrainingItemById(info.CompanyTrainingItemId);
|
||||
var teachHour = companyTrainingItem.LearningTime / 3600;
|
||||
|
||||
string planId = string.Empty;
|
||||
if (plan != null)
|
||||
{//编辑培训计划
|
||||
planId = plan.PlanId;
|
||||
Model.Training_Plan planModel = new Model.Training_Plan
|
||||
{
|
||||
ProjectId = info.CurrProjectId,
|
||||
PlanName = info.CheckTypeName,
|
||||
TrainContent = info.CheckTypeName,
|
||||
TeachHour = teachHour,
|
||||
UnitIds = person.UnitId,
|
||||
WorkPostId = person.WorkPostId,
|
||||
TrainStartDate = plan.TrainStartDate,
|
||||
TrainEndDate = info.TrainEndDate,
|
||||
TeachMan = plan.TeachMan,
|
||||
TeachAddress = plan.TeachAddress,
|
||||
TrainTypeId = Const.RetakeCourseTrainTypeId,
|
||||
TrainLevelId = Const.OtherTrainLevelId,
|
||||
States = "1",
|
||||
Cycle = "",
|
||||
IsRetakeCourse = 1,
|
||||
CheckType = plan.CheckType,
|
||||
CheckId = plan.CheckId
|
||||
};
|
||||
UpdatePlan(planModel);
|
||||
}
|
||||
else
|
||||
{//生成培训计划
|
||||
planId = SQLHelper.GetNewID();
|
||||
string code = ProjectService.GetProjectByProjectId(info.CurrProjectId).ProjectCode + "-";
|
||||
string planCode = BLL.SQLHelper.RunProcNewId("SpGetNewCode5ByProjectId", "dbo.Training_Plan", "PlanCode", info.CurrProjectId, code);
|
||||
|
||||
Model.Training_Plan planModel = new Model.Training_Plan
|
||||
{
|
||||
PlanId = planId,
|
||||
PlanCode = planCode,
|
||||
ProjectId = info.CurrProjectId,
|
||||
DesignerId = info.CurrUserId,
|
||||
DesignerDate = DateTime.Now,
|
||||
PlanName = info.CheckTypeName,
|
||||
TrainContent = info.CheckTypeName,
|
||||
TrainStartDate = DateTime.Now,
|
||||
TrainEndDate = info.TrainEndDate,
|
||||
TeachHour = teachHour,
|
||||
//TeachMan = model.TeachMan,
|
||||
//TeachAddress = model.TeachAddress,
|
||||
TrainTypeId = Const.RetakeCourseTrainTypeId,
|
||||
TrainLevelId = Const.OtherTrainLevelId,
|
||||
UnitIds = person.UnitId,
|
||||
WorkPostId = person.WorkPostId,
|
||||
States = "1",
|
||||
Cycle = "",
|
||||
IsRetakeCourse = 1,
|
||||
CheckType = info.CheckType.ToString(),
|
||||
CheckId = info.CheckId
|
||||
};
|
||||
AddPlan(planModel);
|
||||
}
|
||||
|
||||
//删除培训明细
|
||||
TrainingPlanItemService.DeletePlanItemByPlanId(planId);
|
||||
//删除任务
|
||||
TrainingTaskService.DeleteTaskByPlanId(planId);
|
||||
|
||||
string taskId = SQLHelper.GetNewID();
|
||||
//新增培训任务
|
||||
Model.Training_Task newTrainDetail = new Model.Training_Task
|
||||
{
|
||||
TaskId = taskId,
|
||||
ProjectId = info.CurrProjectId,
|
||||
PlanId = planId,
|
||||
UserId = info.PersonId,
|
||||
TaskDate = DateTime.Now,
|
||||
States = Const.State_1,
|
||||
};
|
||||
TrainingTaskService.AddTask(newTrainDetail);
|
||||
|
||||
//新增培训任务明细
|
||||
Model.Training_TaskItem newTaskItem = new Model.Training_TaskItem
|
||||
{
|
||||
TaskItemId = SQLHelper.GetNewID(),
|
||||
TaskId = taskId,
|
||||
PlanId = planId,
|
||||
PersonId = info.PersonId,
|
||||
TrainingItemCode = companyTrainingItem.CompanyTrainingItemCode,
|
||||
TrainingItemName = companyTrainingItem.CompanyTrainingItemName,
|
||||
AttachUrl = companyTrainingItem.AttachUrl,
|
||||
CompanyTrainingItemId = info.CompanyTrainingItemId,
|
||||
//LearnTime = trainingItem.LearningTime,
|
||||
//VideoProgress = 0,
|
||||
};
|
||||
db.Training_TaskItem.InsertOnSubmit(newTaskItem);
|
||||
db.SubmitChanges();
|
||||
|
||||
//新增培训明细
|
||||
Model.Training_PlanItem newPlanItem = new Model.Training_PlanItem
|
||||
{
|
||||
PlanItemId = SQLHelper.GetNewID(),
|
||||
PlanId = planId,
|
||||
CompanyTrainingItemId = info.CompanyTrainingItemId,
|
||||
CompanyTrainingId = companyTrainingItem.CompanyTrainingId
|
||||
};
|
||||
TrainingPlanItemService.AddPlanItem(newPlanItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user