/// <summary>
        /// 从DTO到NHibernate Model对象的映射
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public static AssetApply_Asset MapFromDTO(AssetApply_AssetDTO dto)
        {
            AssetApply_Asset model = new AssetApply_Asset();

            model.AssetID = dto.AssetID;
            model.AssetName = dto.AssetName;
            model.AssetModel = dto.AssetModel;
            model.AssetSpec = dto.AssetSpec;
            model.AssetCls = dto.AssetCls;
            model.AssetStatus = dto.AssetStatus;
            model.BelongingDept = dto.BelongingDept;
            model.User = dto.User;

            return model;
        }
        /// <summary>
        /// 从NHibernate Model对象到DTO的映射
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static AssetApply_AssetDTO MapToDTO(AssetApply_Asset model)
        {
            AssetApply_AssetDTO dto = new AssetApply_AssetDTO();

            dto.AssetID = model.AssetID;
            dto.AssetName = model.AssetName;
            dto.AssetModel = model.AssetModel;
            dto.AssetSpec = model.AssetSpec;
            dto.AssetCls = model.AssetCls;
            dto.AssetStatus = model.AssetStatus;
            dto.BelongingDept = model.BelongingDept;
            dto.User = model.User;

            return dto;
        }
예제 #3
0
        public IList FindAssetsByCondition(AssetApply_Asset condition)
        {
            ArrayList param = new ArrayList(); // 定义参数列表
            // 定义HQL查询语句
            string hql = "from AssetApply_Asset a where 1=1";

            //HQL查询语句的拼接
            if (condition.AssetStatus.Trim().Length > 0)
            {
                hql += " and a.AssetStatus=?";
                param.Add(condition.AssetStatus);
            }

            if (condition.AssetID.Trim().Length > 0)
            {
                hql += " and a.AssetID like ?";
                param.Add("%" + condition.AssetID + "%");
            }

            if (condition.AssetName.Trim().Length > 0)
            {
                hql += " and a.AssetName like ?";
                param.Add("%" + condition.AssetName + "%");
            }

            if (condition.AssetModel.Trim().Length > 0)
            {
                hql += " and a.AssetModel like ?";
                param.Add("%" + condition.AssetModel + "%");
            }

            if (condition.AssetSpec.Trim().Length > 0)
            {
                hql += " and a.AssetSpec like ?";
                param.Add("%" + condition.AssetSpec + "%");
            }

            return HibernateTemplate.Find(hql, param.ToArray());
        }
예제 #4
0
 /// <summary>
 /// 根据条件检索资产
 /// </summary>
 /// <param name="condition">带有条件的资产对象</param>
 /// <returns>资产列表</returns>
 public IList GetAssetListByCondition(AssetApply_Asset condition)
 {
     return AssetApplyDao.FindAssetsByCondition(condition);
 }