113 lines
3.7 KiB
C#
113 lines
3.7 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_GrooveService
|
|
{
|
|
/// <summary>
|
|
/// 根据ID获取坡口类型
|
|
/// </summary>
|
|
/// <param name="jst_id"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_SlopeType GetSlopeTypeByJSTID(string jst_id)
|
|
{
|
|
return Funs.DB.HJGL_BS_SlopeType.FirstOrDefault(e => e.JST_ID == jst_id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加
|
|
/// </summary>
|
|
/// <param name="slopeType"></param>
|
|
public static void AddSlopeType(Model.HJGL_BS_SlopeType slopeType)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_SlopeType newSlopeType = new Model.HJGL_BS_SlopeType();
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_SlopeType));
|
|
newSlopeType.JST_ID = newKeyID;
|
|
newSlopeType.JST_Code = slopeType.JST_Code;
|
|
newSlopeType.JST_Name = slopeType.JST_Name;
|
|
newSlopeType.JST_Remark = slopeType.JST_Remark;
|
|
db.HJGL_BS_SlopeType.InsertOnSubmit(newSlopeType);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="slopeType"></param>
|
|
public static void UpdateSlopeType(Model.HJGL_BS_SlopeType slopeType)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_SlopeType newSlopeType = db.HJGL_BS_SlopeType.FirstOrDefault(e => e.JST_ID == slopeType.JST_ID);
|
|
if (newSlopeType != null)
|
|
{
|
|
newSlopeType.JST_Code = slopeType.JST_Code;
|
|
newSlopeType.JST_Name = slopeType.JST_Name;
|
|
newSlopeType.JST_Remark = slopeType.JST_Remark;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="jst_id"></param>
|
|
public static void DeleteSlopeType(string jst_id)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_SlopeType newSlopeType = db.HJGL_BS_SlopeType.FirstOrDefault(e => e.JST_ID == jst_id);
|
|
if (newSlopeType != null)
|
|
{
|
|
db.HJGL_BS_SlopeType.DeleteOnSubmit(newSlopeType);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否存在相同的直径代号
|
|
/// </summary>
|
|
/// <param name="jst_code"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExitJSTCode(string jst_code,string id)
|
|
{
|
|
var q = Funs.DB.HJGL_BS_SlopeType.FirstOrDefault(x => x.JST_Code == jst_code && x.JST_ID != id);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据坡口代码获取坡口类型信息
|
|
/// </summary>
|
|
/// <param name="unitCode"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_SlopeType GetSlopeTypeBySlopeTypeCode(string slopeTypeCode)
|
|
{
|
|
return Funs.DB.HJGL_BS_SlopeType.FirstOrDefault(x => x.JST_Code == slopeTypeCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取坡口类型下拉框方法
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_BS_SlopeType> GetSlopeTypeNameList()
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BS_SlopeType orderby x.JST_Code select x).ToList();
|
|
return q;
|
|
}
|
|
}
|
|
}
|