using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { public class CTSalesContractManagementService { /// /// 根据主键获取Contract Management /// /// /// public static Model.EMC_CTSalesContractManagement GetCTSalesContractManagementById(string fileId) { return Funs.DB.EMC_CTSalesContractManagement.FirstOrDefault(e => e.FileId == fileId); } /// /// 添加Contract Management /// /// public static void AddCTSalesContractManagement(Model.EMC_CTSalesContractManagement contractManagement) { Model.EMC_CTSalesContractManagement newContractManagement = new Model.EMC_CTSalesContractManagement(); newContractManagement.FileId = contractManagement.FileId; newContractManagement.CTSalesContractsId = contractManagement.CTSalesContractsId; newContractManagement.FileName = contractManagement.FileName; newContractManagement.FileTypeId = contractManagement.FileTypeId; newContractManagement.FileTypeCode = contractManagement.FileTypeCode; newContractManagement.UploadMan = contractManagement.UploadMan; newContractManagement.UploadDate = contractManagement.UploadDate; newContractManagement.Remark = contractManagement.Remark; newContractManagement.AttachUrl = contractManagement.AttachUrl; Funs.DB.EMC_CTSalesContractManagement.InsertOnSubmit(newContractManagement); Funs.DB.SubmitChanges(); } /// /// 修改Contract Management /// /// public static void UpdateCTSalesContractManagement(Model.EMC_CTSalesContractManagement contractManagement) { Model.EMC_CTSalesContractManagement newContractManagement = Funs.DB.EMC_CTSalesContractManagement.FirstOrDefault(e => e.FileId == contractManagement.FileId); if (newContractManagement != null) { newContractManagement.FileName = contractManagement.FileName; //newContractManagement.FileTypeId = contractManagement.FileTypeId; //newContractManagement.FileTypeCode = contractManagement.FileTypeCode; newContractManagement.UploadMan = contractManagement.UploadMan; newContractManagement.UploadDate = contractManagement.UploadDate; //newContractManagement.Remark = contractManagement.Remark; newContractManagement.AttachUrl = contractManagement.AttachUrl; Funs.DB.SubmitChanges(); } } /// /// 根据主键删除Contract Management /// /// public static void DeleteCTSalesContractManagementById(string fileId) { Model.EMC_CTSalesContractManagement con = Funs.DB.EMC_CTSalesContractManagement.FirstOrDefault(e => e.FileId == fileId); if (con != null) { Funs.DB.EMC_CTSalesContractManagement.DeleteOnSubmit(con); Funs.DB.SubmitChanges(); } } /// /// 根据合同Id获取相关附件信息 /// /// /// public static List GetCTSalesContractManagementByCTId(string cTSalesContractsId) { return (from x in Funs.DB.EMC_CTSalesContractManagement where x.CTSalesContractsId == cTSalesContractsId select x).ToList(); } /// /// 根据合同主键删除相关附件 /// /// public static void DeleteCTSalesContractManagementList(string cTSalesContractsId) { var q = (from x in Funs.DB.EMC_CTSalesContractManagement where x.CTSalesContractsId == cTSalesContractsId select x).ToList(); if (q != null) { Funs.DB.EMC_CTSalesContractManagement.DeleteAllOnSubmit(q); Funs.DB.SubmitChanges(); } } } }