181 lines
6.3 KiB
C#
181 lines
6.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
namespace BLL;
|
|
|
|
public class ConstructionStandardsService
|
|
{
|
|
public static Model.SGGLDB db = Funs.DB;
|
|
|
|
/// <summary>
|
|
/// 根据主键获取
|
|
/// </summary>
|
|
/// <param name="ConstructionStandardsId"></param>
|
|
/// <returns></returns>
|
|
public static Model.Technique_ConstructionStandards GetConstructionStandardsListById(string ConstructionStandardsId)
|
|
{
|
|
return Funs.DB.Technique_ConstructionStandards.FirstOrDefault(e =>
|
|
e.ConstructionStandardsId == ConstructionStandardsId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取集合
|
|
/// </summary>
|
|
/// <param name="ConstructionStandardsId"></param>
|
|
/// <returns></returns>
|
|
public static List<ConstructionStandardsItem> GetConstructionStandardsList(int PageNumber, int PageSize)
|
|
{
|
|
List<ConstructionStandardsItem> getDataLists = (from x in Funs.DB.Technique_ConstructionStandards
|
|
select new ConstructionStandardsItem
|
|
{
|
|
ConstructionStandardsId = x.ConstructionStandardsId,
|
|
ConstructionStandardsCode = x.ConstructionStandardsCode,
|
|
ConstructionStandardsName = x.ConstructionStandardsName,
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加
|
|
/// </summary>
|
|
/// <param name="ConstructionStandardsList"></param>
|
|
public static void AddConstructionStandardsList(Model.Technique_ConstructionStandards ConstructionStandardsList)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Technique_ConstructionStandards newConstructionStandardsList = new Model.Technique_ConstructionStandards
|
|
{
|
|
ConstructionStandardsId = ConstructionStandardsList.ConstructionStandardsId,
|
|
ConstructionStandardsCode = ConstructionStandardsList.ConstructionStandardsCode,
|
|
ConstructionStandardsName = ConstructionStandardsList.ConstructionStandardsName,
|
|
AttachUrl = ConstructionStandardsList.AttachUrl,
|
|
CompileMan = ConstructionStandardsList.CompileMan,
|
|
CompileDate = ConstructionStandardsList.CompileDate,
|
|
};
|
|
newConstructionStandardsList.CompileMan = ConstructionStandardsList.CompileMan;
|
|
newConstructionStandardsList.CompileDate = ConstructionStandardsList.CompileDate;
|
|
newConstructionStandardsList.IsPass = ConstructionStandardsList.IsPass;
|
|
newConstructionStandardsList.UpState = ConstructionStandardsList.UpState;
|
|
newConstructionStandardsList.Remark = ConstructionStandardsList.Remark;
|
|
db.Technique_ConstructionStandards.InsertOnSubmit(newConstructionStandardsList);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改
|
|
/// </summary>
|
|
/// <param name="ConstructionStandardsList"></param>
|
|
public static void UpdateConstructionStandardsList(Model.Technique_ConstructionStandards ConstructionStandardsList)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Technique_ConstructionStandards newConstructionStandardsList =
|
|
db.Technique_ConstructionStandards.FirstOrDefault(e =>
|
|
e.ConstructionStandardsId == ConstructionStandardsList.ConstructionStandardsId);
|
|
if (newConstructionStandardsList != null)
|
|
{
|
|
newConstructionStandardsList.ConstructionStandardsCode = ConstructionStandardsList.ConstructionStandardsCode;
|
|
newConstructionStandardsList.ConstructionStandardsName = ConstructionStandardsList.ConstructionStandardsName;
|
|
newConstructionStandardsList.AttachUrl = ConstructionStandardsList.AttachUrl;
|
|
newConstructionStandardsList.CompileMan = ConstructionStandardsList.CompileMan;
|
|
newConstructionStandardsList.CompileDate = ConstructionStandardsList.CompileDate;
|
|
newConstructionStandardsList.UpState = ConstructionStandardsList.UpState;
|
|
newConstructionStandardsList.Remark = ConstructionStandardsList.Remark;
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
///根据主键删除
|
|
/// </summary>
|
|
/// <param name="ConstructionStandardsId"></param>
|
|
public static void DeleteConstructionStandardsListById(string ConstructionStandardsId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Technique_ConstructionStandards ConstructionStandardsList =
|
|
db.Technique_ConstructionStandards.FirstOrDefault(e => e.ConstructionStandardsId == ConstructionStandardsId);
|
|
if (ConstructionStandardsList != null)
|
|
{
|
|
if (!string.IsNullOrEmpty(ConstructionStandardsList.AttachUrl))
|
|
{
|
|
BLL.UploadFileService.DeleteFile(Funs.RootPath, ConstructionStandardsList.AttachUrl);
|
|
}
|
|
|
|
////删除附件表
|
|
BLL.CommonService.DeleteAttachFileById(ConstructionStandardsList.ConstructionStandardsId);
|
|
|
|
db.Technique_ConstructionStandards.DeleteOnSubmit(ConstructionStandardsList);
|
|
db.SubmitChanges();
|
|
}
|
|
}
|
|
public class ConstructionStandardsItem
|
|
{
|
|
|
|
public string ConstructionStandardsId
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public string ConstructionStandardsCode
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public string ConstructionStandardsName
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public string AttachUrl
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public string CompileMan
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public System.Nullable<System.DateTime> CompileDate
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public System.Nullable<bool> IsPass
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public string UpState
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
public string Remark
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
}
|
|
|
|
} |