public void MenuClick()
 {
     window.hd.HideAll();
     window.DetailsGrid.Visibility = Visibility.Visible;
     if (window.currentUserLogin == "root")
     {
         window.DetailsOperationForAdminGrid.Visibility = Visibility.Visible;
     }
     else
     {
         window.DetailsOperationForManagerGrid.Visibility = Visibility.Visible;
     }
     window.filter.sql = "select * from details";
     window.filter.CreateDetailsFiltr(window.FilterDetailsGridAdmin);
     DataGridUpdater.DetailsDataGridUpdate(window, window.filter.sql);
 }
Пример #2
0
        public void ButtonClick()
        {
            DataRowView DRV = window.DetailsDataGrid.SelectedItem as DataRowView;

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

            object[]        arr    = DR.ItemArray;
            MySqlDataReader reader = window.ex.returnResult("select idorders from orders where iddetails=" + arr[0]);

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

            DataGridUpdater.DetailsDataGridUpdate(window, window.filter.sql);
        }
Пример #3
0
        public void ButtonClick()
        {
            DataRowView DRV = window.DetailsDataGrid.SelectedItem as DataRowView;

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

            object[] arr = DR.ItemArray;
            if (arr[6].ToString() == "Важная")
            {
                window.ex.ExecuteWithoutRedaer("UPDATE details SET isimportant = 0 WHERE iddetails =" + arr[0]);
            }
            else
            {
                window.ex.ExecuteWithoutRedaer("UPDATE details SET isimportant = 1 WHERE iddetails =" + arr[0]);
            }
            DataGridUpdater.DetailsDataGridUpdate(window, window.filter.sql);
        }
Пример #4
0
        public void ButtonClick()
        {
            if (String.IsNullOrEmpty(window.ChangeDetTitle.Text) || String.IsNullOrEmpty(window.ChangeDetPrice.Text) || String.IsNullOrEmpty(window.ChangeDetStorage.Text) || String.IsNullOrEmpty(window.ChangeDetSaled.Text))
            {
                MessageBox.Show("Поля не заполнены"); return;
            }
            MySqlDataReader reader = window.ex.returnResult("select iddetails from details where title='" + window.ChangeDetTitle.Text + "'");

            if (reader == null)
            {
                return;
            }
            if (reader.HasRows && window.unChangeDetailTitle != window.ChangeDetTitle.Text)
            {
                MessageBox.Show("Такая деталь уже добавленна"); window.ex.closeCon(); return;
            }
            window.ex.closeCon();
            int i = 0;

            if (window.ChangeDetIsImportant.IsChecked == true)
            {
                i = 1;
            }
            window.ex.ExecuteWithoutRedaer("UPDATE details SET `title` ='" + window.ChangeDetTitle.Text + "',`storage` = " + window.ChangeDetStorage.Text + ",`ordered` = 0,`saled` = " + window.ChangeDetSaled.Text + ",`price` = " + window.ChangeDetPrice.Text.Replace(',', '.').Replace("₴", "") + ",`isimportant` = " + i + " WHERE `iddetails` = " + window.detailIdForChange);
            window.hd.HideAll();
            window.DetailsGrid.Visibility = Visibility.Visible;
            if (window.currentUserLogin == "root")
            {
                window.DetailsOperationForAdminGrid.Visibility = Visibility.Visible;
            }
            else
            {
                window.DetailsOperationForManagerGrid.Visibility = Visibility.Visible;
            }
            DataGridUpdater.DetailsDataGridUpdate(window, window.filter.sql);
        }
 public void ButtonClick()
 {
     window.filter.ApplyDetailsFiltr();
     DataGridUpdater.DetailsDataGridUpdate(window, window.filter.sql);
 }