private void bCancel_Click(object sender, RoutedEventArgs e)
        {
            ContragentInfoForm contragentInfo = new ContragentInfoForm();

            contragentInfo.tbComName.Text = tbComName.Text;
            contragentInfo.Show();
            this.Hide();
        }
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            ContragentInfoForm contragentInfo = new ContragentInfoForm();

            contragentInfo.tbComName.Text = tbComName.Text;
            contragentInfo.Show();
            this.Hide();
        }
示例#3
0
        private void lbComName_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            ContragentInfoForm contragentInfo = new ContragentInfoForm();

            //if id return Company Name
            if (rbIdACS.IsChecked == true)
            {
                contragentInfo.tbComName.Text = lbComName.SelectedItem.ToString();
            }
            //if Name(ACS) return Company Name
            if (rbNameACS.IsChecked == true)
            {
                contragentInfo.tbComName.Text = lbComName.SelectedItem.ToString();
            }
            //if Name(DESC) return Company Name
            if (rbNameDESC.IsChecked == true)
            {
                contragentInfo.tbComName.Text = lbComName.SelectedItem.ToString();
            }
            contragentInfo.Show();
        }
        private void bSave_Click(object sender, RoutedEventArgs e)
        {
            ContragentInfoForm contragentInfo = new ContragentInfoForm();

            //update Company Short Name
            command = new SQLiteCommand("update Company set CompanyShortName = '" + tbShortName.Text.ToUpper() + "' where Company.CompanyName = '" +
                                        tbComName.Text + "'", connection);
            try
            {
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    tbShortName.Text = dataReader["CompanyShortName"].ToString();
                }
                if (tbShortName.Text == "")
                {
                    tbShortName.Text = "Данні відсутні";
                }
            }
            catch (SQLiteException ex)
            {
                MessageBox.Show(ex.Message, Application.ResourceAssembly.GetName().Name, MessageBoxButton.OK, MessageBoxImage.Error);
                contragentInfo.Show();
                this.Hide();
            }

            //update Boss
            command = new SQLiteCommand("update Company set Boss = '" + tbBoss.Text.ToUpper() + "' where Company.CompanyName = '" +
                                        tbComName.Text + "'", connection);
            try
            {
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    tbBoss.Text = dataReader["CompanyShortName"].ToString();
                }
                if (tbBoss.Text == "")
                {
                    tbBoss.Text = "Данні відсутні";
                }
            }
            catch (SQLiteException ex)
            {
                MessageBox.Show(ex.Message, Application.ResourceAssembly.GetName().Name, MessageBoxButton.OK, MessageBoxImage.Error);
                contragentInfo.Show();
                this.Hide();
            }

            //update Kved
            command = new SQLiteCommand("update Company set Kved = '" + tbKVED.Text + "' where Company.CompanyName = '" +
                                        tbComName.Text + "'", connection);
            try
            {
                dataReader = command.ExecuteReader();
                while (dataReader.Read())
                {
                    tbKVED.Text = dataReader["CompanyShortName"].ToString();
                }
                if (tbKVED.Text == "")
                {
                    tbKVED.Text = "Данні відсутні";
                }
            }
            catch (SQLiteException ex)
            {
                MessageBox.Show(ex.Message, Application.ResourceAssembly.GetName().Name, MessageBoxButton.OK, MessageBoxImage.Error);
                contragentInfo.Show();
                this.Hide();
            }

            MessageBox.Show("Дані успішно змінені", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
            contragentInfo.tbComName.Text = tbComName.Text;
            contragentInfo.Show();
            this.Hide();
        }