public IList GetByCondition(PropertyAppropriation propertyAppropriation)
 {
     ArrayList param = new ArrayList();
     string queryStr = "from PropertyAppropriation t where 1=1";
     if (!string.IsNullOrEmpty(propertyAppropriation.ast_id))
     {
         queryStr += " and t.ast_id=?";
         param.Add(propertyAppropriation.ast_id);
     }
     if (propertyAppropriation.Department != null)
     {
         queryStr += " and t.Department = ?";
         param.Add(propertyAppropriation.Department.DepartmentID);
     }
     if (!string.IsNullOrEmpty(propertyAppropriation.ast_from_user))
     {
         queryStr += " and t.ast_from_user like ?";
         param.Add("%" + propertyAppropriation.ast_from_user  + "%");
     }
     if (propertyAppropriation.ast_fit_date != propertyAppropriation.ast_fit_default_date )
     {
         DateTime dtTemp = propertyAppropriation.ast_fit_date.AddDays(1);
         queryStr += " and t.ast_fit_date >= ? and t.ast_fit_date < ?";
         param.Add(propertyAppropriation.ast_fit_date);
         param.Add(dtTemp);
     }
     return HibernateTemplate.Find(queryStr, param.ToArray());
 }
 public static PropertyAppropriationDTO MapToDTO(PropertyAppropriation model)
 {
     PropertyAppropriationDTO dto = new PropertyAppropriationDTO();
     dto.ast_main_id = model.ast_main_id;
     dto.ast_id = model.ast_id;
     dto.DepartmentID = model.Department == null ? "" : model.Department.DepartmentID;
     dto.DepartmentName = model.Department == null ? "" : model.Department.DepartmentName;
     dto.ast_from_user = model.ast_from_user;
     dto.ast_fit_date = model.ast_fit_date.ToString("yyyy/MM/dd");
     dto.ast_fit_reason = model.ast_fit_reason;
     return dto;
 }
 public static PropertyAppropriation MapFromDTO(PropertyAppropriationDTO dto)
 {
     PropertyAppropriation propertyAppropriation = new PropertyAppropriation();
     propertyAppropriation.ast_main_id = dto.ast_main_id;
     propertyAppropriation.ast_id  = dto.ast_id ;
     propertyAppropriation.Department = dto.DepartmentID == null ? null : ManagerFactory.DepartmentManager.GetDepartment(dto.DepartmentID);
     propertyAppropriation.ast_from_user = dto.ast_from_user;
     if (!string.IsNullOrEmpty(dto.ast_fit_date))
     {
         propertyAppropriation.ast_fit_date = DateTime.Parse(dto.ast_fit_date);
     }
     propertyAppropriation.ast_fit_reason = dto.ast_fit_reason;
     return propertyAppropriation;
 }
Esempio n. 4
0
 /// <summary>
 /// 保存资产
 /// </summary>
 /// <param name="property">资产实体</param>
 /// <returns></returns>
 public void SaveProperty(Property property,PropertyAppropriation propertyAppropriation)
 {
     PropertyDao.SaveOrUpdate(property);
     PropertyAppropriationDao.Save(propertyAppropriation);
 }
 public PropertyAppropriation SaveOrUpdate(PropertyAppropriation propertyAppropriation)
 {
     HibernateTemplate.SaveOrUpdate(propertyAppropriation);
     return propertyAppropriation;
 }
 public void Save(PropertyAppropriation propertyAppropriation)
 {
     HibernateTemplate.Save(propertyAppropriation);
 }
 public void Delete(PropertyAppropriation propertyAppropriation)
 {
     HibernateTemplate.Delete(propertyAppropriation);
 }
 private void Validate(PropertyAppropriation propertyAppropriation)
 {
     //TODO throw exception on error.
 }
 /// <summary>
 /// 更新资产调拨
 /// </summary>
 /// <param name="propertyAppropriation">资产调拨实体</param>
 /// <returns></returns>
 public PropertyAppropriation UpdatePropertyAppropriation(PropertyAppropriation propertyAppropriation)
 {
     return PropertyAppropriationDao.SaveOrUpdate(propertyAppropriation);
 }
 /// <summary>
 /// 保存资产调拨
 /// </summary>
 /// <param name="propertyAppropriation">资产调拨实体</param>
 /// <returns></returns>
 public void SavePropertyAppropriation(PropertyAppropriation propertyAppropriation)
 {
     PropertyAppropriationDao.Save(propertyAppropriation);
 }
 /// <summary>
 /// 创建资产调拨
 /// </summary>
 /// <returns></returns>
 public PropertyAppropriation NewPropertyAppropriation()
 {
     var propertyAppropriation = new PropertyAppropriation();
     return propertyAppropriation;
 }
 public IList GetByCondition(PropertyAppropriation propertyAppropriation)
 {
     return PropertyAppropriationDao.GetByCondition(propertyAppropriation);
 }