예제 #1
0
        public AssetApply_Asset FindAssetById(string id)
        {
            AssetApply_Asset asset = null;

            asset = HibernateTemplate.Load(typeof(AssetApply_Asset), id) as AssetApply_Asset;
            return(asset);
        }
예제 #2
0
        public IList FindAssetsByIds(string[] ids)
        {
            // 检索指定ID集合对应的资产集合
            IList            list  = new ArrayList();
            AssetApply_Asset asset = null;

            for (int i = 0; i < ids.Length; i++)
            {
                asset = HibernateTemplate.Load(typeof(AssetApply_Asset), ids[i]) as AssetApply_Asset;
                list.Add(asset);
            }
            return(list);
        }
        /// <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);
        }
예제 #5
0
        public ActionResult SearchFreeAssets(string id, string name, string model, string spec)
        {
            AssetApply_Asset condition = new AssetApply_Asset();

            condition.AssetID     = id;
            condition.AssetName   = name;
            condition.AssetModel  = model;
            condition.AssetSpec   = spec;
            condition.AssetStatus = "0001";

            IList list = ManagerFactory.AssetApplyManager.GetAssetListByCondition(condition);

            IList <AssetApply_AssetDTO> result = new List <AssetApply_AssetDTO>();

            foreach (AssetApply_Asset o in list)
            {
                result.Add(AssetApply_AssetDTOMapper.MapToDTO(o));
            }
            return(this.Json(result));
        }
예제 #6
0
        public int DoApplyDestroy(string id, string reason)
        {
            AssetApply_Asset ast = AssetApplyDao.FindAssetById(id);

            AssetApply target = new AssetApply();

            target.AssetID      = ast.AssetID;
            target.AssetName    = ast.AssetName;
            target.AssetModel   = ast.AssetModel;
            target.AssetSpec    = ast.AssetSpec;
            target.AssetType    = ast.AssetType;
            target.AssetSubType = ast.AssetSubtype;
            target.AplDeptID    = ast.BelongingDept;
            target.AplAmount    = 1;
            target.AplType      = "0004"; //申请报废
            target.AplStatus    = "0001"; //已申请
            target.AplReason    = reason;

            return(AssetApplyDao.SaveOne(target));
        }
예제 #7
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()));
        }
예제 #8
0
 /// <summary>
 /// 根据条件检索资产
 /// </summary>
 /// <param name="condition">带有条件的资产对象</param>
 /// <returns>资产列表</returns>
 public IList GetAssetListByCondition(AssetApply_Asset condition)
 {
     return(AssetApplyDao.FindAssetsByCondition(condition));
 }