Esempio 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));
            }
        }
Esempio 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));
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 修改人员健康档案
        /// </summary>
        /// <param name="docmentEdit"></param>
        /// <returns></returns>
        public ActionResult <bool> EditHealDocment(HealDocmentEdit docmentEdit)
        {
            try
            {
                var dbhd = _rpshd.GetModel(docmentEdit.ID);
                if (dbhd == null)
                {
                    throw new Exception("未找到所要修改的健康档案!");
                }
                var check = _rpshd.Any(p => p.ID != docmentEdit.ID && p.EmployeeID == docmentEdit.EmployeeID);
                if (check)
                {
                    throw new Exception("该人员的健康档案已存在!");
                }
                dbhd = docmentEdit.CopyTo <Heal_Docment>(dbhd);


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

                //电子文档
                srvFile.DelFileByBusinessId(dbhd.ID);
                var files = new AttachFileSave
                {
                    BusinessID = dbhd.ID,
                    files      = from f in docmentEdit.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.Update(dbhd);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 修改体检模型
        /// </summary>
        /// <param name="docmentEdit"></param>
        /// <returns></returns>
        public ActionResult <bool> EditHealRecord(HealRecordsEdit recordsEdit)
        {
            try
            {
                var dbhr = _rpshr.GetModel(recordsEdit.ID);
                if (dbhr == null)
                {
                    throw new Exception("未找到所要修改的体检信息!");
                }
                var check = _rpshr.Any(p => p.ID != recordsEdit.ID && p.RecDate == recordsEdit.RecDate);
                if (check)
                {
                    throw new Exception("该人员的体检信息已存在!");
                }
                dbhr = recordsEdit.CopyTo <Heal_Records>(dbhr);

                //删除自定义项
                srvUserDefined.DeleteBusinessValue(dbhr.ID);
                //自定义项
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = dbhr.ID,
                    Values     = recordsEdit.UserDefineds
                };
                var defined = srvUserDefined.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }
                //电子文档
                srvFile.DelFileByBusinessId(dbhr.ID);
                var files = new AttachFileSave
                {
                    BusinessID = dbhr.ID,
                    files      = from f in recordsEdit.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.Update(dbhr);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 修改安全会议模型
        /// </summary>
        /// <param name="meetingEdit"></param>
        /// <returns></returns>
        public ActionResult <bool> EditDocMeeting(DocMeetingEdit meetingEdit)
        {
            try
            {
                var dbdm = _rpsdm.GetModel(meetingEdit.ID);
                if (dbdm == null)
                {
                    throw new Exception("未找到所要修改的会议!");
                }
                var check = _rpsdm.Any(p => p.ID != meetingEdit.ID && p.Motif == meetingEdit.Motif);
                if (check)
                {
                    throw new Exception("该会议主题已存在!");
                }
                dbdm = meetingEdit.CopyTo <Doc_Meeting>(dbdm);

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

                //电子文档
                srvFile.DelFileByBusinessId(dbdm.ID);
                var files = new AttachFileSave
                {
                    BusinessID = dbdm.ID,
                    files      = from f in meetingEdit.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);
                }
                _rpsdm.Update(dbdm);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Esempio n. 6
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));
            }
        }
Esempio n. 7
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));
            }
        }
Esempio n. 8
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));
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 修改岗位
        /// </summary>
        /// <param name="post"></param>
        /// <returns></returns>
        public ActionResult <bool> EditPost(PostEdit post)
        {
            try
            {
                var dbpost = _rpspost.GetModel(p => p.ID == post.ID);
                if (dbpost == 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 && p.ID != post.ID);
                if (check)
                {
                    throw new Exception("该岗位名已存在");
                }
                var _dbpost = post.CopyTo <Basic_Post>(dbpost);

                //自定义项
                usedefinedService.DeleteBusinessValue(_dbpost.ID);
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = _dbpost.ID,
                    Values     = post.UserDefineds
                };
                var defined = usedefinedService.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }
                //文件
                srvFile.DelFileByBusinessId(_dbpost.ID);
                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.Update(_dbpost);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Esempio n. 10
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));
            }
        }
