/// <summary> /// 修改课程 /// </summary> /// <param name="ht">参数Key:Id</param> /// <returns></returns> public JsonModel UpdatePlan(Hashtable ht) { try { //定义JSON标准格式实体中 JsonModel jsonModel = new JsonModel(); JsonModel IsFiling = Filing(ht); if (IsFiling.Status == "ok") { jsonModel.Status = "no"; jsonModel.Msg = "计划已归档,不能修改!"; } int obj = new EmsDAL.PlanExperiment().getTeachingPlan(ht["MainTeacher"].ToString(), ht["Name"].ToString(), ht["LearnYear"].ToString()); if (obj > 0) { jsonModel.Status = "cf"; jsonModel.Msg = "课程名称重复!"; } else { EmsModel.TeachingPlan ModelPlan = dal.GetData(ht["Id"].ToString())[0]; ModelPlan.Name = ht["Name"].ToString(); //课程名称 ModelPlan.MainTeacher = ht["MainTeacher"].ToString(); //主讲教师 ModelPlan.GuideTeacher1 = ht["GuideTeacher1"].ToString(); //指导教师1 ModelPlan.GuideTeacher2 = ht["GuideTeacher2"].ToString(); //指导教师2 ModelPlan.Contents = ht["Contents"].ToString(); //课程内容 ModelPlan.LearnYear = Convert.ToInt32(ht["LearnYear"].ToString()); //学年学期ID //ModelPlan.Creator = Creator;//创建人登录名 //ModelPlan.CreateTime = DateTime.Now;//创建时间 ModelPlan.Editor = ht["Editor"].ToString(); //修改人登录名 ModelPlan.UpdateTime = DateTime.Now; //修改时间 int result = dal.Update(ModelPlan); if (result > 0) { jsonModel.Status = "ok"; jsonModel.Msg = "修改成功"; } else { jsonModel.Status = "no"; jsonModel.Msg = "修改失败"; } } return(jsonModel); } catch (Exception ex) { JsonModel jsonModel = new JsonModel(); jsonModel.Status = "error"; jsonModel.Msg = ex.ToString(); return(jsonModel); } }
/// <summary> /// 添加课程 /// </summary> /// <param name="ht">参数Key:Id</param> /// <returns></returns> public JsonModel AddPlan(EmsModel.TeachingPlan model) { try { JsonModel jsonModel = new JsonModel(); int obj = new EmsDAL.PlanExperiment().getTeachingPlan(model.MainTeacher.ToString(), model.Name.ToString(), model.LearnYear.ToString()); if (obj > 0) { jsonModel.Status = "cf"; jsonModel.Msg = "课程名称重复!"; } else { int result = dal.Add(model); //定义JSON标准格式实体中 if (result > 0) { jsonModel.Status = "ok"; jsonModel.Msg = "添加成功"; } else { jsonModel.Status = "no"; jsonModel.Msg = "添加失败"; } } return(jsonModel); } catch (Exception ex) { JsonModel jsonModel = new JsonModel(); jsonModel.Status = "error"; jsonModel.Msg = ex.ToString(); return(jsonModel); } }