Exemple #1
0
        public ListModel <Contract> List([FromBody] ListQueryModel <ContractListQueryModel> listQuery)
        {
            if (listQuery == null)
            {
                listQuery = new ListQueryModel <ContractListQueryModel>();
            }
            if (listQuery.Model == null)
            {
                listQuery.Model = new ContractListQueryModel();
            }

            listQuery.Model.OwnerIds = listQuery.Model.ClientId.HasValue
                ? _memberRepository.Groups(_sessionContext.UserId, null).Where(g => g.Type == GroupType.Branch).Select(b => b.Id).ToArray()
                : new int[] { _branchContext.Branch.Id };

            if (listQuery.Model.EndDate.HasValue)
            {
                listQuery.Model.EndDate = listQuery.Model.EndDate.Value.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
            }

            return(new ListModel <Contract>
            {
                List = _repository.List(listQuery, listQuery.Model),
                Count = _repository.Count(listQuery, listQuery.Model)
            });
        }
        static void ShowContracts()
        {
            var contracts = new ContractRepository().GetAll();

            Console.CursorLeft = 0;
            Console.CursorTop  = 0;
            foreach (var contract in contracts)
            {
                Console.WriteLine(contract.ToString());
            }
            Console.WriteLine(contracts.Count());
        }
Exemple #3
0
        static void ShowContracts()
        {
            var contracts = new ContractRepository().GetAll();
            ProjectRepository projectRepository = new ProjectRepository();

            Console.WriteLine("************************************");
            //Console.CursorLeft = 0;
            //Console.CursorTop = 0;
            foreach (var contract in contracts)
            {
                Console.WriteLine("Contract №{0}", contract.id);
                Console.WriteLine("  Client's name: {0}", new ClientRepository().GetItem(contract.clientId).name);
                Console.WriteLine("  Builder's name: {0}", new BuilderRepository().GetItem(contract.builderId).name);
                Console.WriteLine("  Agent's name: {0}", new AgentRepository().GetItem(contract.agentId).name);
                Console.WriteLine("  Project's name: {0}", projectRepository.GetItem(contract.projectId).name);
                Console.WriteLine("  Project's deadLine: {0}", projectRepository.GetItem(contract.projectId).deadLine);
            }
            Console.WriteLine(contracts.Count());
        }
 static void ShowContracts()
 {
     var contracts = new ContractRepository().GetAll();
     Console.CursorLeft = 0;
     Console.CursorTop = 0;
     foreach (var contract in contracts)
     {
         Console.WriteLine(contract.ToString());
     }
     Console.WriteLine(contracts.Count());
 }
 static void ShowContracts()
 {
     var contracts = new ContractRepository().GetAll();
     ProjectRepository projectRepository = new ProjectRepository();
     Console.WriteLine("************************************");
     //Console.CursorLeft = 0;
     //Console.CursorTop = 0;
     foreach (var contract in contracts)
     {
         Console.WriteLine("Contract №{0}", contract.id);
         Console.WriteLine("  Client's name: {0}", new ClientRepository().GetItem(contract.clientId).name);
         Console.WriteLine("  Builder's name: {0}", new BuilderRepository().GetItem(contract.builderId).name);
         Console.WriteLine("  Agent's name: {0}", new AgentRepository().GetItem(contract.agentId).name);
         Console.WriteLine("  Project's name: {0}", projectRepository.GetItem(contract.projectId).name);
         Console.WriteLine("  Project's deadLine: {0}", projectRepository.GetItem(contract.projectId).deadLine);
     }
     Console.WriteLine(contracts.Count());
 }