Esempio n. 11
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));
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 修改设备设施
        /// </summary>
        /// <param name="facility"></param>
        /// <returns></returns>
        public ActionResult <bool> EditFacility(FacilityEdit facility)
        {
            try
            {
                var dbfacility = _rpsfacilities.GetModel(p => p.ID == facility.ID);
                if (dbfacility == null)
                {
                    throw new Exception("未找到所需修改的设备设施项");
                }
                var _dbfacility = facility.CopyTo <Basic_Facilities>(dbfacility);
                //自定义项
                usedefinedService.DeleteBusinessValue(_dbfacility.ID);
                var definedvalue = new UserDefinedBusinessValue
                {
                    BusinessID = _dbfacility.ID,
                    Values     = facility.UserDefineds
                };
                var defined = usedefinedService.SaveBuisnessValue(definedvalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }
                //文件
                srvFile.DelFileByBusinessId(_dbfacility.ID);
                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.Update(_dbfacility);
                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 修改操作模型
        /// </summary>
        /// <param name="opreation"></param>
        /// <returns></returns>
        public ActionResult <bool> EditOpreation(OpreationEdit opreation)
        {
            try
            {
                var dbopreation = _rpsopreation.GetModel(q => q.ID == opreation.ID);
                if (dbopreation == null)
                {
                    throw new Exception("未找到该操作信息");
                }
                var check = _rpsopreation.Any(p => p.ID != opreation.ID && p.Name == opreation.Name);
                if (check)
                {
                    throw new Exception("已经存在相同的操作:" + opreation.Name);
                }
                dbopreation = opreation.CopyTo <Basic_Opreation>(dbopreation);

                usedefinedService.DeleteBusinessValue(dbopreation.ID);
                var definevalue = new UserDefinedBusinessValue
                {
                    BusinessID = dbopreation.ID,
                    Values     = opreation.UserDefineds
                };
                var defined = usedefinedService.SaveBuisnessValue(definevalue);
                if (defined.state != 200)
                {
                    throw new Exception(defined.msg);
                }
                _rpsopreation.Update(dbopreation);


                _work.Commit();
                return(new ActionResult <bool>(true));
            }
            catch (Exception ex)
            {
                return(new ActionResult <bool>(ex));
            }
        }
Esempio n. 14
0
 /// <summary>
 /// 修改安全制度模型
 /// </summary>
 /// <param name="institutionEdit"></param>
 /// <returns></returns>
 public ActionResult <bool> EditDocInstitution(DocInstitutionEdit institutionEdit)
 {
     try
     {
         var dbin = _rpsin.GetModel(p => p.ID == institutionEdit.ID);
         if (dbin == null)
         {
             throw new Exception("未找到所需修改的安全制度模型");
         }
         var check = _rpsin.Any(p => p.Name == institutionEdit.Name && p.TypeID == institutionEdit.TypeID && p.ID != institutionEdit.ID);
         if (check)
         {
             throw new Exception("该类型下已存在该安全制度模型");
         }
         dbin = institutionEdit.CopyTo <Doc_Institution>(dbin);
         //自定义项
         srvUserDefined.DeleteBusinessValue(dbin.ID);
         var definedvalue = new UserDefinedBusinessValue
         {
             BusinessID = dbin.ID,
             Values     = institutionEdit.UserDefineds
         };
         var defined = srvUserDefined.SaveBuisnessValue(definedvalue);
         if (defined.state != 200)
         {
             throw new Exception(defined.msg);
         }
         _rpsin.Update(dbin);
         _work.Commit();
         return(new ActionResult <bool>(true));
     }
     catch (Exception ex)
     {
         return(new ActionResult <bool>(ex));
     }
 }