Exemple #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;
            }
                                                   ));
        }
Exemple #2
0
        public void QueryTest()
        {
            using (var session = SessionManager.GetConnection())
            {
                using (var repo = new NhRepository <Court>())
                {
                    var query = repo.Query();

                    var list = query.ToList();
                }
            }
        }
Exemple #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();
                }
            }
        }
Exemple #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;
            }
                                                   ));
        }
Exemple #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;
            }
                                                   ));
        }
Exemple #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;
            }
                                                   ));
        }