75 lines
2.9 KiB
C#
75 lines
2.9 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace BLL
|
|||
|
{
|
|||
|
public static class GoodsModelService
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 根据主键获取开车物资库信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="GoodsModelId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public static Model.DriverGoods_GoodsModel GetGoodsModelById(string GoodsModelId)
|
|||
|
{
|
|||
|
return Funs.DB.DriverGoods_GoodsModel.FirstOrDefault(e => e.GoodsModelId == GoodsModelId);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 添加开车物资库信息
|
|||
|
/// </summary>
|
|||
|
/// <param name="GoodsModel"></param>
|
|||
|
public static void AddGoodsModel(Model.DriverGoods_GoodsModel GoodsModel)
|
|||
|
{
|
|||
|
Model.DriverGoods_GoodsModel newGoodsModel = new Model.DriverGoods_GoodsModel();
|
|||
|
newGoodsModel.GoodsModelId = GoodsModel.GoodsModelId;
|
|||
|
newGoodsModel.ProjectId = GoodsModel.ProjectId;
|
|||
|
newGoodsModel.Code = GoodsModel.Code;
|
|||
|
newGoodsModel.Description = GoodsModel.Description;
|
|||
|
newGoodsModel.Quantity = GoodsModel.Quantity;
|
|||
|
newGoodsModel.Purpose = GoodsModel.Purpose;
|
|||
|
newGoodsModel.Attachment = GoodsModel.Attachment;
|
|||
|
newGoodsModel.Remark = GoodsModel.Remark;
|
|||
|
Funs.DB.DriverGoods_GoodsModel.InsertOnSubmit(newGoodsModel);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 修改开车物资库
|
|||
|
/// </summary>
|
|||
|
/// <param name="GoodsModel"></param>
|
|||
|
public static void UpdateGoodsModel(Model.DriverGoods_GoodsModel GoodsModel)
|
|||
|
{
|
|||
|
Model.DriverGoods_GoodsModel newGoodsModel = Funs.DB.DriverGoods_GoodsModel.FirstOrDefault(e => e.GoodsModelId == GoodsModel.GoodsModelId);
|
|||
|
if (newGoodsModel != null)
|
|||
|
{
|
|||
|
newGoodsModel.Code = GoodsModel.Code;
|
|||
|
newGoodsModel.Description = GoodsModel.Description;
|
|||
|
newGoodsModel.Quantity = GoodsModel.Quantity;
|
|||
|
newGoodsModel.Purpose = GoodsModel.Purpose;
|
|||
|
newGoodsModel.Attachment = GoodsModel.Attachment;
|
|||
|
newGoodsModel.Remark = GoodsModel.Remark;
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 根据主键删除开车物资库
|
|||
|
/// </summary>
|
|||
|
/// <param name="GoodsModelId"></param>
|
|||
|
public static void DeleteGoodsModel(string GoodsModelId)
|
|||
|
{
|
|||
|
Model.DriverGoods_GoodsModel GoodsModel = Funs.DB.DriverGoods_GoodsModel.FirstOrDefault(e => e.GoodsModelId == GoodsModelId);
|
|||
|
if (GoodsModel != null)
|
|||
|
{
|
|||
|
BLL.CommonService.DeleteAttachFileById(GoodsModelId);
|
|||
|
Funs.DB.DriverGoods_GoodsModel.DeleteOnSubmit(GoodsModel);
|
|||
|
Funs.DB.SubmitChanges();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|