コード例 #1
0
        public void ShowExtendedInfoAboutClients()
        {
            var allInfo = from info in operations.GetClientFields()
                          join confInfo in clientConfidentialFields.GetClientConfidentialFields()
                          on info.ID equals confInfo.ID
                          join manager in operations.GetEmployeeFields()
                          on info.Manager equals manager.ID
                          select new
            {
                ClientID       = info.ID,
                ClientName     = info.Name,
                ClientSurname  = info.Surname,
                ClientBirthday = info.Birthday,
                ClientPhone    = info.Phone,
                Balance        = confInfo.Balance,
                Credit         = confInfo.Credit,
                Deposit        = confInfo.Deposit,
                ManagerName    = manager.Name,
                ManagerSurname = manager.Surname
            };

            foreach (var item in allInfo)
            {
                Console.WriteLine($"\nId - {item.ClientID}, Имя - {item.ClientName}, Фамилия - {item.ClientSurname}\n" +
                                  $"Дата Рождения - {item.ClientBirthday}, Телефон - {item.ClientPhone}\n" +
                                  $"Баланс - {item.Balance}, Кредит - {item.Credit}, Депозит - {item.Deposit}" +
                                  $"\nМенеджер - {item.ManagerName} {item.ManagerSurname}\n");
                Console.WriteLine(new string('-', 50));
            }
        }
コード例 #2
0
        private List <CreateClient> GetAdditionalInfo()
        {
            DBClientConfidentialFields confidentialFields = new DBClientConfidentialFields();

            List <CreateClient> list = new List <CreateClient>();

            int     infoID   = 0;
            decimal balance  = 0;
            decimal credit   = 0;
            decimal deposit  = 0;
            string  password = null;

            foreach (var item in confidentialFields.GetClientConfidentialFields())
            {
                infoID = item.ID + 1;
            }

            CheckCorrectInput("Сумма на счету", out balance);
            CheckCorrectInput("Сумма кредита", out credit);
            CheckCorrectInput("Сумма депозита", out deposit);

            Console.Write("Пароль для входа - ");
            password = Console.ReadLine();

            this.infoID   = infoID;
            this.balance  = balance;
            this.credit   = credit;
            this.deposit  = deposit;
            this.password = password;

            list.Add(new CreateClient(InfoID, Balance, Credit, Deposit, Password));

            return(list);
        }
コード例 #3
0
        public List <ClientAllData> AddAllClientInfo()
        {
            DBOperations operations = new DBOperations();
            DBClientConfidentialFields   clientConfidentialFields   = new DBClientConfidentialFields();
            DBEmployeeConfidentialFields employeeConfidentialFields = new DBEmployeeConfidentialFields();

            var allInfo = from mainFields in operations.GetClientFields()
                          join confFields in clientConfidentialFields.GetClientConfidentialFields()
                          on mainFields.ID equals confFields.ID

                          join myManager in operations.GetEmployeeFields()
                          on mainFields.Manager equals myManager.ID

                          join managerInfo in employeeConfidentialFields.GetEmployeeConfidentialFields()
                          on myManager.ID equals managerInfo.ID

                          select new
            {
                ClientID       = mainFields.ID,
                ClientName     = mainFields.Name,
                ClientSurname  = mainFields.Surname,
                ClientBirthday = mainFields.Birthday,
                ClientPhone    = mainFields.Phone,
                InfoID         = confFields.ID,
                Balance        = confFields.Balance,
                Credit         = confFields.Credit,
                Deposit        = confFields.Deposit,
                Password       = confFields.Password,
                ManagerName    = myManager.Name,
                ManagerSurname = myManager.Surname,
                ManagerPhone   = myManager.Phone,
            };

            List <ClientAllData> list = new List <ClientAllData>();

            foreach (var item in allInfo)
            {
                list.Add(new ClientAllData(item.ClientID, item.ClientName, item.ClientSurname,
                                           item.ClientBirthday, item.ClientPhone, item.InfoID, item.Balance,
                                           item.Credit, item.Deposit, item.Password, item.ManagerName,
                                           item.ManagerSurname, item.ManagerPhone));
            }

            return(list);
        }