コード例 #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (clickCounter == 0 && ctrlShipping.Execute() == true)         // shipping type
            {
                button1.Visibility = Visibility.Visible;

                shipment = ctrlShipping.GetShipment();
                ctrlShipping.Visibility = Visibility.Hidden;
                clickCounter = 1;

                ctrlAddress.Visibility = Visibility.Visible;
            }
            else if (clickCounter == 1 && ctrlAddress.Execute() == true)    // address 
            {
                address = ctrlAddress.GetAddress();
                ctrlAddress.Visibility = Visibility.Hidden;
                clickCounter = 2;

                ctrlPayment.Visibility = Visibility.Visible;
                button.Content = "Buy";
            }
            else if (clickCounter == 2 && ctrlPayment.Execute() == true)    // payment
            {
                payment = ctrlPayment.GetPayment();
                Buy();
            }
 
        }
コード例 #2
0
        public void Init(DatabaseConnection conn)
        {
            this.conn = conn;
            shipmnetsList = new List<Shipment>();

            List<string> list = conn.ReadData("select ID, Name, Price from Shipping_methods");
            for (int i = 0; i < list.Count; i += 3)
            {
                decimal result = decimal.Parse(list[i + 2], CultureInfo.InvariantCulture);
                Shipment s = new Shipment(Convert.ToInt32(list[i]), list[i + 1], result);
                shipmnetsList.Add(s);
            }
            foreach (Shipment s in shipmnetsList)
                comboBox.Items.Add(s.Name);
        }
コード例 #3
0
        public wndw_Product_Buy(DatabaseConnection conn, string username, List<Items> itemList, string sum, cartBox cB)
        {
            InitializeComponent();
            this.conn = conn;
            this.username = username;
            this.itemList = itemList;
            this.sum = sum;
            this.cB = cB;

            ctrlShipping.Init(conn);

            ctrlAddress.Visibility = Visibility.Hidden;
            ctrlPayment.Visibility = Visibility.Hidden;
            button1.Visibility = Visibility.Hidden;

            payment = null;
            address = null;
            shipment = null;

            clickCounter = 0;
        }