123 lines
3.9 KiB
C#
123 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_MediumService
|
|
{
|
|
/// <summary>
|
|
/// 根据介质Id获取介质信息
|
|
/// </summary>
|
|
/// <param name="ser_id"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_Service GetServiceBySERID(string ser_id)
|
|
{
|
|
return Funs.DB.HJGL_BS_Service.FirstOrDefault(e => e.SER_ID == ser_id);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加
|
|
/// </summary>
|
|
/// <param name="service"></param>
|
|
public static void AddService(Model.HJGL_BS_Service service)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
string newKeyID = SQLHelper.GetNewID(typeof(Model.HJGL_BS_Service));
|
|
Model.HJGL_BS_Service newService = new Model.HJGL_BS_Service();
|
|
|
|
newService.SER_ID = newKeyID;
|
|
newService.SER_Code = service.SER_Code;
|
|
newService.SER_Name = service.SER_Name;
|
|
newService.SER_Remark = service.SER_Remark;
|
|
newService.SER_Abbreviate = service.SER_Abbreviate;
|
|
|
|
db.HJGL_BS_Service.InsertOnSubmit(newService);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="service"></param>
|
|
public static void UpdateService(Model.HJGL_BS_Service service)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.HJGL_BS_Service newService = db.HJGL_BS_Service.FirstOrDefault(e => e.SER_ID == service.SER_ID);
|
|
if (newService != null)
|
|
{
|
|
newService.SER_Code = service.SER_Code;
|
|
newService.SER_Name = service.SER_Name;
|
|
newService.SER_Remark = service.SER_Remark;
|
|
newService.SER_Abbreviate = service.SER_Abbreviate;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除
|
|
/// </summary>
|
|
/// <param name="ser_id"></param>
|
|
public static void DeleteService(string ser_id)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
|
|
Model.HJGL_BS_Service service = db.HJGL_BS_Service.FirstOrDefault(e => e.SER_ID == ser_id);
|
|
if (service != null)
|
|
{
|
|
db.HJGL_BS_Service.DeleteOnSubmit(service);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 判断是否存在相同的焊缝类型编号
|
|
/// </summary>
|
|
/// <param name="ser_code"></param>
|
|
/// <returns></returns>
|
|
public static bool IsExitSERCode(string ser_code,string id)
|
|
{
|
|
var q = Funs.DB.HJGL_BS_Service.FirstOrDefault(x => x.SER_Code == ser_code && x.SER_ID != id);
|
|
if (q != null)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据介质代码获取介质信息
|
|
/// </summary>
|
|
/// <param name="unitCode"></param>
|
|
/// <returns></returns>
|
|
public static Model.HJGL_BS_Service GetServiceByServiceCode(string serviceCode)
|
|
{
|
|
return Funs.DB.HJGL_BS_Service.FirstOrDefault(x => x.SER_Code == serviceCode);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取介质信息项
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static List<Model.HJGL_BS_Service> GetBSServiceList()
|
|
{
|
|
var q = (from x in Funs.DB.HJGL_BS_Service orderby x.SER_Code select x).ToList();
|
|
//ListItem[] item = new ListItem[q.Count()];
|
|
//for (int i = 0; i < q.Count(); i++)
|
|
//{
|
|
// item[i] = new ListItem(q[i].SER_Name ?? "", q[i].SER_ID.ToString());
|
|
//}
|
|
return q;
|
|
}
|
|
}
|
|
}
|