private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            CustomerDto customer = new CustomerDto()
            {
                Name          = tbName.Text,
                AreaCode      = tbAreaCode.Text,
                City          = tbCity.Text,
                Country       = tbCountry.Text,
                ZipPostalCode = tbZipPostalCode.Text,
                EMail         = tbEmail.Text,
                Region        = tbRegion.Text,
                HouseNumber   = tbHouseNumber.Text,
                PhoneNumber   = tbPhoneNumber.Text,
                Street        = tbStreet.Text
            };

            if (_id == 0)
            {
                ProcessFactory.GetCustomerProcess().Add(customer);
            }
            else
            {
                customer.Id = _id;
                ProcessFactory.GetCustomerProcess().Update(customer);
            }
            Close();
        }
示例#2
0
        public SearchWindow(string status)
        {
            InitializeComponent();
            AllowArtists   = ProcessFactory.GetArtistProcess().GetList();
            AllowNations   = ProcessFactory.GetNationProcess().GetList();
            AllowCustomers = ProcessFactory.GetCustomerProcess().GetList();

            this.cbArtistCountry.ItemsSource = AllowNations;
            this.cbCustomers.ItemsSource     = AllowCustomers;

            switch (status)
            {
            case "Artist":
                this.SearchTab.SelectedIndex = 0;
                //this.sCustomer.Visibility = false;
                //this.sWork.Visibility = false;
                //this.tiInterests.Visibility = false;
                this.sTransaction.Visibility = Visibility.Collapsed;
                break;

            case "Trans":
                this.SearchTab.SelectedIndex = 1;
                this.sArtist.Visibility      = Visibility.Collapsed;
                break;
            }
        }
示例#3
0
        public static TransactionDto Convert(Transaction transaction)
        {
            if (transaction == null)
            {
                return(null);
            }
            TransactionDto transactionDto = new TransactionDto()
            {
                Id               = transaction.TransID,
                Work             = ProcessFactory.GetWorkProcess().Get(transaction.WorkID),
                AcquisitionPrice = transaction.AcquisitionPrice,
                AskingPrice      = transaction.AskingPrice,
                SalesPrice       = transaction.SalesPrice,
                DateAcquired     = transaction.DateAcquired,
                PurchaseDate     = transaction.PurchaseDate
            };

            if (transaction.CustomerID != null)
            {
                transactionDto.Customer = ProcessFactory.GetCustomerProcess().Get((int)transaction.CustomerID);
            }
            else
            {
                transactionDto.Customer = null;
            }
            return(transactionDto);
        }
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CustomerDto customerDto = new CustomerDto();
                //divisionDto.idDivision = int.Parse(tbDivisionID.Text);
                customerDto.Adress    = tbAdress.Text;
                customerDto.Info      = tbInfo.Text;
                customerDto.Name      = tbName.Text;
                customerDto.Phone     = tbPhone.Text;
                customerDto.ManagerID = int.Parse(tbManager.Text);
                ICustomerProcess cutomerProcess = ProcessFactory.GetCustomerProcess();

                if (_id == 0)
                {
                    cutomerProcess.Add(customerDto);
                }
                else
                {
                    customerDto.ID = _id;
                    cutomerProcess.Update(customerDto);
                }
                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        private void btnAddC_Click(object sender, RoutedEventArgs e)
        {
            AddCustomerWindow window = new AddCustomerWindow();

            window.ShowDialog();

            //Получаем список клиентов и передаем его на отображение таблице
            dgCustomers.ItemsSource = ProcessFactory.GetCustomerProcess().GetList();
        }
        public AddTransactionWindow()
        {
            CultureInfo ci = CultureInfo.CreateSpecificCulture(CultureInfo.CurrentCulture.Name);

            ci.DateTimeFormat.ShortDatePattern  = "dd - MM - yyyy";
            Thread.CurrentThread.CurrentCulture = ci;
            InitializeComponent();
            IList <CustomerDto> customers = ProcessFactory.GetCustomerProcess().GetList();

            Works = ProcessFactory.GetWorkProcess().GetList();
            this.cbCustomer.ItemsSource       = (from c in customers orderby c.Name select c);
            this.cbWork.ItemsSource           = (from w in Works orderby w.Title select w);
            this.dpAcuired.IsTodayHighlighted = true;
        }
        private void TabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (tiClient != null && tiClient.IsSelected)
            {
                _currentTable        = "Customer";
                dgClient.ItemsSource = ProcessFactory.GetCustomerProcess().GetList();
            }

            if (tiStore != null && tiStore.IsSelected)
            {
                _currentTable       = "Product";
                dgStore.ItemsSource = ProcessFactory.GetProductProcess().GetList();
            }

            if (tiOrder != null && tiOrder.IsSelected)
            {
                _currentTable         = "Order";
                dgRequest.ItemsSource = ProcessFactory.GetOrderProcess().GetFromManager(_currentIdManager);
            }
        }
