Exemplo n.º 1
0
        public void ButtonClick()
        {
            DataRowView DRV = window.DevicesDataGrid.SelectedItem as DataRowView;

            if (DRV == null)
            {
                MessageBox.Show("Удаление прервано, Вы не выбрали запись для удаления."); return;
            }
            DataRow DR = DRV.Row;

            object[]        arr    = DR.ItemArray;
            MySqlDataReader reader = window.ex.returnResult("select idrepairorders from repairorders where iddevices=" + arr[0]);

            if (reader == null)
            {
                return;
            }
            if (reader.HasRows)
            {
                window.ex.closeCon(); MessageBox.Show("Невозможно удалить запись"); return;
            }
            window.ex.closeCon();

            window.ex.ExecuteWithoutRedaer("delete from devices where iddevices=" + arr[0]);
            window.ex.ExecuteWithoutRedaer("delete from devices_details where iddevices=" + arr[0]);

            DataGridUpdater.DevicesDataGridUpdate(window);
        }
Exemplo n.º 2
0
        public void ButtonClick()
        {
            if (String.IsNullOrEmpty(window.AddDeviceTitle.Text))
            {
                MessageBox.Show("Поля не заполнены"); return;
            }
            int             idtype = 1;
            MySqlDataReader reader = window.ex.returnResult("select iddevices from devices where title='" + window.AddDeviceTitle.Text + "'");

            if (reader == null)
            {
                return;
            }
            if (reader.HasRows)
            {
                MessageBox.Show("Такое устройство уже добавлено"); window.ex.closeCon(); return;
            }
            window.ex.closeCon();
            reader = window.ex.returnResult("select idtypes from typeofdevices where title='" + window.AddDeviceTypeOfDevice.SelectedItem.ToString() + "'");
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    idtype = reader.GetInt32(0);
                }
            }
            window.ex.closeCon();
            window.ex.ExecuteWithoutRedaer("INSERT INTO devices(title,idtypes)VALUES('" + window.AddDeviceTitle.Text + "'," + idtype + ")");
            window.hd.HideAll();
            window.DevicesGrid.Visibility = Visibility.Visible;
            DataGridUpdater.DevicesDataGridUpdate(window);
        }
Exemplo n.º 3
0
 public void MenuClick()
 {
     window.hd.HideAll();
     window.DevicesGrid.Visibility = Visibility.Visible;
     DataGridUpdater.DevicesDataGridUpdate(window);
 }