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 ActionResult GetAll()
        {
            IList list = ManagerFactory.PropertyAppropriationManager.GetAll();

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

            foreach (PropertyAppropriation o in list)
            {
                result.Add(PropertyAppropriationDTOMapper.MapToDTO(o));
            }
            return(this.Json(result));
        }
Exemplo n.º 3
0
        public ActionResult UpdateProperty(string ast_id, string DepartmentID, string ast_user,
                                           string ast_fit_reason)
        {
            var rdto = new ResultDTO();

            PropertyAppropriationDTO propertyAppropriation = new PropertyAppropriationDTO();

            propertyAppropriation.ast_id = ast_id;

            Property p = ManagerFactory.PropertyManager.GetProperty(ast_id);

            if (p.Department == null)
            {
                propertyAppropriation.DepartmentID = "99999999";
            }
            else
            {
                propertyAppropriation.DepartmentID = p.Department.DepartmentID;
            }
            if (p.ast_user == null)
            {
                propertyAppropriation.ast_from_user = "******";
            }
            else
            {
                propertyAppropriation.ast_from_user = p.ast_user;
            }
            propertyAppropriation.ast_fit_reason = ast_fit_reason;
            propertyAppropriation.ast_fit_date   = DateTime.Now.ToString();

            p.ast_user   = ast_user;
            p.Department = ManagerFactory.DepartmentManager.GetDepartment(DepartmentID);

            Model.PropertyAppropriation proApp = PropertyAppropriationDTOMapper.MapFromDTO(propertyAppropriation);
            proApp.ast_fit_date = DateTime.Now;
            try
            {
                ManagerFactory.PropertyManager.SaveProperty(p, proApp);
                rdto.Message = "更新成功";
                rdto.Result  = true;
            }
            catch
            {
                rdto.Message = "更新失败";
                rdto.Result  = false;
            }

            return(this.Json(rdto));
        }
        public ActionResult GetAllPerPage()
        {
            IList list = ManagerFactory.PropertyAppropriationManager.GetAll();

            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));
        }