202306181、新增设备管理(门禁、监控、环境监测)页面2、新增设备软件管理(门禁、监控、环境监测)页面3、优化费用管理模块。
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 设备管理
|
||||
/// </summary>
|
||||
public static class EquipmentService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取设备管理
|
||||
/// </summary>
|
||||
/// <param name="EquipmentId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.SmartSite_Equipment GetEquipmentByEquipmentId(string EquipmentId)
|
||||
{
|
||||
return Funs.DB.SmartSite_Equipment.FirstOrDefault(e => e.EquipmentId == EquipmentId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取设备管理名称是否存在
|
||||
/// </summary>
|
||||
/// <param name="EquipmentId">设备管理id</param>
|
||||
/// <param name="Equipment">名称</param>
|
||||
/// <returns>是否存在</returns>
|
||||
public static bool IsExistEquipment(string EquipmentId, string EquipmentName)
|
||||
{
|
||||
bool isExist = false;
|
||||
var role = Funs.DB.SmartSite_Equipment.FirstOrDefault(x => x.EquipmentName == EquipmentName && x.EquipmentId != EquipmentId);
|
||||
if (role != null)
|
||||
{
|
||||
isExist = true;
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加设备管理
|
||||
/// </summary>
|
||||
/// <param name="Equipment"></param>
|
||||
public static void AddEquipment(Model.SmartSite_Equipment Equipment)
|
||||
{
|
||||
Model.SmartSite_Equipment newEquipment = new Model.SmartSite_Equipment
|
||||
{
|
||||
EquipmentId = Equipment.EquipmentId,
|
||||
ProjectId = Equipment.ProjectId,
|
||||
Type = Equipment.Type,
|
||||
EquipmentName = Equipment.EquipmentName,
|
||||
EquipmentModel = Equipment.EquipmentModel,
|
||||
Number = Equipment.Number,
|
||||
RunningState = Equipment.RunningState,
|
||||
Supplier = Equipment.Supplier,
|
||||
SupplierMan = Equipment.SupplierMan,
|
||||
SupplierTel = Equipment.SupplierTel,
|
||||
};
|
||||
Funs.DB.SmartSite_Equipment.InsertOnSubmit(newEquipment);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改设备管理
|
||||
/// </summary>
|
||||
/// <param name="Equipment"></param>
|
||||
public static void UpdateEquipment(Model.SmartSite_Equipment Equipment)
|
||||
{
|
||||
Model.SmartSite_Equipment newEquipment = Funs.DB.SmartSite_Equipment.FirstOrDefault(e => e.EquipmentId == Equipment.EquipmentId);
|
||||
if (newEquipment != null)
|
||||
{
|
||||
newEquipment.Type = Equipment.Type;
|
||||
newEquipment.EquipmentName = Equipment.EquipmentName;
|
||||
newEquipment.EquipmentModel = Equipment.EquipmentModel;
|
||||
newEquipment.Number = Equipment.Number;
|
||||
newEquipment.RunningState = Equipment.RunningState;
|
||||
newEquipment.Supplier = Equipment.Supplier;
|
||||
newEquipment.SupplierMan = Equipment.SupplierMan;
|
||||
newEquipment.SupplierTel = Equipment.SupplierTel;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除设备管理
|
||||
/// </summary>
|
||||
/// <param name="EquipmentId"></param>
|
||||
public static void DeleteEquipmentById(string EquipmentId)
|
||||
{
|
||||
Model.SmartSite_Equipment Equipment = Funs.DB.SmartSite_Equipment.FirstOrDefault(e => e.EquipmentId == EquipmentId);
|
||||
if (Equipment != null)
|
||||
{
|
||||
Funs.DB.SmartSite_Equipment.DeleteOnSubmit(Equipment);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据部门Id获取设备管理下拉选择项
|
||||
/// </summary>
|
||||
/// <param name="departId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.SmartSite_Equipment> GetEquipmentList(string projectId, string type)
|
||||
{
|
||||
return (from x in Funs.DB.SmartSite_Equipment
|
||||
where x.ProjectId == projectId && x.Type == type
|
||||
orderby x.EquipmentName
|
||||
select x).ToList();
|
||||
}
|
||||
|
||||
#region 设备管理表下拉框
|
||||
/// <summary>
|
||||
/// 设备管理表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitEquipmentDropDownList(FineUIPro.DropDownList dropName, string projectId, string type, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "EquipmentId";
|
||||
dropName.DataTextField = "Equipment";
|
||||
dropName.DataSource = BLL.EquipmentService.GetEquipmentList(projectId, type);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
/// <summary>
|
||||
/// 软件管理
|
||||
/// </summary>
|
||||
public static class EquipmentSoftService
|
||||
{
|
||||
public static Model.SGGLDB db = Funs.DB;
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键获取软件管理
|
||||
/// </summary>
|
||||
/// <param name="EquipmentSoftId"></param>
|
||||
/// <returns></returns>
|
||||
public static Model.SmartSite_EquipmentSoft GetEquipmentSoftByEquipmentSoftId(string EquipmentSoftId)
|
||||
{
|
||||
return Funs.DB.SmartSite_EquipmentSoft.FirstOrDefault(e => e.EquipmentSoftId == EquipmentSoftId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取软件管理名称是否存在
|
||||
/// </summary>
|
||||
/// <param name="EquipmentSoftId">软件管理id</param>
|
||||
/// <param name="EquipmentSoft">名称</param>
|
||||
/// <returns>是否存在</returns>
|
||||
public static bool IsExistEquipmentSoft(string EquipmentSoftId, string EquipmentSoftName)
|
||||
{
|
||||
bool isExist = false;
|
||||
var role = Funs.DB.SmartSite_EquipmentSoft.FirstOrDefault(x => x.EquipmentSoftName == EquipmentSoftName && x.EquipmentSoftId != EquipmentSoftId);
|
||||
if (role != null)
|
||||
{
|
||||
isExist = true;
|
||||
}
|
||||
return isExist;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加软件管理
|
||||
/// </summary>
|
||||
/// <param name="EquipmentSoft"></param>
|
||||
public static void AddEquipmentSoft(Model.SmartSite_EquipmentSoft EquipmentSoft)
|
||||
{
|
||||
Model.SmartSite_EquipmentSoft newEquipmentSoft = new Model.SmartSite_EquipmentSoft
|
||||
{
|
||||
EquipmentSoftId = EquipmentSoft.EquipmentSoftId,
|
||||
ProjectId = EquipmentSoft.ProjectId,
|
||||
EquipmentId = EquipmentSoft.EquipmentId,
|
||||
Type = EquipmentSoft.Type,
|
||||
EquipmentSoftName = EquipmentSoft.EquipmentSoftName,
|
||||
EquipmentSoftModel = EquipmentSoft.EquipmentSoftModel,
|
||||
Number = EquipmentSoft.Number,
|
||||
RunningState = EquipmentSoft.RunningState,
|
||||
Supplier = EquipmentSoft.Supplier,
|
||||
SupplierMan = EquipmentSoft.SupplierMan,
|
||||
SupplierTel = EquipmentSoft.SupplierTel,
|
||||
};
|
||||
Funs.DB.SmartSite_EquipmentSoft.InsertOnSubmit(newEquipmentSoft);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改软件管理
|
||||
/// </summary>
|
||||
/// <param name="EquipmentSoft"></param>
|
||||
public static void UpdateEquipmentSoft(Model.SmartSite_EquipmentSoft EquipmentSoft)
|
||||
{
|
||||
Model.SmartSite_EquipmentSoft newEquipmentSoft = Funs.DB.SmartSite_EquipmentSoft.FirstOrDefault(e => e.EquipmentSoftId == EquipmentSoft.EquipmentSoftId);
|
||||
if (newEquipmentSoft != null)
|
||||
{
|
||||
newEquipmentSoft.EquipmentId = EquipmentSoft.EquipmentId;
|
||||
newEquipmentSoft.EquipmentSoftName = EquipmentSoft.EquipmentSoftName;
|
||||
newEquipmentSoft.EquipmentSoftModel = EquipmentSoft.EquipmentSoftModel;
|
||||
newEquipmentSoft.Number = EquipmentSoft.Number;
|
||||
newEquipmentSoft.RunningState = EquipmentSoft.RunningState;
|
||||
newEquipmentSoft.Supplier = EquipmentSoft.Supplier;
|
||||
newEquipmentSoft.SupplierMan = EquipmentSoft.SupplierMan;
|
||||
newEquipmentSoft.SupplierTel = EquipmentSoft.SupplierTel;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据主键删除软件管理
|
||||
/// </summary>
|
||||
/// <param name="EquipmentSoftId"></param>
|
||||
public static void DeleteEquipmentSoftById(string EquipmentSoftId)
|
||||
{
|
||||
Model.SmartSite_EquipmentSoft EquipmentSoft = Funs.DB.SmartSite_EquipmentSoft.FirstOrDefault(e => e.EquipmentSoftId == EquipmentSoftId);
|
||||
if (EquipmentSoft != null)
|
||||
{
|
||||
Funs.DB.SmartSite_EquipmentSoft.DeleteOnSubmit(EquipmentSoft);
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据部门Id获取软件管理下拉选择项
|
||||
/// </summary>
|
||||
/// <param name="departId"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Model.SmartSite_EquipmentSoft> GetEquipmentSoftList(string projectId, string type)
|
||||
{
|
||||
return (from x in Funs.DB.SmartSite_EquipmentSoft
|
||||
where x.ProjectId == projectId && x.Type == type
|
||||
orderby x.EquipmentSoftName
|
||||
select x).ToList();
|
||||
}
|
||||
|
||||
#region 软件管理表下拉框
|
||||
/// <summary>
|
||||
/// 软件管理表下拉框
|
||||
/// </summary>
|
||||
/// <param name="dropName">下拉框名字</param>
|
||||
/// <param name="isShowPlease">是否显示请选择</param>
|
||||
public static void InitEquipmentSoftDropDownList(FineUIPro.DropDownList dropName, string projectId, string type, bool isShowPlease)
|
||||
{
|
||||
dropName.DataValueField = "EquipmentSoftId";
|
||||
dropName.DataTextField = "EquipmentSoft";
|
||||
dropName.DataSource = BLL.EquipmentSoftService.GetEquipmentSoftList(projectId, type);
|
||||
dropName.DataBind();
|
||||
if (isShowPlease)
|
||||
{
|
||||
Funs.FineUIPleaseSelect(dropName);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user