Exemplo n.º 1
0
        public BaseResponse AddCourt(AddCourtRequest request)
        {
            return(ServiceProcessor.ProcessRequest(request,
                                                   //inbound.do validate or do something here
                                                   () =>
            {
            },

                                                   req =>
            {
                var response = new BaseResponse();
                using (var repo = new NhRepository <Court>())
                {
                    var entity = repo.Query(x => x.Name == req.Name).FirstOrDefault();
                    if (entity != null)
                    {
                        throw new EeException(ErrorCodes.Existed, "Object is existed.");
                    }
                    entity = new Court()
                    {
                        Name = req.Name,
                        Province = req.Province,
                        City = req.City,
                        County = req.County,
                        Address = req.Address,
                        Rank = req.Rank,
                        ContactNo = req.ContactNo,
                    };
                    repo.Create(entity);
                }
                return response;
            }
                                                   ));
        }
Exemplo n.º 2
0
        public void QueryTest()
        {
            using (var session = SessionManager.GetConnection())
            {
                using (var repo = new NhRepository <Court>())
                {
                    var query = repo.Query();

                    var list = query.ToList();
                }
            }
        }
Exemplo n.º 3
0
        public void QueryAreaTest()
        {
            using (var session = SessionManager.GetConnection())
            {
                using (var repo = new NhRepository <Area>())
                {
                    var query = repo.Query(x => x.AreaCode == "440000");

                    var list = query.ToList();
                }
            }
        }
Exemplo n.º 4
0
        public BaseQueryResponse <PropertyItemCategory> GetPropertyItemCategory(GetPropertyItemCategoryRequest request)
        {
            return(ServiceProcessor.ProcessRequest(request,
                                                   //inbound.do validate or do something here
                                                   () => { },

                                                   req =>
            {
                var response = new BaseQueryResponse <PropertyItemCategory>();
                using (var repo = new NhRepository <PropertyItemCategory>())
                {
                    var query = repo.Query().Where(x => x.Parent != null && x.Parent.Code == req.Code);

                    response.Total = query.Count();
                    response.QueryList = query.ToList();
                }
                return response;
            }
                                                   ));
        }
Exemplo n.º 5
0
        public BaseQueryResponse <Client> QueryClient(QueryClientRequest request)
        {
            return(ServiceProcessor.ProcessRequest(request,
                                                   //inbound.do validate or do something here
                                                   () =>
            {
            },

                                                   req =>
            {
                var response = new BaseQueryResponse <Client>();
                using (var repo = new NhRepository <Client>())
                {
                    var query = repo.Query();

                    response.Total = query.Count();
                    response.QueryList = query.ToList();
                }
                return response;
            }
                                                   ));
        }
Exemplo n.º 6
0
        public BaseQueryResponse <Area> GetAreas(GetAreasRequest request)
        {
            return(ServiceProcessor.ProcessRequest(request,
                                                   //inbound.do validate or do something here
                                                   () =>
            {
            },

                                                   req =>
            {
                var response = new BaseQueryResponse <Area>();
                using (var repo = new NhRepository <Area>())
                {
                    var query = repo.Query(x => x.Parent == null);

                    response.Total = query.Count();
                    response.QueryList = query.ToList();
                }
                return response;
            }
                                                   ));
        }