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
{
///
/// 根据标准规范清单Id获取一个标准规范清单信息
///
/// 标准规范清单Id
/// 一个标准规范清单实体
public static Model.Common_ConstructionStandardList GetConstructionStandardByStandardId(string standardId)
{
return Funs.DB.Common_ConstructionStandardList.FirstOrDefault(x => x.StandardId == standardId);
}
///
/// 增加标准规范清单信息
///
/// 标准规范清单实体
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();
}
///
/// 修改标准规范清单信息
///
/// 标准规范清单实体
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();
}
///
/// 根据标准规范清单Id删除一个标准规范清单信息
///
/// 标准规范清单Id
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();
}
///
/// 是否存在相同的标准编号
///
/// 主键
/// 编号
/// 类型
/// true:存在,false:不存在
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;
}
///
/// 获取标准级别列表
///
///
public static List GetStandardGradeList()
{
var q = (from x in Funs.DB.Common_ConstructionStandardList select x.StandardGrade).Distinct().ToList();
List list = new List();
for (int i = 0; i < q.Count(); i++)
{
list.Add(q[i].Trim());
}
return list;
}
}
}