コード例 #1
0
 private void btnSetTime_Click(object sender, EventArgs e)
 {
     using (dialogChangePrice d = new dialogChangePrice(':', "Set Time", "Clear", lblDeliverTime.Text))
     {
         if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             lblDeliverTime.Text = d.newData;
         }
     }
 }
コード例 #2
0
 private void btnChangePrice_Click(object sender, EventArgs e)
 {
     if (dgvOrder.SelectedRows.Count > 0)
     {
         decimal price = Convert.ToDecimal(dgvOrder.SelectedRows[0].Cells[5].Value) / Convert.ToDecimal(dgvOrder.SelectedRows[0].Cells[1].Value);
         using (dialogChangePrice d = new dialogChangePrice('.', "Change Price", null, price.ToString()))
         {
             if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 dgvOrder.SelectedRows[0].Cells[5].Value = Convert.ToDecimal(d.newData) * Convert.ToDecimal(dgvOrder.SelectedRows[0].Cells[1].Value);
                 lblTotal.Text = "£ " + calculateTotal().ToString();
             }
         }
     }
 }
コード例 #3
0
        private void txtDeliverFee_Click(object sender, EventArgs e)
        {
            using (dialogChangePrice d = new dialogChangePrice('.', "Change Delivery Fee", null, txtDeliverFee.Text))
            {
                if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    txtDeliverFee.Text = d.newData;
                }
            }

            if (!string.IsNullOrEmpty(txtDeliverFee.Text))
            {
                lblTotal.Text = calculateTotal().ToString();
            }
        }
コード例 #4
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     using (dialogChangePrice d = new dialogChangePrice(' ', "Search Dish", "Clear", ""))
     {
         if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             using (SqlConnection sqlCon = new SqlConnection(connectionString))
             {
                 sqlCon.Open();
                 SqlDataAdapter getCategory     = new SqlDataAdapter("SELECT Id, foodName, foodOtherName, price FROM FoodMenu WHERE Id LIKE '" + d.newData + "%'", sqlCon);
                 DataSet        categoryDataSet = new DataSet();
                 getCategory.Fill(categoryDataSet);
                 sqlCon.Close();
                 dgvFood.DataSource = categoryDataSet.Tables[0];
             }
         }
     }
 }