Ejemplo n.º 1
0
        private void AddNewDriver_Click(object sender, RoutedEventArgs e)
        {
            AddNewDriver dlg = new AddNewDriver();

            dlg.conn = conn;
            dlg.mode = Mode.MODE_CREATE;
            dlg.ShowDialog();
        }
Ejemplo n.º 2
0
        private void EditDriver_Click(object sender, RoutedEventArgs e)
        {
            DriverSearch dlg = new DriverSearch();

            dlg.conn = conn;
            dlg.ShowDialog();
            if (dlg.idx != null)
            {
                AddNewDriver dlg2 = new AddNewDriver();
                dlg2.conn = conn;
                dlg2.mode = Mode.MODE_UPDATE;
                dlg2.idx  = dlg.idx.Value;
                dlg2.ShowDialog();
            }
        }
        private void AddDriver_Click(object sender, RoutedEventArgs e)
        {
            AddNewDriver dlg = new AddNewDriver();

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

            try
            {
                SqlCeDataReader myReader = null;
                SqlCeCommand    command  = new SqlCeCommand("select DRV_COD, DRV_LICENSE, DRV_NAME from Driver", conn);
                myReader = command.ExecuteReader();
                while (myReader.Read())
                {
                    int    Code    = Convert.ToInt32(myReader["DRV_COD"].ToString());
                    string license = myReader["DRV_LICENSE"].ToString();
                    string name    = myReader["DRV_NAME"].ToString();
                    if (!dct_drivers.ContainsKey(license))
                    {
                        dct_drivers.Add(license, name);
                    }
                    if (!drivers.Contains(name))
                    {
                        drivers.Add(name);
                    }
                    if (!dct_drv_licen.ContainsKey(license))
                    {
                        dct_drv_licen.Add(license, Code);
                    }
                }
                myReader.Close();
                myReader.Dispose();
                comboBox1.ItemsSource = drivers;
            }
            catch (System.Exception ex)
            {
                log.Error(ex);
            }
        }