ZHJA_HJGL/HJGL_ZH/BLL/Common/Resource/Common_ConstructionStandard...

161 lines
9.3 KiB
C#
Raw Normal View History

2024-05-08 17:17:11 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using System.Web.UI.WebControls;
namespace BLL
{
public class Common_ConstructionStandardService
{
/// <summary>
/// 根据标准规范清单Id获取一个标准规范清单信息
/// </summary>
/// <param name="standardId">标准规范清单Id</param>
/// <returns>一个标准规范清单实体</returns>
public static Model.Common_ConstructionStandardList GetConstructionStandardByStandardId(string standardId)
{
return Funs.DB.Common_ConstructionStandardList.FirstOrDefault(x => x.StandardId == standardId);
}
/// <summary>
/// 增加标准规范清单信息
/// </summary>
/// <param name="ConstructionStandardList">标准规范清单实体</param>
public static void AddConstructionStandardList(Model.Common_ConstructionStandardList ConstructionStandardList)
{
Model.SGGLDB db = Funs.DB;
Model.Common_ConstructionStandardList newConstructionStandardList = new Model.Common_ConstructionStandardList();
newConstructionStandardList.StandardId = ConstructionStandardList.StandardId;
newConstructionStandardList.StandardCode = ConstructionStandardList.StandardCode;
newConstructionStandardList.StandardGrade = ConstructionStandardList.StandardGrade;
newConstructionStandardList.StandardNo = ConstructionStandardList.StandardNo;
newConstructionStandardList.StandardName = ConstructionStandardList.StandardName;
newConstructionStandardList.AttachUrl = ConstructionStandardList.AttachUrl;
newConstructionStandardList.IsSelected1 = ConstructionStandardList.IsSelected1;
newConstructionStandardList.IsSelected2 = ConstructionStandardList.IsSelected2;
newConstructionStandardList.IsSelected3 = ConstructionStandardList.IsSelected3;
newConstructionStandardList.IsSelected4 = ConstructionStandardList.IsSelected4;
newConstructionStandardList.IsSelected5 = ConstructionStandardList.IsSelected5;
newConstructionStandardList.IsSelected6 = ConstructionStandardList.IsSelected6;
newConstructionStandardList.IsSelected7 = ConstructionStandardList.IsSelected7;
newConstructionStandardList.IsSelected8 = ConstructionStandardList.IsSelected8;
newConstructionStandardList.IsSelected9 = ConstructionStandardList.IsSelected9;
newConstructionStandardList.IsSelected10 = ConstructionStandardList.IsSelected10;
newConstructionStandardList.IsSelected11 = ConstructionStandardList.IsSelected11;
newConstructionStandardList.IsSelected12 = ConstructionStandardList.IsSelected12;
newConstructionStandardList.IsSelected13 = ConstructionStandardList.IsSelected13;
newConstructionStandardList.IsSelected14 = ConstructionStandardList.IsSelected14;
newConstructionStandardList.IsSelected15 = ConstructionStandardList.IsSelected15;
newConstructionStandardList.IsSelected16 = ConstructionStandardList.IsSelected16;
newConstructionStandardList.IsSelected17 = ConstructionStandardList.IsSelected17;
newConstructionStandardList.IsSelected18 = ConstructionStandardList.IsSelected18;
newConstructionStandardList.IsSelected19 = ConstructionStandardList.IsSelected19;
newConstructionStandardList.IsSelected20 = ConstructionStandardList.IsSelected20;
newConstructionStandardList.IsSelected21 = ConstructionStandardList.IsSelected21;
newConstructionStandardList.IsSelected22 = ConstructionStandardList.IsSelected22;
newConstructionStandardList.IsSelected23 = ConstructionStandardList.IsSelected23;
newConstructionStandardList.IsSelected90 = ConstructionStandardList.IsSelected90;
newConstructionStandardList.IsModel = ConstructionStandardList.IsModel;
newConstructionStandardList.Type = ConstructionStandardList.Type;
db.Common_ConstructionStandardList.InsertOnSubmit(newConstructionStandardList);
db.SubmitChanges();
}
/// <summary>
/// 修改标准规范清单信息
/// </summary>
/// <param name="ConstructionStandardList">标准规范清单实体</param>
public static void UpdateConstructionStandardList(Model.Common_ConstructionStandardList ConstructionStandardList)
{
Model.SGGLDB db = Funs.DB;
Model.Common_ConstructionStandardList newConstructionStandardList = db.Common_ConstructionStandardList.First(e => e.StandardId == ConstructionStandardList.StandardId);
newConstructionStandardList.StandardCode = ConstructionStandardList.StandardCode;
newConstructionStandardList.StandardGrade = ConstructionStandardList.StandardGrade;
newConstructionStandardList.StandardNo = ConstructionStandardList.StandardNo;
newConstructionStandardList.StandardName = ConstructionStandardList.StandardName;
newConstructionStandardList.AttachUrl = ConstructionStandardList.AttachUrl;
newConstructionStandardList.IsSelected1 = ConstructionStandardList.IsSelected1;
newConstructionStandardList.IsSelected2 = ConstructionStandardList.IsSelected2;
newConstructionStandardList.IsSelected3 = ConstructionStandardList.IsSelected3;
newConstructionStandardList.IsSelected4 = ConstructionStandardList.IsSelected4;
newConstructionStandardList.IsSelected5 = ConstructionStandardList.IsSelected5;
newConstructionStandardList.IsSelected6 = ConstructionStandardList.IsSelected6;
newConstructionStandardList.IsSelected7 = ConstructionStandardList.IsSelected7;
newConstructionStandardList.IsSelected8 = ConstructionStandardList.IsSelected8;
newConstructionStandardList.IsSelected9 = ConstructionStandardList.IsSelected9;
newConstructionStandardList.IsSelected10 = ConstructionStandardList.IsSelected10;
newConstructionStandardList.IsSelected11 = ConstructionStandardList.IsSelected11;
newConstructionStandardList.IsSelected12 = ConstructionStandardList.IsSelected12;
newConstructionStandardList.IsSelected13 = ConstructionStandardList.IsSelected13;
newConstructionStandardList.IsSelected14 = ConstructionStandardList.IsSelected14;
newConstructionStandardList.IsSelected15 = ConstructionStandardList.IsSelected15;
newConstructionStandardList.IsSelected16 = ConstructionStandardList.IsSelected16;
newConstructionStandardList.IsSelected17 = ConstructionStandardList.IsSelected17;
newConstructionStandardList.IsSelected18 = ConstructionStandardList.IsSelected18;
newConstructionStandardList.IsSelected19 = ConstructionStandardList.IsSelected19;
newConstructionStandardList.IsSelected20 = ConstructionStandardList.IsSelected20;
newConstructionStandardList.IsSelected21 = ConstructionStandardList.IsSelected21;
newConstructionStandardList.IsSelected22 = ConstructionStandardList.IsSelected22;
newConstructionStandardList.IsSelected23 = ConstructionStandardList.IsSelected23;
newConstructionStandardList.IsSelected90 = ConstructionStandardList.IsSelected90;
newConstructionStandardList.IsModel = ConstructionStandardList.IsModel;
newConstructionStandardList.Type = ConstructionStandardList.Type;
db.SubmitChanges();
}
/// <summary>
/// 根据标准规范清单Id删除一个标准规范清单信息
/// </summary>
/// <param name="standardCode">标准规范清单Id</param>
public static void DeleteConstructionStandardList(string standardId)
{
Model.SGGLDB db = Funs.DB;
Model.Common_ConstructionStandardList ConstructionStandardList = db.Common_ConstructionStandardList.First(e => e.StandardId == standardId);
db.Common_ConstructionStandardList.DeleteOnSubmit(ConstructionStandardList);
db.SubmitChanges();
}
/// <summary>
/// 是否存在相同的标准编号
/// </summary>
/// <param name="standardId">主键</param>
/// <param name="standardCode">编号</param>
/// <param name="type">类型</param>
/// <returns>true:存在false:不存在</returns>
public static bool IsExistStandardCode(string standardId, int standardCode, string type)
{
bool isExist = false;
var q = Funs.DB.Common_ConstructionStandardList.FirstOrDefault(x => x.StandardCode == standardCode && x.StandardId != standardId && x.Type == type);
if (q != null)
{
isExist = true;
}
return isExist;
}
/// <summary>
/// 获取标准级别列表
/// </summary>
/// <returns></returns>
public static List<string> GetStandardGradeList()
{
var q = (from x in Funs.DB.Common_ConstructionStandardList select x.StandardGrade).Distinct().ToList();
List<string> list = new List<string>();
for (int i = 0; i < q.Count(); i++)
{
list.Add(q[i].Trim());
}
return list;
}
}
}