SGGL_JT/SUBQHSE/BLL/ThreeYearAction/FireGasSafety/SafetyorganizationService.cs

100 lines
3.6 KiB
C#
Raw Normal View History

2025-04-07 17:43:30 +08:00
using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BLL
{
/// <summary>
/// 消防安全组织体系
/// </summary>
public static class SafetyorganizationService
{
/// <summary>
///获取消防安全组织体系
/// </summary>
/// <returns></returns>
public static Model.FireGasSafety_SafetyOrganization GetSafetyOrganizationById(string Id)
{
return Funs.DB.FireGasSafety_SafetyOrganization.FirstOrDefault(e => e.Id == Id);
}
/// <summary>
///获取消防安全组织体系
/// </summary>
/// <returns></returns>
public static List<Model.FireGasSafety_SafetyOrganization> GetSafetyOrganizationListByProjectId(string projectId)
{
using (Model.SUBQHSEDB db = new Model.SUBQHSEDB(Funs.ConnString))
{
return (from x in db.FireGasSafety_SafetyOrganization
where x.ProjectId == projectId
orderby x.CompileDate
ascending
select x).ToList();
}
}
/// <summary>
/// 添加安全组织体系
/// </summary>
/// <param name="model"></param>
public static void AddSafetyOrganization(Model.FireGasSafety_SafetyOrganization model)
{
Model.SUBQHSEDB db = Funs.DB;
//Model.FireGasSafety_SafetyOrganization newModel = new Model.FireGasSafety_SafetyOrganization();
//newModel.Id = model.Id;
//newModel.ProjectId = model.ProjectId;
//newModel.UnitName = model.UnitName;
//newModel.OrganizationPic = model.OrganizationPic;
//newModel.CompileDate = model.CompileDate;
//newModel.CompileMan = model.CompileMan;
//db.FireGasSafety_SafetyOrganization.InsertOnSubmit(newModel);
db.FireGasSafety_SafetyOrganization.InsertOnSubmit(model);
db.SubmitChanges();
}
/// <summary>
/// 修改安全组织体系
/// </summary>
/// <param name="model"></param>
public static void UpdateSafetyOrganization(Model.FireGasSafety_SafetyOrganization model)
{
Model.SUBQHSEDB db = Funs.DB;
Model.FireGasSafety_SafetyOrganization newIns = model;
//Model.Project_Installation newIns = db.Project_Installation.First(e => e.InstallationId == installation.InstallationId);
//newIns.InstallationCode = installation.InstallationCode;
//newIns.InstallationName = installation.InstallationName;
//newIns.SuperInstallationId = installation.SuperInstallationId;
//newIns.StartDate = installation.StartDate;
//newIns.EndDate = installation.EndDate;
//newIns.Weights = installation.Weights;
//newIns.WeightsMoney = installation.WeightsMoney;
//newIns.Def = installation.Def;
//newIns.SortIndex = installation.SortIndex;
//newIns.UnitId = installation.UnitId;
db.SubmitChanges();
}
/// <summary>
/// 根据Id删除组织体系
/// </summary>
/// <param name="id"></param>
public static void DeleteSafetyOrganization(string id)
{
Model.SUBQHSEDB db = Funs.DB;
Model.FireGasSafety_SafetyOrganization WS = db.FireGasSafety_SafetyOrganization.First(e => e.Id == id);
db.FireGasSafety_SafetyOrganization.DeleteOnSubmit(WS);
db.SubmitChanges();
}
}
}