135 lines
4.3 KiB
C#
135 lines
4.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Collections;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 探伤比例
|
|
/// </summary>
|
|
public static class HJGL_DetectionService
|
|
{
|
|
/// <summary>
|
|
/// 根据探伤比例Id获取探伤比例
|
|
/// </summary>
|
|
/// <param name="ndtrId"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_NDTRate GetNDTRateByNDTRID(string ndtrId)
|
|
{
|
|
return Funs.DB.HJGL_BS_NDTRate.FirstOrDefault(e => e.NDTR_ID == ndtrId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加探伤比例
|
|
/// </summary>
|
|
/// <param name="ndtrate"></param>
|
|
public static void AddNDTRate(Model.HJGL_BS_NDTRate ndtrate)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_NDTRate newNDTRate = new Model.HJGL_BS_NDTRate();
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_NDTRate));
|
|
newNDTRate.NDTR_ID = newKeyID;
|
|
newNDTRate.NDTR_Code = ndtrate.NDTR_Code;
|
|
newNDTRate.NDTR_Name = ndtrate.NDTR_Name;
|
|
newNDTRate.NDTR_Rate = ndtrate.NDTR_Rate;
|
|
newNDTRate.NDTR_Remark = ndtrate.NDTR_Remark;
|
|
db.HJGL_BS_NDTRate.InsertOnSubmit(newNDTRate);
|
|
db.SubmitChanges();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="ndtrate"></param>
|
|
public static void UpdateNDTRate(Model.HJGL_BS_NDTRate ndtrate)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_NDTRate newNDTRate = db.HJGL_BS_NDTRate.FirstOrDefault(e => e.NDTR_ID == ndtrate.NDTR_ID);
|
|
if (newNDTRate != null)
|
|
{
|
|
newNDTRate.NDTR_Code = ndtrate.NDTR_Code;
|
|
newNDTRate.NDTR_Name = ndtrate.NDTR_Name;
|
|
newNDTRate.NDTR_Rate = ndtrate.NDTR_Rate;
|
|
newNDTRate.NDTR_Remark = ndtrate.NDTR_Remark;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="ndtrateId"></param>
|
|
public static void DeleteNDTRate(string ndtrateId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_NDTRate ndtrate = db.HJGL_BS_NDTRate.FirstOrDefault(e => e.NDTR_ID == ndtrateId);
|
|
if (ndtrate != null)
|
|
{
|
|
db.HJGL_BS_NDTRate.DeleteOnSubmit(ndtrate);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否存在相同的探伤类型代号
|
|
/// </summary>
|
|
/// <param name="ndtrateCode"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExitNDTRateCode(string ndtrateCode,string id )
|
|
{
|
|
if (id == null)
|
|
{
|
|
id = "";
|
|
}
|
|
var q = Funs.DB.HJGL_BS_NDTRate.FirstOrDefault(x => x.NDTR_Code == ndtrateCode && x.NDTR_ID != id);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取探伤比例下拉框
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_BS_NDTRate> GetNDTRateNameList()
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BS_NDTRate orderby x.NDTR_Code select x).ToList();
|
|
return q;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取探伤比例下拉框
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static ListItem[] GetNDTRateNameItemList()
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BS_NDTRate orderby x.NDTR_Code select x).ToList();
|
|
ListItem[] list = new ListItem[q.Count()];
|
|
for (int i = 0; i < q.Count(); i++)
|
|
{
|
|
list[i] = new ListItem(q[i].NDTR_Code + "%", q[i].NDTR_ID.ToString());
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据探伤值获取探伤类型信息
|
|
/// </summary>
|
|
/// <param name="unitCode"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_NDTRate GetRateByRateName(string rateName)
|
|
{
|
|
return Funs.DB.HJGL_BS_NDTRate.FirstOrDefault(x => x.NDTR_Name == rateName);
|
|
}
|
|
}
|
|
}
|