示例#1
0
 /// <summary>
 /// 删除岗位
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult <bool> DelPost(Guid id)
 {
     try
     {
         var dbpost = _rpspost.GetModel(p => p.ID == id);
         if (dbpost == null)
         {
             throw new Exception("未找到所要删除的岗位");
         }
         var check = _rpspostemp.Any(p => p.PostID == id);
         if (check)
         {
             throw new Exception("该岗位已分配人员,无法删除");
         }
         //删除自定义项
         usedefinedService.DeleteBusinessValue(id);
         //删除文件
         srvFile.DelFileByBusinessId(id);
         _rpspost.Delete(dbpost);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
示例#2
0
        /// <summary>
        /// 删除风险点
        /// </summary>
        /// <param name="pointID"></param>
        /// <returns></returns>
        public ActionResult <bool> DelDangerPoint(Guid pointID)
        {
            try
            {
                var dbdp = rpsdp.GetModel(pointID);
                if (dbdp == null)
                {
                    throw new Exception("未找到改风险点");
                }
                var check = work.Repository <Basic_DangerPointRelation>().Any(p => p.DangerPointID == pointID);
                if (check)
                {
                    throw new Exception("该风险点已配置,无法删除!");
                }
                //删除二维码文件
                var filepath = HttpContext.Current.Server.MapPath(dbdp.QRCoderUrl);
                if (File.Exists(filepath))
                {
                    File.Delete(filepath);
                }
                //风险点图片
                var dImgPath = HttpContext.Current.Server.MapPath(dbdp.DangerPointImg);
                if (File.Exists(dImgPath))
                {
                    File.Delete(dImgPath);
                }
                //警示牌
                var wImgPath = HttpContext.Current.Server.MapPath(dbdp.WarningSign);
                if (File.Exists(wImgPath))
                {
                    File.Delete(wImgPath);
                }


                //文件
                var file = srvFile.DelFileByBusinessId(pointID);

                rpsdp.Delete(dbdp);
                work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
示例#3
0
 /// <summary>
 /// 删除资质模型
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult <bool> DelDocCertificate(Guid id)
 {
     try
     {
         var dbdc = _rpsdc.GetModel(id);
         if (dbdc == null)
         {
             throw new Exception("未找到该资质模型");
         }
         srvFile.DelFileByBusinessId(id);
         _rpsdc.Delete(dbdc);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
示例#4
0
 /// <summary>
 /// 删除设备设施
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult <bool> DelFacility(Guid id)
 {
     try
     {
         var check = _rpsfacilities.Any(p => p.ID == id);
         if (!check)
         {
             throw new Exception("该设备设施不存在");
         }
         usedefinedService.DeleteBusinessValue(id);
         srvFile.DelFileByBusinessId(id);
         _rpsfacilities.Delete(p => p.ID == id);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
示例#5
0
 /// <summary>
 /// 删除安全会议模型
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult <bool> DelDocMeeting(Guid id)
 {
     try
     {
         var dbdm = _rpsdm.GetModel(id);
         if (dbdm == null)
         {
             throw new Exception("未找到所要删除的会议!");
         }
         _rpsdm.Delete(dbdm);
         //删除电子文档
         srvFile.DelFileByBusinessId(id);
         srvUserDefined.DeleteBusinessValue(id);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
示例#6
0
 /// <summary>
 /// 删除体检信息模型
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult <bool> DelHealRecord(Guid id)
 {
     try
     {
         var dbhr = _rpshr.GetModel(id);
         if (dbhr == null)
         {
             throw new Exception("未找到所要删除的体检信息");
         }
         _rpshr.Delete(dbhr);
         //删除电子文档
         srvFile.DelFileByBusinessId(id);
         //删除自定义项
         srvUserDefined.DeleteBusinessValue(id);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
示例#7
0
 /// <summary>
 /// 删除训练项
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public ActionResult <bool> DelTraining(Guid id)
 {
     try
     {
         var dbdt = _rpsdt.GetModel(id);
         if (dbdt == null)
         {
             throw new Exception("未找到该训练项");
         }
         _rpsdt.Delete(dbdt);
         //删除电子文档
         srvFile.DelFileByBusinessId(id);
         //删除培训人员
         _rpsdtemp.Delete(p => p.TrainID == id);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
示例#8
0
        /// <summary>
        /// 删除人员的健康档案
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult <bool> DelHealDocment(Guid id)
        {
            try
            {
                var dbhd = _rpshd.GetModel(id);
                if (dbhd == null)
                {
                    throw new Exception("未找到所要删除的人员健康档案");
                }
                _rpshd.Delete(dbhd);

                _work.Repository <Heal_Records>().Delete(p => p.DocmentID == id);
                //删除电子文档
                srvFile.DelFileByBusinessId(id);
                //删除自定义项
                srvUserDefined.DeleteBusinessValue(id);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }