Ejemplo n.º 1
0
        /// <summary>
        /// 新建作业模型
        /// </summary>
        /// <param name="opreation"></param>
        /// <returns></returns>
        public ActionResult <bool> AddOpreation(OpreationNew opreation)
        {
            try
            {
                if (opreation == null)
                {
                    throw new Exception("参数有误");
                }
                var check = _rpsopreation.Any(q => q.Name == opreation.Name);
                if (check)
                {
                    throw new Exception("已经存在相同的操作 :" + opreation.Name);
                }
                var _opreation   = opreation.MAPTO <Basic_Opreation>();
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = _opreation.ID,
                    Values     = opreation.UserDefineds
                };
                var defined = usedefinedService.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }
                _rpsopreation.Add(_opreation);

                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 新建安全制度模型
 /// </summary>
 /// <param name="institutionNew"></param>
 /// <returns></returns>
 public ActionResult <bool> AddDocInstitution(DocInstitutionNew institutionNew)
 {
     try
     {
         if (institutionNew == null)
         {
             throw new Exception("参数有误");
         }
         var check = _rpsin.Any(p => p.Name == institutionNew.Name && p.TypeID == institutionNew.TypeID);
         if (check)
         {
             throw new Exception("该类型下已存在该安全制度模型");
         }
         var dbin = institutionNew.MAPTO <Doc_Institution>();
         //自定义项
         var definedvalue = new UserDefinedBusinessValue
         {
             BusinessID = dbin.ID,
             Values     = institutionNew.UserDefineds
         };
         var defined = srvUserDefined.SaveBuisnessValue(definedvalue);
         if (defined.state != 200)
         {
             throw new Exception(defined.msg);
         }
         _rpsin.Add(dbin);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 新建体检模型
        /// </summary>
        /// <param name="recordsNew"></param>
        /// <returns></returns>
        public ActionResult <bool> AddHealRecord(HealRecordsNew recordsNew)
        {
            try
            {
                if (recordsNew == null)
                {
                    throw new Exception("参数有误");
                }
                var check = _rpshr.Any(p => p.DocmentID == recordsNew.DocmentID && p.RecDate == recordsNew.RecDate);
                if (check)
                {
                    throw new Exception("该体检信息已存在!");
                }
                var dbhr = recordsNew.MAPTO <Heal_Records>();

                //自定义项
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = dbhr.ID,
                    Values     = recordsNew.UserDefineds
                };
                var defined = srvUserDefined.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }

                //电子文档
                var files = new AttachFileSave
                {
                    BusinessID = dbhr.ID,
                    files      = from f in recordsNew.AttachFiles
                                 select new AttachFileNew
                    {
                        FileTitle = f.FileTitle,
                        FileType  = f.FileType,
                        FileUrl   = f.FileUrl
                    }
                };

                var fre = srvFile.SaveFiles(files);
                if (fre.state != 200)
                {
                    throw new Exception(fre.msg);
                }

                _rpshr.Add(dbhr);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 新建安全会议模型
        /// </summary>
        /// <param name="meetingNew"></param>
        /// <returns></returns>
        public ActionResult <bool> AddDocMeeting(DocMeetingNew meetingNew)
        {
            try
            {
                if (meetingNew == null)
                {
                    throw new Exception("参数有误");
                }
                var check = _rpsdm.Any(p => p.Motif == meetingNew.Motif);
                if (check)
                {
                    throw new Exception("该会议主题已存在!");
                }
                var dbdm = meetingNew.MAPTO <Doc_Meeting>();

                //自定义项
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = dbdm.ID,
                    Values     = meetingNew.UserDefineds
                };
                var defined = srvUserDefined.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }

                //电子文档
                var files = new AttachFileSave
                {
                    BusinessID = dbdm.ID,
                    files      = from f in meetingNew.AttachFiles
                                 select new AttachFileNew
                    {
                        FileTitle = f.FileTitle,
                        FileType  = f.FileType,
                        FileUrl   = f.FileUrl
                    }
                };

                var fileresult = srvFile.SaveFiles(files);
                if (fileresult.state != 200)
                {
                    throw new Exception(fileresult.msg);
                }

                _rpsdm.Add(dbdm);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 新建健康文档
        /// </summary>
        /// <param name="docmentNew"></param>
        /// <returns></returns>
        public ActionResult <bool> AddHealDocment(HealDocmentNew docmentNew)
        {
            try
            {
                if (docmentNew == null)
                {
                    throw new Exception("参数有误");
                }
                var check = _rpshd.Any(p => p.EmployeeID == docmentNew.EmployeeID);
                if (check)
                {
                    throw new Exception("该人员的健康档案已存在!");
                }
                var dbhd = docmentNew.MAPTO <Heal_Docment>();

                //自定义项
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = dbhd.ID,
                    Values     = docmentNew.UserDefineds
                };
                var defined = srvUserDefined.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }

                //电子文档
                var files = new AttachFileSave
                {
                    BusinessID = dbhd.ID,
                    files      = from f in docmentNew.AttachFiles
                                 select new AttachFileNew
                    {
                        FileTitle = f.FileTitle,
                        FileType  = f.FileType,
                        FileUrl   = f.FileUrl
                    }
                };

                var fre = srvFile.SaveFiles(files);
                if (fre.state != 200)
                {
                    throw new Exception(fre.msg);
                }
                _rpshd.Add(dbhd);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加岗位
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        public ActionResult <bool> AddPost(PostNew post)
        {
            try
            {
                if (post == null)
                {
                    throw new Exception("参数有误");
                }
                if (post.Org == Guid.Empty || post.Principal == Guid.Empty)
                {
                    throw new Exception("请选择组织架构或负责人!");
                }
                var check = _rpspost.Any(p => p.Name == post.Name);
                if (check)
                {
                    throw new Exception("该岗位已存在");
                }

                var dbpost = post.MAPTO <Basic_Post>();
                //自定义项
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = dbpost.ID,
                    Values     = post.UserDefineds
                };
                var defined = usedefinedService.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }
                //文件
                var files = new AttachFileSave
                {
                    BusinessID = dbpost.ID,
                    files      = post.fileNews
                };
                var file = srvFile.SaveFiles(files);
                if (file.state != 200)
                {
                    throw new Exception(file.msg);
                }
                _rpspost.Add(dbpost);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 新建设备设施模型
        /// </summary>
        /// <param name="facility"></param>
        /// <returns></returns>
        public ActionResult <bool> AddFacility(FacilityNew facility)
        {
            try
            {
                if (facility == null)
                {
                    throw new Exception("参数错误");
                }
                var check = _rpsfacilities.Any(p => p.SortID == facility.SortID && p.Name == facility.Name);
                if (check)
                {
                    throw new Exception("该设备设施已存在");
                }
                var dbfacility = facility.MAPTO <Basic_Facilities>();

                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = dbfacility.ID,
                    Values     = facility.UserDefineds
                };
                var defined = usedefinedService.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }
                //文件
                var files = new AttachFileSave
                {
                    BusinessID = dbfacility.ID,
                    files      = facility.fileNews
                };
                var file = srvFile.SaveFiles(files);
                if (file.state != 200)
                {
                    throw new Exception(file.msg);
                }
                _rpsfacilities.Add(dbfacility);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }