/// <summary> /// 标记删除 /// </summary> /// <param name="ht">参数Key:Id</param> /// <returns></returns> public JsonModel MarkDelete(Hashtable ht) { try { //定义JSON标准格式实体中 JsonModel jsonModel = new JsonModel(); //判断计划是否归档 List <EmsModel.TeachingPlan> modListTP = dal.GetData(ht["Id"].ToString()); if (modListTP[0].IsDelete == 2) { jsonModel.Status = "no"; jsonModel.Msg = "课程已归档,不能删除!"; return(jsonModel); } //判断计划下是否存在实验 Hashtable htPE = new Hashtable(); htPE.Add("PlanId", ht["Id"].ToString()); htPE.Add("IsDelete", "全部"); htPE.Add("PageIndex", 1); htPE.Add("PageSize", 10); htPE = common.AddStartEndIndex(ht); EmsDAL.PlanExperiment peDAL = new EmsDAL.PlanExperiment(); DataTable modListPE = peDAL.GetList(htPE); if (modListPE.Rows.Count > 0) { jsonModel.Status = "no"; jsonModel.Msg = "请先删除实验,再删除课程!"; return(jsonModel); } //修改为删除状态 ht.Add("IsDelete", 1); ht.Add("UpdateTime", DateTime.Now); ht.Add("TableName", "TeachingPlan"); EmsDAL.DALHelper HelperDAL = new EmsDAL.DALHelper(); int result = HelperDAL.UpdateIsDelete(ht); 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 MarkDelete(Hashtable ht) { try { //定义JSON标准格式实体中 JsonModel jsonModel = new JsonModel(); //判断实验是否归档 List <EmsModel.PlanExperiment> modListPE = dal.GetData(ht["Id"].ToString()); if (modListPE[0].IsDelete == 2) { jsonModel.Status = "no"; jsonModel.Msg = "实验已归档,不能删除!"; return(jsonModel); } else if (modListPE[0].Status == 1) { jsonModel.Status = "no"; jsonModel.Msg = "实验已生成订单,不能删除!"; return(jsonModel); } //修改为删除状态 EmsDAL.DALHelper HelperDAL = new EmsDAL.DALHelper(); ht.Add("IsDelete", 1); ht.Add("UpdateTime", DateTime.Now); ht.Add("TableName", "PlanExperiment"); int result = HelperDAL.UpdateIsDelete(ht); if (result == 1) { 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); } }