public void ButtonClick()
        {
            DataRowView DRV = window.MalfunctionsDataGrid.SelectedItem as DataRowView;

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

            object[]        arr    = DR.ItemArray;
            MySqlDataReader reader = window.ex.returnResult("select recordid from repairorders_malfunctions where idmalfunctions=" + arr[0]);

            if (reader == null)
            {
                return;
            }
            if (reader.HasRows)
            {
                window.ex.closeCon(); MessageBox.Show("Невозможно удалить запись"); return;
            }
            window.ex.closeCon();
            window.ex.ExecuteWithoutRedaer("delete from malfunctions where idmalfunctions=" + arr[0]);
            window.ex.ExecuteWithoutRedaer("delete from malfunctions_causes where idmalfunctions=" + arr[0]);
            window.ex.ExecuteWithoutRedaer("delete from malfunctions_details where idmalfunctions=" + arr[0]);


            DataGridUpdater.MalfunctionsDataGridUpdate(window);
        }
Beispiel #2
0
        public void ButtonClick()
        {
            if (String.IsNullOrEmpty(window.AddMalfunctionTitle.Text))
            {
                MessageBox.Show("Поля не заполнены"); return;
            }
            int             idtype = 1;
            MySqlDataReader reader = window.ex.returnResult("select idmalfunctions from malfunctions where title='" + window.AddMalfunctionTitle.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.AddMalfunctionTypeOfDevice.SelectedItem.ToString() + "'");
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    idtype = reader.GetInt32(0);
                }
            }
            window.ex.closeCon();
            window.ex.ExecuteWithoutRedaer("INSERT INTO malfunctions(title,idtypes)VALUES('" + window.AddMalfunctionTitle.Text + "'," + idtype + ")");
            window.hd.HideAll();
            window.MalfunctionsGrid.Visibility = Visibility.Visible;
            DataGridUpdater.MalfunctionsDataGridUpdate(window);
        }
Beispiel #3
0
        public void ButtonClick()
        {
            if (String.IsNullOrEmpty(window.ChangeMalfunctionTitle.Text))
            {
                MessageBox.Show("Поля не заполнены"); return;
            }
            int             idtype = 1;
            MySqlDataReader reader = window.ex.returnResult("select idmalfunctions from malfunctions where title='" + window.ChangeMalfunctionTitle.Text + "'");

            if (reader == null)
            {
                return;
            }
            if (reader.HasRows && window.ChangeMalfunctionTitle.Text != window.unChangeMalfunctionTitle)
            {
                MessageBox.Show("Такая неисправность уже добавлена"); window.ex.closeCon(); return;
            }
            window.ex.closeCon();
            reader = window.ex.returnResult("select idtypes from typeofdevices where title='" + window.ChangeMalfunctionTypeOfDevice.SelectedItem.ToString() + "'");
            if (reader == null)
            {
                return;
            }
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    idtype = reader.GetInt32(0);
                }
            }
            window.ex.closeCon();
            window.ex.ExecuteWithoutRedaer("update malfunctions set title='" + window.ChangeMalfunctionTitle.Text + "',idtypes=" + idtype + " where idmalfunctions=" + window.malfunctionIdForChange);
            window.hd.HideAll();
            window.MalfunctionsGrid.Visibility = Visibility.Visible;
            DataGridUpdater.MalfunctionsDataGridUpdate(window);
        }
Beispiel #4
0
 public void MenuClick()
 {
     window.hd.HideAll();
     window.MalfunctionsGrid.Visibility = Visibility.Visible;
     DataGridUpdater.MalfunctionsDataGridUpdate(window);
 }