Example #1
0
 /// <summary>
 /// 新建风险点
 /// </summary>
 /// <param name="pointNew"></param>
 /// <returns></returns>
 public ActionResult <bool> AddDangerPoint(DangerPointNew pointNew)
 {
     try
     {
         var check = rpsdp.Any(q => q.Name == pointNew.Name);
         if (check)
         {
             throw new Exception("该风险点已存在");
         }
         if (pointNew.DangerLevel == Guid.Empty)
         {
             throw new Exception("请选择风险等级!");
         }
         if (pointNew.WXYSDictIDs.Count() == 0)
         {
             throw new Exception("请选择危险因素!");
         }
         if (pointNew.OrgID == Guid.Empty)
         {
             throw new Exception("请选责任部门!");
         }
         if (pointNew.Principal == Guid.Empty)
         {
             throw new Exception("请选责任人!");
         }
         var dbdp = pointNew.MAPTO <Basic_DangerPoint>();
         dbdp.WXYSJson    = JsonConvert.SerializeObject(pointNew.WXYSDictIDs);
         dbdp.Code        = Command.CreateCode();
         dbdp.WarningSign = JsonConvert.SerializeObject(pointNew.WarningSigns);
         dbdp.QRCoderUrl  = CreateQRCoder(dbdp.ID);
         //文件
         var files = new AttachFileSave
         {
             BusinessID = dbdp.ID,
             files      = pointNew.fileNews
         };
         var file = srvFile.SaveFiles(files);
         if (file.state != 200)
         {
             throw new Exception(file.msg);
         }
         rpsdp.Add(dbdp);
         work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
Example #2
0
 public ActionResult <bool> AddDangerPoint(DangerPointNew pointNew)
 {
     LogContent = "新建了风险点模型,参数源:" + JsonConvert.SerializeObject(pointNew);
     return(bll.AddDangerPoint(pointNew));
 }