69 lines
2.2 KiB
C#
69 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 规格定义
|
|
/// </summary>
|
|
public class Base_FormatService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取规格定义
|
|
/// </summary>
|
|
/// <param name="formatId"></param>
|
|
/// <returns></returns>
|
|
public static Model.Base_Format GetFormatById(string formatId)
|
|
{
|
|
return Funs.DB.Base_Format.FirstOrDefault(e => e.FormatId == formatId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加规格定义
|
|
/// </summary>
|
|
/// <param name="format"></param>
|
|
public static void AddFormat(Model.Base_Format format)
|
|
{
|
|
Model.Base_Format newFormat = new Model.Base_Format();
|
|
newFormat.FormatId = format.FormatId;
|
|
newFormat.FormatCode = format.FormatCode;
|
|
newFormat.FormatName = format.FormatName;
|
|
newFormat.Remark = format.Remark;
|
|
Funs.DB.Base_Format.InsertOnSubmit(newFormat);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改规格定义
|
|
/// </summary>
|
|
/// <param name="format"></param>
|
|
public static void UpdateFormat(Model.Base_Format format)
|
|
{
|
|
Model.Base_Format newFormat = Funs.DB.Base_Format.FirstOrDefault(e => e.FormatId == format.FormatId);
|
|
if (newFormat != null)
|
|
{
|
|
newFormat.FormatCode = format.FormatCode;
|
|
newFormat.FormatName = format.FormatName;
|
|
newFormat.Remark = format.Remark;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除规格定义
|
|
/// </summary>
|
|
/// <param name="formatId"></param>
|
|
public static void DeleteFormatById(string formatId)
|
|
{
|
|
Model.Base_Format format = Funs.DB.Base_Format.FirstOrDefault(e => e.FormatId == formatId);
|
|
if (format != null)
|
|
{
|
|
Funs.DB.Base_Format.DeleteOnSubmit(format);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
}
|
|
} |