示例#8
0
        private void btnDeleteC_Click(object sender, RoutedEventArgs e)
        {
            CustomerDto item = dgCustomer.SelectedItem as CustomerDto;

            if (item == null)
            {
                MessageBox.Show("Выберите запись для удаления", "Удаление");
                return;
            }

            MessageBoxResult result = MessageBox.Show("Вы действительно хотите это удалить?", "Удаление", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            if (result != MessageBoxResult.Yes)
            {
                return;
            }

            ProcessFactory.GetCustomerProcess().Delete(item.Id);

            Refresh_Click(sender, e);
        }
        private void btnDeleteC_Click(object sender, RoutedEventArgs e)
        {
            //Получаем выделенную строку с объектом художника
            CustomerDto item = dgCustomers.SelectedItem as CustomerDto;

            //если там не художник или пользователь ничего не выбрал сообщаем об этом
            if (item == null)
            {
                MessageBox.Show("Выберите запись для удаления", "Удаление художника");
                return;
            }
            //Просим подтвердить удаление
            MessageBoxResult result = MessageBox.Show("Удалить художника " + item.Name + "?", "Удаление художника", MessageBoxButton.YesNo, MessageBoxImage.Warning);

            //Если пользователь не подтвердил, выходим
            if (result != MessageBoxResult.Yes)
            {
                return;
            }
            //Если все проверки пройдены и подтверждение получено, удаляем художника
            ProcessFactory.GetCustomerProcess().Delete(item.CustomerID.Value);
            //И перезагружаем список художников
            btnRefresh_Click(sender, e);
        }
 private void btnRefreshC_Click(object sender, RoutedEventArgs e)
 {
     //Получаем список  и передаем его на отображение таблице
     dgCustomers.ItemsSource = ProcessFactory.GetCustomerProcess().GetList();
 }
 private void SearchCustomer(object sender, RoutedEventArgs e)
 {
     this.FindedCustomers = ProcessFactory.GetCustomerProcess().SearchCustomer(this.CustomerName.Text, this.Email.Text);
     this.exec            = true;
     this.Close();
 }
示例#12
0
 private void RefreshC_Click()
 {
     dgCustomer.ItemsSource = ProcessFactory.GetCustomerProcess().GetList();
 }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(tbName.Text))
            {
                MessageBox.Show("Имя клиента не должно быть пустым", "Проверка");
                return;
            }
            if (string.IsNullOrEmpty(tbEmail.Text))
            {
                MessageBox.Show("Email не должен быть пустым", "Проверка");
                return;
            }
            if (string.IsNullOrEmpty(tbAreaCode.Text))
            {
                MessageBox.Show("Код области не должен быть пустым", "Проверка");
                return;
            }
            if (string.IsNullOrEmpty(tbStreet.Text))
            {
                MessageBox.Show("Улица не должна быть пустой", "Проверка");
                return;
            }
            if (string.IsNullOrEmpty(tbCity.Text))
            {
                MessageBox.Show("Город не должен быть пустым", "Проверка");
                return;
            }
            if (string.IsNullOrEmpty(tbRegion.Text))
            {
                MessageBox.Show("Регион не должен быть пустым", "Проверка");
                return;
            }
            if (string.IsNullOrEmpty(tbZipPostalCode.Text))
            {
                MessageBox.Show("Почтовый индекс не должен быть пустым", "Проверка");
                return;
            }
            if (string.IsNullOrEmpty(tbCountry.Text))
            {
                MessageBox.Show("Страна не должна быть пустой", "Проверка");
                return;
            }
            if (string.IsNullOrEmpty(tbPhoneNumber.Text))
            {
                MessageBox.Show("Номер телефона не должен быть пустым", "Проверка");
                return;
            }
            CustomerDto customer = new CustomerDto();

            customer.AreaCode      = tbAreaCode.Text;
            customer.City          = tbCity.Text;
            customer.Country       = tbCountry.Text;
            customer.Email         = tbEmail.Text;
            customer.HouseNumber   = tbHouseNumber.Text;
            customer.Name          = tbName.Text;
            customer.PhoneNumber   = tbPhoneNumber.Text;
            customer.Region        = tbRegion.Text;
            customer.Street        = tbStreet.Text;
            customer.ZipPostalCode = tbZipPostalCode.Text;
            ICustomerProcess customerProcess = ProcessFactory.GetCustomerProcess();

            if (_customerid == 0)
            {
                customerProcess.Add(customer);
            }
            else
            {
                customer.CustomerID = _customerid;
                customerProcess.Update(customer);
            }
            Close();
        }