Exemple #1
0
        /// <summary>
        /// Удаление
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButDelete_Click(object sender, RoutedEventArgs e)
        {
            SQLDataBase dataBase = new SQLDataBase();

            if (TabItemNatural.IsSelected)
            {
                if (list_natural_clients.SelectedItem != null)
                {
                    var temp = list_natural_clients.SelectedItem as SimpleNaturalClient;
                    Bank.Remove(list_natural_clients.SelectedItem);
                    dataBase.sql_delete(temp);
                }
            }
            else if (TabItemLegal.IsSelected)
            {
                if (list_legal_clients.SelectedItem != null)
                {
                    var temp = list_legal_clients.SelectedItem as SimpleLegalEnity;
                    Bank.Remove(list_legal_clients.SelectedItem);
                    dataBase.sql_delete(temp);
                }
            }
            else if (TabItemVip.IsSelected)
            {
                if (list_vip_legal_clients.SelectedItem != null)
                {
                    var temp = list_vip_legal_clients.SelectedItem as VipLegalEnity;
                    Bank.Remove(list_vip_legal_clients.SelectedItem);
                    dataBase.sql_delete(temp);
                }

                else if (list_vip_Natural_clients.SelectedItem != null)
                {
                    var temp = list_vip_Natural_clients.SelectedItem as VipNaturalClient;
                    Bank.Remove(list_vip_Natural_clients.SelectedItem);
                    dataBase.sql_delete(temp);
                }
            }
            Update();
        }