public ActionResult GetByConditionPerPage(string ast_id, string DepartmentID,
                                                  string ast_from_user, string ast_fit_date)
        {
            PropertyAppropriationDTO propertyAppropriation = new PropertyAppropriationDTO();

            propertyAppropriation.ast_id        = ast_id;
            propertyAppropriation.DepartmentID  = DepartmentID;
            propertyAppropriation.ast_from_user = ast_from_user;
            propertyAppropriation.ast_fit_date  = ast_fit_date;
            PropertyAppropriation condition = PropertyAppropriationDTOMapper.MapFromDTO(propertyAppropriation);
            IList list = ManagerFactory.PropertyAppropriationManager.GetByCondition(condition);

            List <PropertyAppropriationDTO> arr    = new List <PropertyAppropriationDTO>();
            Dictionary <String, Object>     result = new Dictionary <String, Object>();
            int sIndex   = this.Request["start"] == null ? 0 : int.Parse(this.Request["start"]);
            int pageSize = this.Request["limit"] == null ? list.Count : int.Parse(this.Request["limit"]);

            for (int i = 0; i < pageSize && (i + sIndex) < list.Count; i++)
            {
                arr.Add(PropertyAppropriationDTOMapper.MapToDTO((PropertyAppropriation)list[i + sIndex]));
            }
            result.Add("rows", arr);
            result.Add("total", list.Count);
            return(this.Json(result));
        }
        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()));
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
 public void Delete(PropertyAppropriation propertyAppropriation)
 {
     HibernateTemplate.Delete(propertyAppropriation);
 }
 public PropertyAppropriation SaveOrUpdate(PropertyAppropriation propertyAppropriation)
 {
     HibernateTemplate.SaveOrUpdate(propertyAppropriation);
     return(propertyAppropriation);
 }
 public void Save(PropertyAppropriation propertyAppropriation)
 {
     HibernateTemplate.Save(propertyAppropriation);
 }
示例#8
0
 /// <summary>
 /// 保存资产
 /// </summary>
 /// <param name="property">资产实体</param>
 /// <returns></returns>
 public void SaveProperty(Property property, PropertyAppropriation propertyAppropriation)
 {
     PropertyDao.SaveOrUpdate(property);
     PropertyAppropriationDao.Save(propertyAppropriation);
 }
 public IList GetByCondition(PropertyAppropriation propertyAppropriation)
 {
     return(PropertyAppropriationDao.GetByCondition(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);
        }