Пример #1
0
 public void MenuClick()
 {
     window.hd.HideAll();
     window.OrdersGrid.Visibility = Visibility.Visible;
     if (window.currentUserLogin == "root")
     {
         window.OrdersOperationForAdminGrid.Visibility = Visibility.Visible;
     }
     else
     {
         window.OrdersOperationForManagerGrid.Visibility = Visibility.Visible;
     }
     DataGridUpdater.OrdersDataGridUpdate(window);
 }
Пример #2
0
        public void ButtonClick()
        {
            if (String.IsNullOrEmpty(window.AddOrderPrice.Text) || String.IsNullOrEmpty(window.AddOrderQuantity.Text))
            {
                MessageBox.Show("Поля не заполненны"); return;
            }

            int             detid  = -1;
            int             userid = -1;
            MySqlDataReader reader = window.ex.returnResult("select id from users where login='******'");

            if (reader == null)
            {
                return;
            }
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    userid = reader.GetInt32(0);
                }
            }
            window.ex.closeCon();
            reader = window.ex.returnResult("select iddetails from details where title='" + window.AddOrderDetailTitle.SelectedItem.ToString() + "'");
            if (reader == null)
            {
                return;
            }
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    detid = reader.GetInt32(0);
                }
            }
            window.ex.closeCon();
            window.ex.ExecuteWithoutRedaer("INSERT INTO orders(`iddetails`,`id`,`orderdate`,`quantity`,`orderprice`,`iscompleet`)VALUES(" + detid + "," + userid + ",'" + Convert.ToDateTime(window.AddOrderDate.SelectedDate).Year + "-" + Convert.ToDateTime(window.AddOrderDate.SelectedDate).Month + "-" + Convert.ToDateTime(window.AddOrderDate.SelectedDate).Day + "'," + window.AddOrderQuantity.Text + "," + window.AddOrderPrice.Text.Replace(',', '.').Replace("₴", "") + ",0)");
            window.ex.ExecuteWithoutRedaer("update details set ordered=ordered+" + window.AddOrderQuantity.Text + " where iddetails=" + detid);
            window.hd.HideAll();
            window.OrdersGrid.Visibility = Visibility.Visible;
            if (window.currentUserLogin == "root")
            {
                window.OrdersOperationForAdminGrid.Visibility = Visibility.Visible;
            }
            else
            {
                window.OrdersOperationForManagerGrid.Visibility = Visibility.Visible;
            }
            DataGridUpdater.OrdersDataGridUpdate(window);
        }
Пример #3
0
        public void ButtonClick()
        {
            DataRowView DRV = window.OrdersDataGrid.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 ordered=ordered-" + arr[5] + " where title='" + arr[1] + "'");
            }
            window.ex.ExecuteWithoutRedaer("delete from orders where idorders=" + arr[0]);

            DataGridUpdater.OrdersDataGridUpdate(window);
        }
Пример #4
0
        public void ButtonClick()
        {
            DataRowView DRV = window.OrdersDataGrid.SelectedItem as DataRowView;

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

            object[] arr = DR.ItemArray;
            if (arr[6].ToString() == "Получен")
            {
                MessageBox.Show("Заказ уже получен"); return;
            }
            window.ex.ExecuteWithoutRedaer("update details set ordered=ordered-" + arr[5] + ", storage=storage+" + arr[5] + " where title = '" + arr[1] + "'");
            window.ex.ExecuteWithoutRedaer("update orders set iscompleet=1 where idorders=" + arr[0]);
            DataGridUpdater.OrdersDataGridUpdate(window);
        }
Пример #5
0
        public void ButtonClick()
        {
            if (String.IsNullOrEmpty(window.ChangeOrderPrice.Text) || String.IsNullOrEmpty(window.ChangeOrderQuantity.Text))
            {
                MessageBox.Show("Поля не заполненны"); return;
            }

            int detid = -1;

            MySqlDataReader reader = window.ex.returnResult("select iddetails from details where title='" + window.ChangeOrderDetailTitle.Content + "'");

            if (reader == null)
            {
                return;
            }
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    detid = reader.GetInt32(0);
                }
            }
            window.ex.closeCon();
            window.ex.ExecuteWithoutRedaer("update orders set orderdate='" + Convert.ToDateTime(window.ChangeOrderDate.SelectedDate).Year + "-" + Convert.ToDateTime(window.ChangeOrderDate.SelectedDate).Month + "-" + Convert.ToDateTime(window.ChangeOrderDate.SelectedDate).Day + "',quantity=" + window.ChangeOrderQuantity.Text + ",orderprice=" + window.ChangeOrderPrice.Text.Replace(',', '.').Replace("₴", "") + " where idorders=" + window.orderIdForChange);
            window.ex.ExecuteWithoutRedaer("update details set ordered=ordered-" + window.orderQuantity + "+" + window.ChangeOrderQuantity.Text + " where iddetails=" + detid);
            window.hd.HideAll();
            window.OrdersGrid.Visibility = Visibility.Visible;
            if (window.currentUserLogin == "root")
            {
                window.OrdersOperationForAdminGrid.Visibility = Visibility.Visible;
            }
            else
            {
                window.OrdersOperationForManagerGrid.Visibility = Visibility.Visible;
            }
            DataGridUpdater.OrdersDataGridUpdate(window);
        }