using FineUIPro; using Model; using NPOI.Util; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.Caching; using System.Web.UI.WebControls; namespace BLL { /// /// 培训计划 /// public static class TrainingPlanService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取培训计划 /// /// /// public static Model.Training_Plan GetPlanById(string planId) { return Funs.DB.Training_Plan.FirstOrDefault(e => e.PlanId == planId); } /// /// 添加培训计划 /// /// public static void AddPlan(Model.Training_Plan plan) { Model.Training_Plan newPlan = new Model.Training_Plan { PlanId = plan.PlanId, ProjectId = plan.ProjectId, PlanCode = plan.PlanCode, PlanName = plan.PlanName, DesignerId = plan.DesignerId, DesignerDate = plan.DesignerDate, WorkPostId = plan.WorkPostId, TrainContent = plan.TrainContent, TeachMan = plan.TeachMan, TeachHour = plan.TeachHour, TrainStartDate = plan.TrainStartDate, TrainEndDate = plan.TrainEndDate, TeachAddress = plan.TeachAddress, UnitIds = plan.UnitIds, TrainLevelId = plan.TrainLevelId, TrainTypeId = plan.TrainTypeId, Cycle = plan.Cycle, States = plan.States }; db.Training_Plan.InsertOnSubmit(newPlan); db.SubmitChanges(); } /// /// 修改培训计划 /// /// public static void UpdatePlan(Model.Training_Plan plan) { Model.Training_Plan newPlan = Funs.DB.Training_Plan.FirstOrDefault(e => e.PlanId == plan.PlanId); if (newPlan != null) { newPlan.PlanCode = plan.PlanCode; newPlan.PlanName = plan.PlanName; newPlan.DesignerId = plan.DesignerId; newPlan.DesignerDate = plan.DesignerDate; newPlan.WorkPostId = plan.WorkPostId; newPlan.QRCodeUrl = plan.QRCodeUrl; newPlan.TrainContent = plan.TrainContent; newPlan.TeachMan = plan.TeachMan; newPlan.TeachHour = plan.TeachHour; newPlan.TrainStartDate = plan.TrainStartDate; newPlan.TrainEndDate = plan.TrainEndDate; newPlan.TeachAddress = plan.TeachAddress; newPlan.UnitIds = plan.UnitIds; newPlan.TrainLevelId = plan.TrainLevelId; newPlan.TrainTypeId = plan.TrainTypeId; newPlan.Cycle = plan.Cycle; newPlan.States = plan.States; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除培训计划信息 /// /// public static void DeletePlanById(string planId) { Model.Training_Plan plan = Funs.DB.Training_Plan.FirstOrDefault(e => e.PlanId == planId); if (plan != null) { Funs.DB.Training_Plan.DeleteOnSubmit(plan); Funs.DB.SubmitChanges(); } } /// /// 获取培训计划列 /// /// public static List GetPlanList() { return (from x in db.Training_Plan orderby x.PlanCode select x).ToList(); } } }