Esempio n. 1
0
        /// Нажатие клавиши "Создать"
        /// Создаёт в таблице запись Cards и Clients
        /// Связывает записи Cards и Clients
        /// Связывает Клиента с его реферером (не закончено)
        private async void button_Create_Click(object sender, RoutedEventArgs e)
        {
            {
                Cards card = new Cards();

                await oCardsRepository.Insert_Cards_Async(card);

                Clients client = new Clients(textbox_Full_Name.Text, textbox_Address.Text, textbox_Phone_Number.Text, textbox_Email.Text, card.cards_id);

                /*
                 * if (!String.IsNullOrWhiteSpace(textbox_Referer_Number.Text))
                 * {
                 *  List<Clients> lClients = await oClientsRepository.Select_All_Clients_Async();
                 *
                 *  foreach (var c in lClients)
                 *  {
                 *      if (c.referal_number.StartsWith(textbox_Referer_Number.Text))
                 *      {
                 *          client.referer_id = c.clients_id;
                 *
                 *          break;
                 *      }
                 *  }
                 * }
                 */

                await oClientsRepository.Insert_Clients_Async(client);

                await Update_ListView();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Создание новой записи
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void button_Create_Click(object sender, RoutedEventArgs e)
        {
            Cards card = new Cards();
            await oCardsRepository.Insert_Cards_Async(card);

            Clients client = new Clients(textbox_full_name.Text, textbox_phone_number.Text, textbox_email.Text, textbox_referer_number.Text, card.cards_id);
            await oClientsRepository.Insert_Clients_Async(client);


            await Update_Grid_View();
            await Update_ListBox_View();

            Clear_Controls();
        }