提交集团数据穿透修改

This commit is contained in:
2023-06-19 09:04:34 +08:00
parent efed3c7f6f
commit 1e709abb1a
184 changed files with 10777 additions and 3631 deletions
+16 -6
View File
@@ -55,8 +55,8 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\FineUIPro\FineUIPro.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\netstandard2.0\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
@@ -94,18 +94,24 @@
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.7.0.2\lib\netstandard2.0\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
@@ -199,6 +205,7 @@
<Compile Include="BaseInfo\QualityQuestionTypeService.cs" />
<Compile Include="BaseInfo\QuestionTypeService.cs" />
<Compile Include="BaseInfo\RectificationMeasureService.cs" />
<Compile Include="BaseInfo\RiskLevelService.cs" />
<Compile Include="BaseInfo\RulesRegulationsTypeService.cs" />
<Compile Include="BaseInfo\SafetyMeasuresService.cs" />
<Compile Include="BaseInfo\SecretLevelService.cs" />
@@ -481,6 +488,9 @@
<Compile Include="HSSE\Hazard\Hazard_HazardListService.cs" />
<Compile Include="HSSE\Hazard\Hazard_HazardSelectedItemService.cs" />
<Compile Include="HSSE\Hazard\Hazard_OtherHazardService.cs" />
<Compile Include="HSSE\Hazard\Hazard_PatrolPlanService.cs" />
<Compile Include="HSSE\Hazard\Hazard_RoutingInspectionService.cs" />
<Compile Include="HSSE\Hazard\RiskEvaluationRecordService.cs" />
<Compile Include="HSSE\HiddenInspection\HSSE_Hazard_HazardRegisterService.cs" />
<Compile Include="HSSE\HSSESystem\HSSEMainDutyService.cs" />
<Compile Include="HSSE\HSSESystem\ServerSafetyInstitutionService.cs" />
+4
View File
@@ -34,6 +34,8 @@ namespace BLL
CertificateId = certificate.CertificateId,
CertificateCode = certificate.CertificateCode,
CertificateName = certificate.CertificateName,
CertificateType = certificate.CertificateType,
IsRegisterHSSE = certificate.IsRegisterHSSE,
Remark = certificate.Remark
};
db.Base_Certificate.InsertOnSubmit(newCertificate);
@@ -52,6 +54,8 @@ namespace BLL
{
newCertificate.CertificateCode = certificate.CertificateCode;
newCertificate.CertificateName = certificate.CertificateName;
newCertificate.CertificateType = certificate.CertificateType;
newCertificate.IsRegisterHSSE = certificate.IsRegisterHSSE;
newCertificate.Remark = certificate.Remark;
db.SubmitChanges();
}
+122
View File
@@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
/// <summary>
/// 许可证类型
/// </summary>
public static class RiskLevelService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 根据主键获取许可证类型
/// </summary>
/// <param name="licenseTypeId"></param>
/// <returns></returns>
public static Model.Base_RiskLevel GetRiskLevel(string riskLevelId)
{
return Funs.DB.Base_RiskLevel.FirstOrDefault(e => e.RiskLevelId == riskLevelId);
}
/// <summary>
/// 添加许可证类型
/// </summary>
/// <param name="licenseType"></param>
public static void AddRiskLevel(Model.Base_RiskLevel reskLevel)
{
Model.SGGLDB db = Funs.DB;
Model.Base_RiskLevel newreskLevel = new Model.Base_RiskLevel
{
RiskLevelId = reskLevel.RiskLevelId,
RiskLevel = reskLevel.RiskLevel,
RiskLevelName = reskLevel.RiskLevelName,
ControlMeasures = reskLevel.ControlMeasures,
Days = reskLevel.Days,
Remark = reskLevel.Remark,
MaxValue = reskLevel.MaxValue,
MinValue = reskLevel.MinValue
};
db.Base_RiskLevel.InsertOnSubmit(newreskLevel);
db.SubmitChanges();
}
/// <summary>
/// 修改许可证类型
/// </summary>
/// <param name="licenseType"></param>
public static void UpdateLicenseType(Model.Base_RiskLevel riskLevel)
{
Model.SGGLDB db = Funs.DB;
Model.Base_RiskLevel newRiskLevel = db.Base_RiskLevel.FirstOrDefault(e => e.RiskLevelId == riskLevel.RiskLevelId);
if (newRiskLevel != null)
{
newRiskLevel.RiskLevel = riskLevel.RiskLevel;
newRiskLevel.RiskLevelName = riskLevel.RiskLevelName;
newRiskLevel.MinValue = riskLevel.MinValue;
newRiskLevel.MaxValue = riskLevel.MaxValue;
newRiskLevel.ControlMeasures = riskLevel.ControlMeasures;
newRiskLevel.Days = riskLevel.Days;
newRiskLevel.Remark = riskLevel.Remark;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除许可证类型
/// </summary>
/// <param name="licenseTypeId"></param>
public static void DeleteRiskLevelById(string riskLevelId)
{
Model.SGGLDB db = Funs.DB;
Model.Base_RiskLevel riskLevel = db.Base_RiskLevel.FirstOrDefault(e => e.RiskLevelId== riskLevelId);
if (riskLevel != null)
{
db.Base_RiskLevel.DeleteOnSubmit(riskLevel);
db.SubmitChanges();
}
}
/// <summary>
/// 获取许可证类型下拉选择项
/// </summary>
/// <returns></returns>
public static List<Model.Base_RiskLevel> GetLicenseTypeList()
{
return (from x in Funs.DB.Base_RiskLevel orderby x.RiskLevel select x).ToList();
}
#region
/// <summary>
/// 许可证类型下拉框
/// </summary>
/// <param name="dropName">下拉框名字</param>
/// <param name="isShowPlease">是否显示请选择</param>
public static void InitRiskLevelDropDownList(FineUIPro.DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "RiskLevelId";
dropName.DataTextField = "RiskLevelName";
dropName.DataSource = GetLicenseTypeList();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
public static void InitRiskLevelDropDownListByRiskLevelName(FineUIPro.DropDownList dropName, bool isShowPlease)
{
dropName.DataValueField = "RiskLevelName";
dropName.DataTextField = "RiskLevelName";
dropName.DataSource = GetLicenseTypeList();
dropName.DataBind();
if (isShowPlease)
{
Funs.FineUIPleaseSelect(dropName);
}
}
#endregion
}
}
@@ -138,6 +138,7 @@ namespace BLL
newDesignDetails.AttachUrl = designDetails.AttachUrl;
newDesignDetails.CompileMan = designDetails.CompileMan;
newDesignDetails.CompileDate = designDetails.CompileDate;
newDesignDetails.JoinPersonNum = designDetails.JoinPersonNum;
newDesignDetails.Status = designDetails.Status;
db.Comprehensive_DesignDetails.InsertOnSubmit(newDesignDetails);
db.SubmitChanges();
@@ -161,6 +162,7 @@ namespace BLL
newDesignDetails.UnitWorkId = designDetails.UnitWorkId;
newDesignDetails.UnitName = designDetails.UnitName;
newDesignDetails.AttachUrl = designDetails.AttachUrl;
newDesignDetails.JoinPersonNum = designDetails.JoinPersonNum;
newDesignDetails.Status = designDetails.Status;
db.SubmitChanges();
}
@@ -120,6 +120,7 @@ namespace BLL
newInspectionMachine.IsVerification = inspectionMachine.IsVerification;
newInspectionMachine.InspectionDate = inspectionMachine.InspectionDate;
newInspectionMachine.AttachUrl = inspectionMachine.AttachUrl;
newInspectionMachine.IsCheckOK = inspectionMachine.IsCheckOK;
newInspectionMachine.CNProfessionalId = inspectionMachine.CNProfessionalId;
newInspectionMachine.CompileMan = inspectionMachine.CompileMan;
newInspectionMachine.CompileDate = inspectionMachine.CompileDate;
@@ -152,6 +153,7 @@ namespace BLL
newInspectionMachine.NextTestDate = inspectionMachine.NextTestDate;
newInspectionMachine.TestCycle = inspectionMachine.TestCycle;
newInspectionMachine.IsVerification = inspectionMachine.IsVerification;
newInspectionMachine.IsCheckOK = inspectionMachine.IsCheckOK;
newInspectionMachine.InspectionDate = inspectionMachine.InspectionDate;
newInspectionMachine.AttachUrl = inspectionMachine.AttachUrl;
newInspectionMachine.CNProfessionalId = inspectionMachine.CNProfessionalId;
@@ -59,6 +59,7 @@ namespace BLL
newInspectionPerson.CompileDate = inspectionPerson.CompileDate;
newInspectionPerson.IsOnSite = inspectionPerson.IsOnSite;
newInspectionPerson.UnitWorkId = inspectionPerson.UnitWorkId;
newInspectionPerson.IsTrain= inspectionPerson.IsTrain;
newInspectionPerson.Status = inspectionPerson.Status;
db.Comprehensive_InspectionPerson.InsertOnSubmit(newInspectionPerson);
db.SubmitChanges();
@@ -89,6 +90,7 @@ namespace BLL
newInspectionPerson.CNProfessionalId = inspectionPerson.CNProfessionalId;
newInspectionPerson.IsOnSite = inspectionPerson.IsOnSite;
newInspectionPerson.UnitWorkId = inspectionPerson.UnitWorkId;
newInspectionPerson.IsTrain = inspectionPerson.IsTrain;
newInspectionPerson.Status = inspectionPerson.Status;
db.SubmitChanges();
}
@@ -260,6 +260,7 @@ namespace BLL
newBreakdownProject.YeZhu = breakdownProject.YeZhu;
newBreakdownProject.FenBao = breakdownProject.FenBao;
newBreakdownProject.SourceBreakdownId = breakdownProject.SourceBreakdownId;
newBreakdownProject.CheckAcceptType = breakdownProject.CheckAcceptType;
db.WBS_BreakdownProject.InsertOnSubmit(newBreakdownProject);
db.SubmitChanges();
@@ -288,6 +289,7 @@ namespace BLL
newBreakdownProject.JianLi = breakdownProject.JianLi;
newBreakdownProject.YeZhu = breakdownProject.YeZhu;
newBreakdownProject.FenBao = breakdownProject.FenBao;
newBreakdownProject.CheckAcceptType = breakdownProject.CheckAcceptType;
db.SubmitChanges();
}
+3
View File
@@ -65,6 +65,7 @@ namespace BLL
x.WuHuan,
x.JianLi,
x.YeZhu,
x.CheckAcceptType,
CheckPointsDef = Funs.GetSubStr(x.CheckPoints, 15),
RecordAndCodeDef = Funs.GetSubStr(x.RecordAndCode, 15),
x.ModelURL
@@ -107,6 +108,7 @@ namespace BLL
newBreakdown.WuHuan = breakdown.WuHuan;
newBreakdown.JianLi = breakdown.JianLi;
newBreakdown.YeZhu = breakdown.YeZhu;
newBreakdown.CheckAcceptType = breakdown.CheckAcceptType;
db.WBS_Breakdown.InsertOnSubmit(newBreakdown);
db.SubmitChanges();
@@ -134,6 +136,7 @@ namespace BLL
newBreakdown.WuHuan = breakdown.WuHuan;
newBreakdown.JianLi = breakdown.JianLi;
newBreakdown.YeZhu = breakdown.YeZhu;
newBreakdown.CheckAcceptType = breakdown.CheckAcceptType;
db.SubmitChanges();
}
+2 -10
View File
@@ -78,6 +78,7 @@ namespace BLL
newDivisionProject.CNProfessionalId = divisionProject.CNProfessionalId;
newDivisionProject.UnitWorkId = divisionProject.UnitWorkId;
newDivisionProject.OldDivisionId = divisionProject.OldDivisionId;
newDivisionProject.SubItemType = divisionProject.SubItemType;
db.WBS_DivisionProject.InsertOnSubmit(newDivisionProject);
db.SubmitChanges();
}
@@ -96,6 +97,7 @@ namespace BLL
newDivisionProject.SuperDivisionId = divisionProject.SuperDivisionId;
newDivisionProject.CNProfessionalId = divisionProject.CNProfessionalId;
newDivisionProject.IsSelected = divisionProject.IsSelected;
newDivisionProject.SubItemType = divisionProject.SubItemType;
db.SubmitChanges();
}
@@ -152,16 +154,6 @@ namespace BLL
return Funs.DB.WBS_DivisionProject.FirstOrDefault(x => x.DivisionProjectId == divisionProjectId);
}
/// <summary>
/// 根据主键返回一个分部/子分部信息
/// </summary>
/// <param name="cnProfessionalCode">分部/子分部编号</param>
/// <returns></returns>
public static Model.WBS_DivisionProject GetDivisionProjectByUnitWorkIdAndOldDivisionId(string unitWorkId, string oldDivisionId)
{
return Funs.DB.WBS_DivisionProject.FirstOrDefault(x => x.UnitWorkId == unitWorkId && x.OldDivisionId == oldDivisionId);
}
/// <summary>
/// 判断分部/子分部编号是否存在
/// </summary>
+2
View File
@@ -75,6 +75,7 @@ namespace BLL
newDivision.SortIndex = division.SortIndex;
newDivision.SuperDivisionId = division.SuperDivisionId;
newDivision.CNProfessionalId = division.CNProfessionalId;
newDivision.SubItemType = division.SubItemType;
db.WBS_Division.InsertOnSubmit(newDivision);
db.SubmitChanges();
}
@@ -92,6 +93,7 @@ namespace BLL
newDivision.SortIndex = division.SortIndex;
newDivision.SuperDivisionId = division.SuperDivisionId;
newDivision.CNProfessionalId = division.CNProfessionalId;
newDivision.SubItemType = division.SubItemType;
db.SubmitChanges();
}
+16
View File
@@ -1591,6 +1591,10 @@ namespace BLL
/// 执业资格证书证书
/// </summary>
public const string PracticeCertificateMenuId = "1390195D8-874B-4E7B-8DBF-D81A5984E973";
/// <summary>
/// 风险等级
/// </summary>
public const string RiskLevelMenuId = "E4B526CC-805E-4131-8E18-2FFA6871507E";
#endregion
#region
@@ -2248,6 +2252,18 @@ namespace BLL
/// 危险源辨识与评价清单
/// </summary>
public const string ProjectHazardListMenuId = "EDC50857-7762-4498-83C6-5BDE85036BAB";
/// <summary>
/// 风险信息库
/// </summary>
public const string ProjectHazardInfoMenuId = "74A6B343-5837-416B-AE9C-D2BBCA08E41F";
/// <summary>
/// 风险分级管控
/// </summary>
public const string ProjectRiskControlMenuId = "F6A6D53A-150E-43DB-A3C4-6FA18E9401E9";
/// <summary>
/// 风险巡检记录
/// </summary>
public const string ProjectRoutingInspectionMenuId = "D256E5C8-DC76-4F4D-BABE-A253418823F4";
/// <summary>
/// 风险提示
+45
View File
@@ -103,5 +103,50 @@ namespace BLL
return true;//符合15位身份证标准
}
#endregion
/// <summary>
/// 根据身份证号码获取生日
/// </summary>
/// <param name="IDCard"></param>
/// <returns></returns>
public static DateTime? getBirthByIDCard(string IDCard)
{
DateTime? birth = null;
if (!string.IsNullOrEmpty(IDCard))
{
string birthStr = string.Empty;
if (IDCard.Length == 18)
{
birthStr = IDCard.Substring(6, 8).Insert(6, "-").Insert(4, "-");
}
else if (IDCard.Length == 15)
{
birthStr = IDCard.Substring(6, 6).Insert(4, "-").Insert(2, "-");
}
DateTime time = new DateTime();
if (DateTime.TryParse(birthStr, out time))
{
birth = time;
}
}
return birth;
}
/// <summary>
/// 获取年龄
/// </summary>
/// <param name="birthDate"></param>
/// <param name="now"></param>
/// <returns></returns>
public static int CalculateAgeCorrect(DateTime birthDate)
{
DateTime now = DateTime.Now;
int age = now.Year - birthDate.Year;
if (now.Month < birthDate.Month || (now.Month == birthDate.Month && now.Day < birthDate.Day)) age--;
return age;
}
}
}
@@ -46,7 +46,8 @@ namespace BLL
FileContent = accidentPersonRecord.FileContent,
CompileMan = accidentPersonRecord.CompileMan,
CompileDate = accidentPersonRecord.CompileDate,
States = accidentPersonRecord.States
States = accidentPersonRecord.States,
IsAttempt= accidentPersonRecord.IsAttempt,
};
db.Accident_AccidentPersonRecord.InsertOnSubmit(newAccidentPersonRecord);
db.SubmitChanges();
@@ -77,6 +78,7 @@ namespace BLL
newAccidentPersonRecord.CompileMan = accidentPersonRecord.CompileMan;
newAccidentPersonRecord.CompileDate = accidentPersonRecord.CompileDate;
newAccidentPersonRecord.States = accidentPersonRecord.States;
newAccidentPersonRecord.IsAttempt= accidentPersonRecord.IsAttempt;
db.SubmitChanges();
}
}
@@ -387,6 +387,7 @@ namespace BLL
NotConfirmWorkingHoursLoss = accidentReport.NotConfirmWorkingHoursLoss,
NotConfirmEconomicLoss = accidentReport.NotConfirmEconomicLoss,
NotConfirmEconomicOtherLoss = accidentReport.NotConfirmEconomicOtherLoss,
AccidentDegree = accidentReport.AccidentDegree,
NotConfirmed = accidentReport.NotConfirmed
};
db.Accident_AccidentReport.InsertOnSubmit(newAccidentReport);
@@ -430,6 +431,7 @@ namespace BLL
newAccidentReport.IsNotConfirm = accidentReport.IsNotConfirm;
newAccidentReport.NotConfirmWorkingHoursLoss = accidentReport.NotConfirmWorkingHoursLoss;
newAccidentReport.NotConfirmEconomicLoss = accidentReport.NotConfirmEconomicLoss;
newAccidentReport.AccidentDegree = accidentReport.AccidentDegree;
newAccidentReport.NotConfirmEconomicOtherLoss = accidentReport.NotConfirmEconomicOtherLoss;
db.SubmitChanges();
}
@@ -39,6 +39,7 @@ namespace BLL
x.PromptTime,
x.Remark,
x.WorkStage,
x.Position,
//HazardLevelName = (from y in db.Hazard_HazardLevel where y.HazardLevelId == x.HazardLevel select y.HazardLevelName).First(),
};
}
@@ -72,6 +73,7 @@ namespace BLL
x.PromptTime,
x.Remark,
x.WorkStage,
x.Position,
//HazardLevelName = (from y in db.Hazard_HazardLevel where y.HazardLevelId == x.HazardLevel select y.HazardLevelName).First(),
};
}
@@ -104,6 +106,16 @@ namespace BLL
return db.Hazard_HazardSelectedItem.FirstOrDefault(x => x.HazardId == hazardId && x.HazardListId == hazardListId && x.WorkStage == workStage);
}
/// <summary>
/// 根据危险源辨识与评价清单Id获取一个危险源辨识与评价清单审批信息
/// </summary>
/// <param name="hazardId">危险源辨识与评价清单Id</param>
/// <returns>一个危险源辨识与评价清单审批实体</returns>
public static Model.Hazard_HazardSelectedItem GetHazardSelectedItemByHazardSelectedItemId(string hazardSelectedItemId)
{
return db.Hazard_HazardSelectedItem.FirstOrDefault(x => x.HazardSelectedItemId == hazardSelectedItemId);
}
/// <summary>
/// 根据危险源辨识与评价清单Id获取一个危险源辨识与评价清单审批信息
/// </summary>
@@ -156,11 +168,13 @@ namespace BLL
Model.SGGLDB db = Funs.DB;
Model.Hazard_HazardSelectedItem newHazardSelectedItem = new Model.Hazard_HazardSelectedItem
{
HazardSelectedItemId = hazardSelectedItem.HazardSelectedItemId,
HazardId = hazardSelectedItem.HazardId,
HazardListTypeId = hazardSelectedItem.HazardListTypeId,
HazardListId = hazardSelectedItem.HazardListId,
HazardItems = hazardSelectedItem.HazardItems,
DefectsType = hazardSelectedItem.DefectsType,
ProjectId = hazardSelectedItem.ProjectId,
MayLeadAccidents = hazardSelectedItem.MayLeadAccidents,
HelperMethod = hazardSelectedItem.HelperMethod,
HazardJudge_L = hazardSelectedItem.HazardJudge_L,
@@ -171,9 +185,12 @@ namespace BLL
ControlMeasures = hazardSelectedItem.ControlMeasures,
IsResponse = hazardSelectedItem.IsResponse,
ResponseRecode = hazardSelectedItem.ResponseRecode,
DutyPerson = hazardSelectedItem.DutyPerson,
PromptTime = hazardSelectedItem.PromptTime,
Remark = hazardSelectedItem.Remark,
WorkStage = hazardSelectedItem.WorkStage
State = hazardSelectedItem.State,
WorkStage = hazardSelectedItem.WorkStage,
Position = hazardSelectedItem.Position,
};
Funs.DB.Hazard_HazardSelectedItem.InsertOnSubmit(newHazardSelectedItem);
@@ -187,7 +204,7 @@ namespace BLL
public static void UpdateHazardSelectedItem(Model.Hazard_HazardSelectedItem hazardSelectedItem)
{
Model.SGGLDB db = Funs.DB;
Model.Hazard_HazardSelectedItem newHazardSelectedItem = db.Hazard_HazardSelectedItem.FirstOrDefault(e => e.HazardId == hazardSelectedItem.HazardId && e.HazardListId == hazardSelectedItem.HazardListId && e.WorkStage == hazardSelectedItem.WorkStage);
Model.Hazard_HazardSelectedItem newHazardSelectedItem = db.Hazard_HazardSelectedItem.FirstOrDefault(e => e.HazardSelectedItemId == hazardSelectedItem.HazardSelectedItemId);
if (newHazardSelectedItem != null)
{
newHazardSelectedItem.HazardListTypeId = hazardSelectedItem.HazardListTypeId;
@@ -204,9 +221,16 @@ namespace BLL
newHazardSelectedItem.ControlMeasures = hazardSelectedItem.ControlMeasures;
newHazardSelectedItem.IsResponse = hazardSelectedItem.IsResponse;
newHazardSelectedItem.ResponseRecode = hazardSelectedItem.ResponseRecode;
newHazardSelectedItem.DutyPerson = hazardSelectedItem.DutyPerson;
newHazardSelectedItem.PromptTime = hazardSelectedItem.PromptTime;
newHazardSelectedItem.Remark = hazardSelectedItem.Remark;
newHazardSelectedItem.WorkStage = hazardSelectedItem.WorkStage;
newHazardSelectedItem.CheckStartDate = hazardSelectedItem.CheckStartDate;
newHazardSelectedItem.IsStart = hazardSelectedItem.IsStart;
newHazardSelectedItem.State = hazardSelectedItem.State;
newHazardSelectedItem.PlanExistDate = hazardSelectedItem.PlanExistDate;
newHazardSelectedItem.QRCodeAttachUrl = hazardSelectedItem.QRCodeAttachUrl;
newHazardSelectedItem.Position = hazardSelectedItem.Position;
db.SubmitChanges();
}
@@ -222,8 +246,30 @@ namespace BLL
var q = (from x in db.Hazard_HazardSelectedItem where x.HazardListId == hazardListId select x).ToList();
if (q.Count() > 0)
{
foreach (var item in q)
{
var h = db.Hazard_RiskEvaluationRecord.Where(x => x.DataId == item.HazardSelectedItemId);
if (h.Count() > 0)
{
db.Hazard_RiskEvaluationRecord.DeleteAllOnSubmit(h);
db.SubmitChanges();
}
var p = db.Hazard_PatrolPlan.Where(x => x.HazardSelectedItemId == item.HazardSelectedItemId);
if (p.Count() > 0)
{
db.Hazard_PatrolPlan.DeleteAllOnSubmit(p);
db.SubmitChanges();
}
var r = db.Hazard_RoutingInspection.Where(x => x.HazardSelectedItemId == item.HazardSelectedItemId);
if (r.Count() > 0)
{
db.Hazard_RoutingInspection.DeleteAllOnSubmit(r);
db.SubmitChanges();
}
}
db.Hazard_HazardSelectedItem.DeleteAllOnSubmit(q);
db.SubmitChanges();
}
}
}
@@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
/// <summary>
/// 巡检计划表
/// </summary>
public static class Hazard_PatrolPlanService
{
/// <summary>
/// 根据巡检计划ID获取巡检计划信息
/// </summary>
/// <param name="PatrolPlanName"></param>
/// <returns></returns>
public static Model.Hazard_PatrolPlan GetPatrolPlanByPatrolPlanId(string PatrolPlanId)
{
return Funs.DB.Hazard_PatrolPlan.FirstOrDefault(e => e.PatrolPlanId == PatrolPlanId);
}
/// <summary>
/// 根据风险ID和巡检时限获取巡检计划信息
/// </summary>
/// <param name="PatrolPlanName"></param>
/// <returns></returns>
public static Model.Hazard_PatrolPlan GetPatrolPlanByHazardSelectedItemIdAndLimitCheckDate(string hazardSelectedItemId, DateTime? limitCheckDate)
{
return Funs.DB.Hazard_PatrolPlan.FirstOrDefault(e => e.HazardSelectedItemId == hazardSelectedItemId && e.LimitCheckDate == limitCheckDate);
}
/// <summary>
/// 根据巡检日期获取之前未巡检计划信息集合
/// </summary>
/// <param name="PatrolPlanName"></param>
/// <returns></returns>
public static List<Model.Hazard_PatrolPlan> GetBeforePatrolPlansByCheckDate(string hazardSelectedItemId, DateTime checkDate)
{
return (from x in Funs.DB.Hazard_PatrolPlan where x.HazardSelectedItemId == hazardSelectedItemId && x.LimitCheckDate < checkDate select x).ToList();
}
/// <summary>
/// 添加安全巡检计划
/// </summary>
/// <param name="patrolPlan"></param>
public static void AddPatrolPlan(Model.Hazard_PatrolPlan patrolPlan)
{
Model.Hazard_PatrolPlan newPatrolPlan = new Model.Hazard_PatrolPlan
{
PatrolPlanId = patrolPlan.PatrolPlanId,
HazardSelectedItemId = patrolPlan.HazardSelectedItemId,
HazardLevel = patrolPlan.HazardLevel,
DutyPerson = patrolPlan.DutyPerson,
Days = patrolPlan.Days,
CheckStartDate = patrolPlan.CheckStartDate,
LimitCheckDate = patrolPlan.LimitCheckDate,
CheckDate = patrolPlan.CheckDate,
State = patrolPlan.State
};
Funs.DB.Hazard_PatrolPlan.InsertOnSubmit(newPatrolPlan);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改安全巡检计划
/// </summary>
/// <param name="patrolPlan"></param>
public static void UpdatePatrolPlan(Model.Hazard_PatrolPlan patrolPlan)
{
Model.Hazard_PatrolPlan newPatrolPlan = Funs.DB.Hazard_PatrolPlan.FirstOrDefault(e => e.PatrolPlanId == patrolPlan.PatrolPlanId);
if (newPatrolPlan != null)
{
newPatrolPlan.CheckDate = patrolPlan.CheckDate;
newPatrolPlan.State = patrolPlan.State;
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据巡检计划ID删除对应巡检计划记录信息
/// </summary>
/// <param name="superviseCheckReportId"></param>
public static void DeletePatrolPlan(string PatrolPlanId)
{
var q = (from x in Funs.DB.Hazard_PatrolPlan where x.PatrolPlanId == PatrolPlanId select x).FirstOrDefault();
if (q != null)
{
Funs.DB.Hazard_PatrolPlan.DeleteOnSubmit(q);
Funs.DB.SubmitChanges();
}
}
}
}
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
/// <summary>
/// 巡检记录表
/// </summary>
public static class Hazard_RoutingInspectionService
{
/// <summary>
/// 根据巡检记录ID获取巡检记录信息
/// </summary>
/// <param name="RoutingInspectionName"></param>
/// <returns></returns>
public static Model.Hazard_RoutingInspection GetRoutingInspectionByRoutingInspectionId(string RoutingInspectionId)
{
return Funs.DB.Hazard_RoutingInspection.FirstOrDefault(e => e.RoutingInspectionId == RoutingInspectionId);
}
/// <summary>
/// 根据巡检计划ID获取巡检记录信息
/// </summary>
/// <param name="RoutingInspectionName"></param>
/// <returns></returns>
public static Model.Hazard_RoutingInspection GetRoutingInspectionByPatrolPlanId(string PatrolPlanId)
{
return Funs.DB.Hazard_RoutingInspection.FirstOrDefault(e => e.PatrolPlanId == PatrolPlanId);
}
/// <summary>
/// 添加安全巡检记录
/// </summary>
/// <param name="RoutingInspection"></param>
public static void AddRoutingInspection(Model.Hazard_RoutingInspection RoutingInspection)
{
Model.Hazard_RoutingInspection newRoutingInspection = new Model.Hazard_RoutingInspection
{
RoutingInspectionId = RoutingInspection.RoutingInspectionId,
HazardSelectedItemId = RoutingInspection.HazardSelectedItemId,
PatrolManId = RoutingInspection.PatrolManId,
PatrolTime = RoutingInspection.PatrolTime,
PatrolResult = RoutingInspection.PatrolResult,
OldRiskLevel = RoutingInspection.OldRiskLevel,
PohotoUrl = RoutingInspection.PohotoUrl,
ControlMeasures = RoutingInspection.ControlMeasures,
DealReason = RoutingInspection.DealReason,
RiskManId = RoutingInspection.RiskManId,
PatrolPlanId = RoutingInspection.PatrolPlanId
};
Funs.DB.Hazard_RoutingInspection.InsertOnSubmit(newRoutingInspection);
Funs.DB.SubmitChanges();
}
/// <summary>
/// 修改安全巡检记录
/// </summary>
/// <param name="RoutingInspection"></param>
public static void UpdateRoutingInspection(Model.Hazard_RoutingInspection RoutingInspection)
{
Model.Hazard_RoutingInspection newRoutingInspection = Funs.DB.Hazard_RoutingInspection.FirstOrDefault(e => e.RoutingInspectionId == RoutingInspection.RoutingInspectionId);
if (newRoutingInspection != null)
{
newRoutingInspection.PatrolManId = RoutingInspection.PatrolManId;
newRoutingInspection.PatrolTime = RoutingInspection.PatrolTime;
newRoutingInspection.PatrolResult = RoutingInspection.PatrolResult;
newRoutingInspection.OldRiskLevel = RoutingInspection.OldRiskLevel;
newRoutingInspection.PohotoUrl = RoutingInspection.PohotoUrl;
newRoutingInspection.ControlMeasures = RoutingInspection.ControlMeasures;
newRoutingInspection.DealReason = RoutingInspection.DealReason;
Funs.DB.SubmitChanges();
}
}
/// <summary>
/// 根据巡检记录ID删除对应巡检记录记录信息
/// </summary>
/// <param name="superviseCheckReportId"></param>
public static void DeleteRoutingInspection(string RoutingInspectionId)
{
var q = (from x in Funs.DB.Hazard_RoutingInspection where x.RoutingInspectionId == RoutingInspectionId select x).FirstOrDefault();
if (q != null)
{
///删除附件
BLL.CommonService.DeleteAttachFileById(RoutingInspectionId);
Funs.DB.Hazard_RoutingInspection.DeleteOnSubmit(q);
Funs.DB.SubmitChanges();
}
}
}
}
@@ -0,0 +1,109 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BLL
{
public static class RiskEvaluationRecordService
{
public static Model.SGGLDB db = Funs.DB;
/// <summary>
/// 根据主键获取风险评价记录
/// </summary>
/// <param name="hazardId"></param>
/// <returns></returns>
public static Model.Hazard_RiskEvaluationRecord GetRiskEvaluationRecordByLECItemRecordId(string LECItemRecordId)
{
return Funs.DB.Hazard_RiskEvaluationRecord.FirstOrDefault(e => e.LECItemRecordId == LECItemRecordId);
}
/// <summary>
/// 根据风险主键获取风险评价记录
/// </summary>
/// <param name="hazardId"></param>
/// <returns></returns>
public static Model.Hazard_RiskEvaluationRecord GetRiskEvaluationRecordByDataIdAndEvaluatorDate(string dataId)
{
return Funs.DB.Hazard_RiskEvaluationRecord.FirstOrDefault(e => e.DataId == dataId && e.EvaluatorDate == null);
}
/// <summary>
/// 根据整理人获取风险评价记录
/// </summary>
/// <param name="compileMan"></param>
/// <returns></returns>
public static List<Model.Hazard_RiskEvaluationRecord> GetRiskEvaluationRecordByDataId(string dataId)
{
return (from x in Funs.DB.Hazard_RiskEvaluationRecord where x.DataId == dataId select x).ToList();
}
/// <summary>
/// 添加风险评价记录
/// </summary>
/// <param name="RiskEvaluationRecord"></param>
public static void AddRiskEvaluationRecord(Model.Hazard_RiskEvaluationRecord RiskEvaluationRecord)
{
Model.SGGLDB db = Funs.DB;
Model.Hazard_RiskEvaluationRecord newRiskEvaluationRecord = new Model.Hazard_RiskEvaluationRecord
{
LECItemRecordId = RiskEvaluationRecord.LECItemRecordId,
DataId = RiskEvaluationRecord.DataId,
DataType = RiskEvaluationRecord.DataType,
Evaluatorld = RiskEvaluationRecord.Evaluatorld,
EvaluatorDate = RiskEvaluationRecord.EvaluatorDate,
L = RiskEvaluationRecord.L,
E = RiskEvaluationRecord.E,
C = RiskEvaluationRecord.C,
D = RiskEvaluationRecord.D,
RiskLevel = RiskEvaluationRecord.RiskLevel,
ControlMeasures = RiskEvaluationRecord.ControlMeasures,
Remark = RiskEvaluationRecord.Remark,
};
db.Hazard_RiskEvaluationRecord.InsertOnSubmit(newRiskEvaluationRecord);
db.SubmitChanges();
}
/// <summary>
/// 修改风险评价记录
/// </summary>
/// <param name="RiskEvaluationRecord"></param>
public static void UpdateRiskEvaluationRecord(Model.Hazard_RiskEvaluationRecord RiskEvaluationRecord)
{
Model.SGGLDB db = Funs.DB;
Model.Hazard_RiskEvaluationRecord newRiskEvaluationRecord = db.Hazard_RiskEvaluationRecord.FirstOrDefault(e => e.LECItemRecordId == RiskEvaluationRecord.LECItemRecordId);
if (newRiskEvaluationRecord != null)
{
newRiskEvaluationRecord.DataId = RiskEvaluationRecord.DataId;
newRiskEvaluationRecord.DataType = RiskEvaluationRecord.DataType;
newRiskEvaluationRecord.Evaluatorld = RiskEvaluationRecord.Evaluatorld;
newRiskEvaluationRecord.EvaluatorDate = RiskEvaluationRecord.EvaluatorDate;
newRiskEvaluationRecord.L = RiskEvaluationRecord.L;
newRiskEvaluationRecord.E = RiskEvaluationRecord.E;
newRiskEvaluationRecord.C = RiskEvaluationRecord.C;
newRiskEvaluationRecord.D = RiskEvaluationRecord.D;
newRiskEvaluationRecord.RiskLevel = RiskEvaluationRecord.RiskLevel;
newRiskEvaluationRecord.ControlMeasures = RiskEvaluationRecord.ControlMeasures;
newRiskEvaluationRecord.Remark = RiskEvaluationRecord.Remark;
db.SubmitChanges();
}
}
/// <summary>
/// 根据主键删除风险评价记录
/// </summary>
/// <param name="LECItemRecordId"></param>
public static void DeleteRiskEvaluationRecordByLECItemRecordId(string LECItemRecordId)
{
Model.SGGLDB db = Funs.DB;
Model.Hazard_RiskEvaluationRecord RiskEvaluationRecord = db.Hazard_RiskEvaluationRecord.FirstOrDefault(e => e.LECItemRecordId == LECItemRecordId);
if (RiskEvaluationRecord != null)
{
db.Hazard_RiskEvaluationRecord.DeleteOnSubmit(RiskEvaluationRecord);
db.SubmitChanges();
}
}
}
}
@@ -52,7 +52,8 @@ namespace BLL
RegistrationNum = equipmentInItem.RegistrationNum,
OperationQualificationNum = equipmentInItem.OperationQualificationNum,
InsuranceNum = equipmentInItem.InsuranceNum,
CommercialInsuranceNum = equipmentInItem.CommercialInsuranceNum
CommercialInsuranceNum = equipmentInItem.CommercialInsuranceNum,
IsUsed = equipmentInItem.IsUsed,
};
db.InApproveManager_EquipmentInItem.InsertOnSubmit(newEquipmentItem);
db.SubmitChanges();
@@ -79,6 +80,7 @@ namespace BLL
newEquipmentItem.OperationQualificationNum = equipmentInItem.OperationQualificationNum;
newEquipmentItem.InsuranceNum = equipmentInItem.InsuranceNum;
newEquipmentItem.CommercialInsuranceNum = equipmentInItem.CommercialInsuranceNum;
newEquipmentItem.IsUsed = equipmentInItem.IsUsed;
db.SubmitChanges();
}
}
@@ -44,7 +44,8 @@ namespace BLL
SpecialEquipmentId = generalEquipmentInItem.SpecialEquipmentId,
SizeModel = generalEquipmentInItem.SizeModel,
OwnerCheck = generalEquipmentInItem.OwnerCheck,
CertificateNum = generalEquipmentInItem.CertificateNum
CertificateNum = generalEquipmentInItem.CertificateNum,
IsUsed = generalEquipmentInItem.IsUsed,
};
db.InApproveManager_GeneralEquipmentInItem.InsertOnSubmit(newEquipmentItem);
db.SubmitChanges();
@@ -65,6 +66,7 @@ namespace BLL
newGeneralEquipmentInItem.SizeModel = generalEquipmentInItem.SizeModel;
newGeneralEquipmentInItem.OwnerCheck = generalEquipmentInItem.OwnerCheck;
newGeneralEquipmentInItem.CertificateNum = generalEquipmentInItem.CertificateNum;
newGeneralEquipmentInItem.IsUsed = generalEquipmentInItem.IsUsed;
db.SubmitChanges();
}
}
@@ -57,7 +57,8 @@ namespace BLL
WorkAreaId = licenseManager.WorkAreaId,
StartDate = licenseManager.StartDate,
EndDate = licenseManager.EndDate,
WorkStates=licenseManager.WorkStates,
WorkStates = licenseManager.WorkStates,
IsHighRisk = licenseManager.IsHighRisk,
};
db.License_LicenseManager.InsertOnSubmit(newLicenseManager);
db.SubmitChanges();
@@ -88,6 +89,7 @@ namespace BLL
newLicenseManager.StartDate = licenseManager.StartDate;
newLicenseManager.EndDate = licenseManager.EndDate;
newLicenseManager.WorkStates = licenseManager.WorkStates;
newLicenseManager.IsHighRisk = licenseManager.IsHighRisk;
db.SubmitChanges();
}
}
@@ -100,7 +102,7 @@ namespace BLL
{
Model.SGGLDB db = Funs.DB;
Model.License_LicenseManager licenseManager = db.License_LicenseManager.FirstOrDefault(e => e.LicenseManagerId == licenseManagerId);
if (licenseManager!=null)
if (licenseManager != null)
{
///删除编码表记录
BLL.CodeRecordsService.DeleteCodeRecordsByDataId(licenseManagerId);
@@ -110,7 +112,7 @@ namespace BLL
if (flowOperate.Count() > 0)
{
BLL.CommonService.DeleteFlowOperateByID(licenseManager.LicenseManagerId); ////删除审核流程表
}
}
db.License_LicenseManager.DeleteOnSubmit(licenseManager);
db.SubmitChanges();
}
+89
View File
@@ -14,6 +14,93 @@ namespace BLL
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count2
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.View_SitePerson_Person> getDataLists = from x in db.View_SitePerson_Person
select x;
/// <summary>
/// 数据列表
/// </summary>
/// <param name="projetcId"></param>
/// <param name="unitId"></param>
/// <param name="workPostId"></param>
/// <param name="name"></param>
/// <param name="idCard"></param>
/// <param name="states"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projetcId, string unitId, string workPostId, string name, string idCard, string states, Grid Grid1)
{
IQueryable<Model.View_SitePerson_Person> getDataList = getDataLists.OrderBy(x => x.ProjectId).ThenBy(x => x.UnitId);
if (!string.IsNullOrEmpty(projetcId) && projetcId != Const._Null)
{
getDataList = getDataList.Where(e => e.ProjectId == projetcId);
}
if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null)
{
getDataList = getDataList.Where(e => e.UnitId == unitId);
}
if (!string.IsNullOrEmpty(workPostId) && workPostId != Const._Null)
{
getDataList = getDataList.Where(e => e.WorkPostId == workPostId);
}
if (!string.IsNullOrEmpty(states) && states != "-2")
{
getDataList = getDataList.Where(e => e.IsUsed == Convert.ToInt32(states));
}
if (!string.IsNullOrEmpty(name))
{
getDataList = getDataList.Where(e => e.PersonName.Contains(name));
}
if (!string.IsNullOrEmpty(idCard))
{
getDataList = getDataList.Where(e => e.IdentityCard.Contains(idCard));
}
count2 = getDataList.Count();
if (count2 == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.PersonId,
x.PersonName,
x.CardNo,
x.IdentityCard,
x.Sex,
x.SexName,
x.UnitId,
x.UnitName,
x.WorkPostId,
x.WorkPostName,
x.ProjectId,
ProjectName = db.Base_Project.First(u => u.ProjectId == x.ProjectId).ProjectName,
ShortName = db.Base_Project.First(u => u.ProjectId == x.ProjectId).ShortName,
NativePlace = x.CountryName ?? "" + x.ProvinceName ?? "",
x.TeamGroupId,
x.TeamGroupName,
x.InTime,
x.OutTime,
x.IsUsed,
OutName = (x.IsUsed == 1 ? "是" : "否"),
};
}
#endregion
/// <summary>
/// 根据主键获取人员信息
/// </summary>
@@ -278,6 +365,7 @@ namespace BLL
Nation = person.Nation,
CountryCode = person.CountryCode,
ProvinceCode = person.ProvinceCode,
IsSafetyMonitoring = person.IsSafetyMonitoring,
IsCardNoOK = IDCardValid.CheckIDCard(person.IdentityCard),
};
@@ -332,6 +420,7 @@ namespace BLL
newPerson.PositionId = person.PositionId;
newPerson.PostTitleId = person.PostTitleId;
newPerson.PhotoUrl = person.PhotoUrl;
newPerson.IsSafetyMonitoring = person.IsSafetyMonitoring;
newPerson.HeadImage = person.HeadImage;
newPerson.IsUsed = person.IsUsed;
newPerson.IsCardUsed = person.IsCardUsed;
@@ -41,6 +41,8 @@ namespace BLL
RecardMan = largerHazard.RecardMan,
Remark = largerHazard.Remark,
States = largerHazard.States,
TrainPersonNum = largerHazard.TrainPersonNum,
IsSuperLargerHazard = largerHazard.IsSuperLargerHazard,
Descriptions = largerHazard.Descriptions
};
@@ -68,6 +70,8 @@ namespace BLL
newLargerHazard.IsArgument = largerHazard.IsArgument;
newLargerHazard.Remark = largerHazard.Remark;
newLargerHazard.States = largerHazard.States;
newLargerHazard.TrainPersonNum = largerHazard.TrainPersonNum;
newLargerHazard.IsSuperLargerHazard = largerHazard.IsSuperLargerHazard;
newLargerHazard.Descriptions = largerHazard.Descriptions;
db.SubmitChanges();
}
+1 -1
View File
@@ -279,7 +279,7 @@ namespace BLL
var q = (from x in db.Base_Unit
join y in db.Project_ProjectUnit
on x.UnitId equals y.UnitId
where y.ProjectId == projectId && y.UnitType == unitType
where y.ProjectId == projectId && (y.UnitType == unitType || string.IsNullOrEmpty(unitType))
orderby x.UnitCode
select x).ToList();
return q;