167 lines
		
	
	
		
			7.5 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			167 lines
		
	
	
		
			7.5 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Text;
							 | 
						|||
| 
								 | 
							
								using System.Collections;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace BLL
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    /// <summary>
							 | 
						|||
| 
								 | 
							
								    /// 人员报验
							 | 
						|||
| 
								 | 
							
								    /// </summary>
							 | 
						|||
| 
								 | 
							
								    public static class InspectionPersonService
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        public static Model.SGGLDB db = Funs.DB;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 记录数
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        private static int count
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            get;
							 | 
						|||
| 
								 | 
							
								            set;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 根据主键获取人员报验信息
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="inspectionPersonId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static Model.Comprehensive_InspectionPerson GetInspectionPersonById(string inspectionPersonId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return Funs.DB.Comprehensive_InspectionPerson.FirstOrDefault(e => e.InspectionPersonId == inspectionPersonId);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 添加人员报验信息
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="inspectionPerson"></param>
							 | 
						|||
| 
								 | 
							
								        public static void AddInspectionPerson(Model.Comprehensive_InspectionPerson inspectionPerson)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.SGGLDB db = Funs.DB;
							 | 
						|||
| 
								 | 
							
								            Model.Comprehensive_InspectionPerson newInspectionPerson = new Model.Comprehensive_InspectionPerson();
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.InspectionPersonId = inspectionPerson.InspectionPersonId;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.ProjectId = inspectionPerson.ProjectId;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.UnitId = inspectionPerson.UnitId;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.InspectionPersonCode = inspectionPerson.InspectionPersonCode;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.PostId = inspectionPerson.PostId;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.PersonName = inspectionPerson.PersonName;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.CertificateNumber = inspectionPerson.CertificateNumber;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.QualifiedProjectCode = inspectionPerson.QualifiedProjectCode;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.ValidityDate = inspectionPerson.ValidityDate;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.ApprovalTime = inspectionPerson.ApprovalTime;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.DepartureTime = inspectionPerson.DepartureTime;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.Remark = inspectionPerson.Remark;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.AttachUrl = inspectionPerson.AttachUrl;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.CNProfessionalId = inspectionPerson.CNProfessionalId;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.CompileMan = inspectionPerson.CompileMan;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.CompileDate = inspectionPerson.CompileDate;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.IsOnSite = inspectionPerson.IsOnSite;
							 | 
						|||
| 
								 | 
							
								            newInspectionPerson.UnitWorkId = inspectionPerson.UnitWorkId;
							 | 
						|||
| 
								 | 
							
								            db.Comprehensive_InspectionPerson.InsertOnSubmit(newInspectionPerson);
							 | 
						|||
| 
								 | 
							
								            db.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 修改人员报验
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="inspectionPerson"></param>
							 | 
						|||
| 
								 | 
							
								        public static void UpdateInspectionPerson(Model.Comprehensive_InspectionPerson inspectionPerson)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.SGGLDB db = Funs.DB;
							 | 
						|||
| 
								 | 
							
								            Model.Comprehensive_InspectionPerson newInspectionPerson = db.Comprehensive_InspectionPerson.FirstOrDefault(e => e.InspectionPersonId == inspectionPerson.InspectionPersonId);
							 | 
						|||
| 
								 | 
							
								            if (newInspectionPerson != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.ProjectId = inspectionPerson.ProjectId;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.UnitId = inspectionPerson.UnitId;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.InspectionPersonCode = inspectionPerson.InspectionPersonCode;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.PostId = inspectionPerson.PostId;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.PersonName = inspectionPerson.PersonName;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.CertificateNumber = inspectionPerson.CertificateNumber;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.QualifiedProjectCode = inspectionPerson.QualifiedProjectCode;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.ValidityDate = inspectionPerson.ValidityDate;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.ApprovalTime = inspectionPerson.ApprovalTime;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.DepartureTime = inspectionPerson.DepartureTime;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.Remark = inspectionPerson.Remark;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.AttachUrl = inspectionPerson.AttachUrl;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.CNProfessionalId = inspectionPerson.CNProfessionalId;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.IsOnSite = inspectionPerson.IsOnSite;
							 | 
						|||
| 
								 | 
							
								                newInspectionPerson.UnitWorkId = inspectionPerson.UnitWorkId;
							 | 
						|||
| 
								 | 
							
								                db.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 根据主键删除人员报验
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="inspectionPersonId"></param>
							 | 
						|||
| 
								 | 
							
								        public static void DeleteInspectionPerson(string inspectionPersonId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            Model.SGGLDB db = Funs.DB;
							 | 
						|||
| 
								 | 
							
								            Model.Comprehensive_InspectionPerson inspectionPerson = db.Comprehensive_InspectionPerson.FirstOrDefault(e => e.InspectionPersonId == inspectionPersonId);
							 | 
						|||
| 
								 | 
							
								            if (inspectionPerson != null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(inspectionPerson.AttachUrl))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    BLL.UploadAttachmentService.DeleteFile(Funs.RootPath, inspectionPerson.AttachUrl);//删除附件
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                db.Comprehensive_InspectionPerson.DeleteOnSubmit(inspectionPerson);
							 | 
						|||
| 
								 | 
							
								                db.SubmitChanges();
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 根据单位id获取人员报验信息
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="unitId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static Model.Comprehensive_InspectionPerson GetInspectionPersonByUnitId(string unitId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return Funs.DB.Comprehensive_InspectionPerson.FirstOrDefault(e => e.UnitId == unitId);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 根据工种id获取人员报验
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="postId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static Model.Comprehensive_InspectionPerson GetInspectionPersonByPostId(string postId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            return Funs.DB.Comprehensive_InspectionPerson.FirstOrDefault(e => e.PostId == postId);
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 获取人员
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <returns></returns>
							 | 
						|||
| 
								 | 
							
								        public static ListItem[] GetInspectionPersonListByUnit(string projectId, string unitId)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            var q = (from x in Funs.DB.Comprehensive_InspectionPerson where x.ProjectId == projectId && x.UnitId == unitId && x.IsOnSite == true orderby x.InspectionPersonCode select x).ToList();
							 | 
						|||
| 
								 | 
							
								            ListItem[] list = new ListItem[q.Count()];
							 | 
						|||
| 
								 | 
							
								            for (int i = 0; i < q.Count(); i++)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                list[i] = new ListItem(q[i].PersonName ?? "", q[i].InspectionPersonId.ToString());
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            return list;
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 下拉框
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="dropName"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="projectId"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="isShowPlease"></param>
							 | 
						|||
| 
								 | 
							
								        public static void InitInspectionPerson(FineUIPro.DropDownList dropName, string projectId, string unitId, bool isShowPlease)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            dropName.DataValueField = "Value";
							 | 
						|||
| 
								 | 
							
								            dropName.DataTextField = "Text";
							 | 
						|||
| 
								 | 
							
								            dropName.DataSource = GetInspectionPersonListByUnit(projectId, unitId);
							 | 
						|||
| 
								 | 
							
								            dropName.DataBind();
							 | 
						|||
| 
								 | 
							
								            if (isShowPlease)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                Funs.FineUIPleaseSelect(dropName);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |