public static void GetNewCustomerData(NewCustomer window, Customer customer)
        {
            customer.Name = window.CustomerName.Text;
            customer.City = window.City.Text;
            customer.Address = window.Address.Text;
            customer.Phone = window.Phone.Text;
            customer.Comment = window.Comment.Text;
            customer.CustomerType = Customer.GetCustomerType(window.CustAttr.Text);

            if (customer is Firm)
            {
                Firm firm = customer as Firm;
                firm.VATNumber = window.EGN.Text;
            }
            else
            {
                Person person = customer as Person;
                person.EGN = window.EGN.Text;
                person.PersonalCardNumber = window.PCN.Text;
                person.PCNDate = window.PCNDate.SelectedDate.Value;
                person.DrivingLicense = window.DL.Text;
                person.DLDate = window.DLDate.SelectedDate.Value;
            }
        }
 private void NewClientButtonClick(object sender, RoutedEventArgs e)
 {
     NewCustomer newCustomerWindow = new NewCustomer();
     newCustomerWindow.CustAttr.SelectedIndex = 0;
     newCustomerWindow.Closing += newCustomerWindow_Closing;
     newCustomerWindow.editMode = false;
     newCustomerWindow.Firm.Visibility = UIResources.Visible;
     newCustomerWindow.ShowDialog();
 }
        public static void FillNewCustomerWindow(NewCustomer window, Customer customer)
        {
            window.CustomerName.Text = customer.Name;
            window.PersonalDataGroup.Visibility = UIResources.Visible;
            window.Phone.Text = customer.Phone;
            window.City.Text = customer.City;
            window.Address.Text = customer.Address;
            window.Comment.Text = customer.Comment;
            window.CustAttr.SelectedIndex = (int)customer.CustomerType;

            if (customer is Person)
            {
                window.PersonalDataGroup.Visibility = UIResources.Visible;
                window.TxtEGN.Text = "EGN:";
                window.EGN.Text = (customer as Person).EGN;
                window.PCN.Text = (customer as Person).PersonalCardNumber;
                window.PCNDate.Text = (customer as Person).PCNDate.ToShortDateString();
                window.DL.Text = (customer as Person).DrivingLicense;
                window.DLDate.Text = (customer as Person).DLDate.ToShortDateString();
                window.Firm.IsChecked = false;
            }
            else
            {
                window.PersonalDataGroup.Visibility = UIResources.Hidden;
                window.TxtEGN.Text = "VAT:";
                window.EGN.Text = (customer as Firm).VATNumber;
                window.Firm.IsChecked = true;
            }
        }
 private void EditClientButtonClick(object sender, RoutedEventArgs e)
 {
     NewCustomer newCustomerWindow = new NewCustomer();
     newCustomerWindow.Closing += newCustomerWindow_Closing;
     newCustomerWindow.editMode = true;
     newCustomerWindow.Firm.Visibility = UIResources.Hidden;
     WindowHelpers.FillNewCustomerWindow(newCustomerWindow, ComboBoxCustomer.SelectedItem as Customer);
     newCustomerWindow.ShowDialog();
 }