using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { public class OneTimeContractManagementService { /// /// 根据主键获取Contract Management /// /// /// public static Model.EMC_OneTimeContractManagement GetOneTimeContractManagementById(string fileId) { return Funs.DB.EMC_OneTimeContractManagement.FirstOrDefault(e => e.FileId == fileId); } /// /// 添加Contract Management /// /// public static void AddOneTimeContractManagement(Model.EMC_OneTimeContractManagement contractManagement) { Model.EMC_OneTimeContractManagement newContractManagement = new Model.EMC_OneTimeContractManagement(); newContractManagement.FileId = contractManagement.FileId; newContractManagement.OneTimeContractsId = contractManagement.OneTimeContractsId; 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_OneTimeContractManagement.InsertOnSubmit(newContractManagement); Funs.DB.SubmitChanges(); } /// /// 修改Contract Management /// /// public static void UpdateOneTimeContractManagement(Model.EMC_OneTimeContractManagement contractManagement) { Model.EMC_OneTimeContractManagement newContractManagement = Funs.DB.EMC_OneTimeContractManagement.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 DeleteOneTimeContractManagementById(string fileId) { Model.EMC_OneTimeContractManagement con = Funs.DB.EMC_OneTimeContractManagement.FirstOrDefault(e => e.FileId == fileId); if (con != null) { Funs.DB.EMC_OneTimeContractManagement.DeleteOnSubmit(con); Funs.DB.SubmitChanges(); } } /// /// 根据合同Id获取相关附件信息 /// /// /// public static List GetOneTimeContractManagementByOneTimeId(string oneTimeContractsId) { return (from x in Funs.DB.EMC_OneTimeContractManagement where x.OneTimeContractsId == oneTimeContractsId select x).ToList(); } /// /// 根据合同主键删除相关附件 /// /// public static void DeleteOneTimeContractManagementList(string oneTimeContractsId) { var q = (from x in Funs.DB.EMC_OneTimeContractManagement where x.OneTimeContractsId == oneTimeContractsId select x).ToList(); if (q != null) { Funs.DB.EMC_OneTimeContractManagement.DeleteAllOnSubmit(q); Funs.DB.SubmitChanges(); } } } }