using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLL { public class AwardStandardsService { public static Model.SGGLDB db = Funs.DB; /// /// 根据主键获取 /// /// /// public static Model.Technique_AwardStandards GetAwardStandardsListById(string AwardStandardsId) { return Funs.DB.Technique_AwardStandards.FirstOrDefault(e => e.AwardStandardsId == AwardStandardsId); } /// /// 获取集合 /// /// /// public static List GetAwardStandardsList(int PageNumber, int PageSize) { List getDataLists = (from x in Funs.DB.Technique_AwardStandards select new AwardStandardsItem { AwardStandardsId = x.AwardStandardsId, AwardStandardsCode = x.AwardStandardsCode, AwardStandardsName = x.AwardStandardsName, AttachUrl = x.AttachUrl, CompileMan = x.CompileMan, CompileDate = x.CompileDate, IsPass = x.IsPass, UpState = x.UpState, Remark = x.Remark }).ToList(); if (PageNumber > 0 && PageSize > 0) { getDataLists = getDataLists.Skip((PageNumber - 1) * PageSize).Take(PageSize).ToList(); } return getDataLists; } /// /// 添加 /// /// public static void AddAwardStandardsList(Model.Technique_AwardStandards AwardStandardsList) { Model.SGGLDB db = Funs.DB; Model.Technique_AwardStandards newAwardStandardsList = new Model.Technique_AwardStandards { AwardStandardsId = AwardStandardsList.AwardStandardsId, AwardStandardsCode = AwardStandardsList.AwardStandardsCode, AwardStandardsName = AwardStandardsList.AwardStandardsName, AttachUrl = AwardStandardsList.AttachUrl, CompileMan = AwardStandardsList.CompileMan, CompileDate = AwardStandardsList.CompileDate, }; newAwardStandardsList.CompileMan = AwardStandardsList.CompileMan; newAwardStandardsList.CompileDate = AwardStandardsList.CompileDate; newAwardStandardsList.IsPass = AwardStandardsList.IsPass; newAwardStandardsList.UpState = AwardStandardsList.UpState; newAwardStandardsList.Remark = AwardStandardsList.Remark; db.Technique_AwardStandards.InsertOnSubmit(newAwardStandardsList); db.SubmitChanges(); } /// /// 修改 /// /// public static void UpdateAwardStandardsList(Model.Technique_AwardStandards AwardStandardsList) { Model.SGGLDB db = Funs.DB; Model.Technique_AwardStandards newAwardStandardsList = db.Technique_AwardStandards.FirstOrDefault(e => e.AwardStandardsId == AwardStandardsList.AwardStandardsId); if (newAwardStandardsList != null) { newAwardStandardsList.AwardStandardsCode = AwardStandardsList.AwardStandardsCode; newAwardStandardsList.AwardStandardsName = AwardStandardsList.AwardStandardsName; newAwardStandardsList.AttachUrl = AwardStandardsList.AttachUrl; newAwardStandardsList.CompileMan = AwardStandardsList.CompileMan; newAwardStandardsList.CompileDate = AwardStandardsList.CompileDate; newAwardStandardsList.UpState = AwardStandardsList.UpState; newAwardStandardsList.Remark = AwardStandardsList.Remark; db.SubmitChanges(); } } /// ///根据主键删除 /// /// public static void DeleteAwardStandardsListById(string AwardStandardsId) { Model.SGGLDB db = Funs.DB; Model.Technique_AwardStandards AwardStandardsList = db.Technique_AwardStandards.FirstOrDefault(e => e.AwardStandardsId == AwardStandardsId); if (AwardStandardsList != null) { if (!string.IsNullOrEmpty(AwardStandardsList.AttachUrl)) { BLL.UploadFileService.DeleteFile(Funs.RootPath, AwardStandardsList.AttachUrl); } ////删除附件表 BLL.CommonService.DeleteAttachFileById(AwardStandardsList.AwardStandardsId); db.Technique_AwardStandards.DeleteOnSubmit(AwardStandardsList); db.SubmitChanges(); } } public class AwardStandardsItem { public string AwardStandardsId { get; set; } public string AwardStandardsCode { get; set; } public string AwardStandardsName { get; set; } public string AttachUrl { get; set; } public string CompileMan { get; set; } public System.Nullable CompileDate { get; set; } public System.Nullable IsPass { get; set; } public string UpState { get; set; } public string Remark { get; set; } } } }