109 lines
3.9 KiB
C#
109 lines
3.9 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_WeldService
|
|
{
|
|
/// <summary>
|
|
/// 根据焊缝类型Id获取焊缝类型信息
|
|
/// </summary>
|
|
/// <param name="joty_id"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_JointType GetJointTypeByID(string joty_id)
|
|
{
|
|
return Funs.DB.HJGL_BS_JointType.FirstOrDefault(e => e.JOTY_ID == joty_id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加焊缝类型
|
|
/// </summary>
|
|
/// <param name="jointType"></param>
|
|
public static void AddJointType(Model.HJGL_BS_JointType jointType)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_JointType));
|
|
Model.HJGL_BS_JointType newJointType = new Model.HJGL_BS_JointType();
|
|
newJointType.JOTY_ID = newKeyID;
|
|
newJointType.JOTY_Code = jointType.JOTY_Code;
|
|
newJointType.JOTY_Name = jointType.JOTY_Name;
|
|
newJointType.JOTY_Remark = jointType.JOTY_Remark;
|
|
newJointType.JOTY_Group = jointType.JOTY_Group;
|
|
|
|
db.HJGL_BS_JointType.InsertOnSubmit(newJointType);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改焊缝类型
|
|
/// </summary>
|
|
/// <param name="jointType"></param>
|
|
public static void UpdateJointType(Model.HJGL_BS_JointType jointType)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_JointType newJointType = db.HJGL_BS_JointType.FirstOrDefault(e => e.JOTY_ID == jointType.JOTY_ID);
|
|
if (newJointType != null)
|
|
{
|
|
newJointType.JOTY_Code = jointType.JOTY_Code;
|
|
newJointType.JOTY_Name = jointType.JOTY_Name;
|
|
newJointType.JOTY_Remark = jointType.JOTY_Remark;
|
|
newJointType.JOTY_Group = jointType.JOTY_Group;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除焊缝类型
|
|
/// </summary>
|
|
/// <param name="jot_id"></param>
|
|
public static void DeleteJointType(string jot_id)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_JointType jointType = db.HJGL_BS_JointType.FirstOrDefault(e => e.JOTY_ID == jot_id);
|
|
if (jointType != null)
|
|
{
|
|
db.HJGL_BS_JointType.DeleteOnSubmit(jointType);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否存在相同的焊缝类型编号
|
|
/// </summary>
|
|
/// <param name="joty_code"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExitJotyCode(string joty_code, string id, string projectSoft)
|
|
{
|
|
var q = Funs.DB.HJGL_BS_JointType.FirstOrDefault(x => x.JOTY_Code == joty_code && x.JOTY_ID != id && x.ProjectSoft == projectSoft);
|
|
return q != null ? true : false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取焊缝类型名称
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_BS_JointType> GetJointTypeNameList(string projectSoft)
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BS_JointType where x.ProjectSoft == projectSoft orderby x.JOTY_Code select x).ToList();
|
|
return q;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据焊缝类型获取焊缝类型信息
|
|
/// </summary>
|
|
/// <param name="unitCode"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_JointType GetJointTypeByJointTypeName(string jointTypeName)
|
|
{
|
|
return Funs.DB.HJGL_BS_JointType.FirstOrDefault(x => x.JOTY_Name == jointTypeName);
|
|
}
|
|
}
|
|
}
|