コード例 #1
0
        /*!
         * \brief This handler handles when the user clicks the "Order Status" button.
         * \details This handler brings up the order status button page.
         * \param sender <b>object</b>
         * \param e <b>RoutedEventArgs</b>
         */
        private void orderStatusBTN_Click(object sender, RoutedEventArgs e)
        {
            // Transfer to orderStatus Page
            planner_OrderStatus statusPage = new planner_OrderStatus(localUser);

            PlannerFrame.NavigationService.Navigate(statusPage);
        }
コード例 #2
0
        private void incrementTimeBTN_Click(object sender, RoutedEventArgs e)
        {
            contractParams temp = (contractParams)orderList.SelectedItem;

            temp.duration -= 24;

            if (temp.duration < 0)
            {
                temp.duration        = 0;
                temp.markedForAction = true;
            }

            string        conStr = ConfigurationManager.ConnectionStrings[localUser.CONSTR].ConnectionString;
            StringBuilder cmdSB  = new StringBuilder("UPDATE Orders SET ETA=" + temp.duration.ToString() + ", MarkedForAction=" + temp.markedForAction.ToString() + " WHERE OrderID=" + temp.orderID.ToString() + ";");

            using (MySqlConnection connection = new MySqlConnection(conStr))
            {
                MySqlCommand cmd = new MySqlCommand(cmdSB.ToString(), connection);
                try
                {
                    connection.Open();
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
            File.AppendAllText(@"Log\Log.log", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss.ff") + ": Planner incremented time for an order.\n");
            planner_OrderStatus newPage = new planner_OrderStatus(localUser);

            this.NavigationService.Navigate(newPage);
        }