private void AddCompany_Click(object sender, RoutedEventArgs e)
        {
            AddNewCompany dlg = new AddNewCompany();

            dlg.conn = conn;
            dlg.mode = Mode.MODE_CREATE;
            dlg.ShowDialog();

            try
            {
                SqlCeDataReader myReader = null;
                SqlCeCommand    command  = new SqlCeCommand("select CMP_COD, CMP_NAME from Company", conn);
                myReader = command.ExecuteReader();
                while (myReader.Read())
                {
                    int    Code = Convert.ToInt32(myReader["CMP_COD"].ToString());
                    string name = myReader["CMP_NAME"].ToString();
                    if (!companies.Contains(name))
                    {
                        companies.Add(name);
                    }
                    if (!dct_companies.ContainsKey(name))
                    {
                        dct_companies.Add(name, Code);
                    }
                }
                myReader.Close();
                myReader.Dispose();
                comboBox2.ItemsSource = companies;
            }
            catch (System.Exception ex)
            {
                log.Error(ex);
            }
        }
        private void AddCompany_Click(object sender, RoutedEventArgs e)
        {
            AddNewCompany dlg = new AddNewCompany();

            dlg.conn = conn;
            dlg.mode = Mode.MODE_CREATE;
            dlg.ShowDialog();
        }
        private void UpdateCompany_Click(object sender, RoutedEventArgs e)
        {
            CompnaySearch dlg = new CompnaySearch();

            dlg.conn = conn;
            dlg.ShowDialog();
            if (dlg.idx != null)
            {
                AddNewCompany dlg2 = new AddNewCompany();
                dlg2.conn = conn;
                dlg2.mode = Mode.MODE_UPDATE;
                dlg2.idx  = dlg.idx.Value;
                dlg2.ShowDialog();
            }
        }