/// <summary> /// 根据ID获取参数类别 /// </summary> /// <param name="code">参数类别代码</param> /// <returns>参数类别</returns> public S_ParmTypeEntity GetParmType(string code) { S_ParmTypeAccess access = new S_ParmTypeAccess(); List <S_ParmTypeEntity> ParmTypes = access.Get("code='" + code + "'"); //某类别的参数列表 return(ParmTypes.FirstOrDefault()); }
/// <summary> /// 加载单位列表 /// </summary> /// <returns></returns> private List <S_ParmEntity> getParmUnit() { var parmTypeList = new S_ParmTypeAccess().Get("1=1"); var parmList = new S_ParmAccess().Get("1=1"); var unitList = parmList.Where(o => o.parmTypeID == parmTypeList.Where(t => t.code == "UNIT").FirstOrDefault().ID).ToList(); S_ParmEntity square = new S_ParmEntity() { parmName = "mm²/s", parmValue = "mm²/s", parmTypeID = parmTypeList.Where(t => t.code == "UNIT").FirstOrDefault().ID }; S_ParmEntity cube = new S_ParmEntity() { parmName = "g/cm³", parmValue = "g/cm³", parmTypeID = parmTypeList.Where(t => t.code == "UNIT").FirstOrDefault().ID }; unitList.Add(square); unitList.Add(cube); return(unitList); }
/// <summary> /// 根据关键字字段更新参数类别数据 /// </summary> /// <param name="item">参数类别实体</param> /// <returns>受影响的记录条数</returns> public void UpdateParmType(S_ParmTypeEntity item) { S_ParmTypeAccess access = new S_ParmTypeAccess(); access.Update(item, item.ID.ToString()); }
/// <summary> /// 根据id删除参数类别记录 /// </summary> /// <param name="id">关键字id</param> /// <returns>受影响的行数</returns> public int DeleteParmType(int id) { S_ParmTypeAccess access = new S_ParmTypeAccess(); return(access.Delete(id)); }
/// <summary> /// 插入参数类别并返回刚插入数据的id /// </summary> /// <param name="item">参数类别实体</param> /// <returns>自增的ID</returns> public int AddParmType(S_ParmTypeEntity item) { S_ParmTypeAccess access = new S_ParmTypeAccess(); return(access.Insert(item)); }
/// <summary> /// 根据ID获取参数类别 /// </summary> /// <param name="id">参数类别ID</param> /// <returns>参数类别</returns> public S_ParmTypeEntity GetParmType(int id) { S_ParmTypeAccess access = new S_ParmTypeAccess(); return(access.Get(id)); }
/// <summary> /// 获取参数类别列表 /// </summary> /// <returns>参数类别列表</returns> public List <S_ParmTypeEntity> GetParmTypes() { S_ParmTypeAccess access = new S_ParmTypeAccess(); return(access.Get("1=1")); }