Exemple #1
0
        public MShopClient()
        {
            InitializeComponent();

            using (MusicShopWebServiceClient service = new MusicShopWebServiceClient())
            {
                categories[] catData      = service.getAllCategories();
                users[]      usersData    = service.getAllUsers();
                products[]   productsData = service.getAllProducts();

                comboBoxCategories.Items.Clear();
                userComboBox.Items.Clear();
                productComboBox.Items.Clear();
                foreach (categories c in catData)
                {
                    comboBoxCategories.Items.Add(c.catName);
                }

                foreach (users u in usersData)
                {
                    userComboBox.Items.Add(u.usrLogin);
                }

                foreach (products p in productsData)
                {
                    productComboBox.Items.Add(p.prdName);
                }
            }
        }
Exemple #2
0
 private void button2_Click(object sender, EventArgs e)
 {
     using (MusicShopWebServiceClient service = new MusicShopWebServiceClient())
     {
         service.removeProduct(int.Parse(productIdListBox.Text));
     }
 }
Exemple #3
0
        private void showOrdersButton_Click(object sender, EventArgs e)
        {
            using (MusicShopWebServiceClient service = new MusicShopWebServiceClient())
            {
                orders[] data = service.getAllOrders();

                listBoxOrders.Items.Clear();
                foreach (orders o in data)
                {
                    string isPaidDesc;
                    if (o.ordIsPaid.Equals("Y"))
                    {
                        isPaidDesc = "opłacone";
                    }
                    else
                    {
                        isPaidDesc = "nieopłacone";
                    }

                    string isCompletedDesc;
                    if (o.ordIsCompleted.Equals("Y"))
                    {
                        isCompletedDesc = "skompletowane";
                    }
                    else
                    {
                        isCompletedDesc = "nieopłacone";
                    }
                    listBoxOrders.Items.Add(o.ordId + " " + o.ordUsrId.usrFirstName + " " + o.ordUsrId.usrLastName + " " + o.ordTotalPrice + " " + isPaidDesc + " " + isCompletedDesc);
                }
            }
        }
Exemple #4
0
        private void addCategoryButton_Click(object sender, EventArgs e)
        {
            using (MusicShopWebServiceClient service = new MusicShopWebServiceClient())
            {
                int    catId   = int.Parse(idCategoryBox.Text);
                string catName = nameCategoryBox.Text;

                service.addNewCategory(catId, catName);
            }
        }
Exemple #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            using (MusicShopWebServiceClient service = new MusicShopWebServiceClient())
            {
                products[] data = service.getAllProducts();

                listBoxProducts.Items.Clear();
                foreach (products p in data)
                {
                    listBoxProducts.Items.Add(p.prdId + " " + p.prdName + " " + p.prdAmount + " " + p.prdPrice);
                }
            }
        }
Exemple #6
0
        private void button3_Click(object sender, EventArgs e)
        {
            using (MusicShopWebServiceClient service = new MusicShopWebServiceClient())
            {
                int    productId   = int.Parse(productIdBox.Text);
                string name        = productNameBox.Text;
                int    amount      = int.Parse(productAmountBox.Text);
                double price       = double.Parse(productPriceBox.Text);
                string description = productDescriptionBox.Text;
                string catName     = comboBoxCategories.Text;

                service.addNewProduct(productId, name, price, amount, description, catName);
            }
        }
Exemple #7
0
        private void addOrderButton_Click(object sender, EventArgs e)
        {
            using (MusicShopWebServiceClient service = new MusicShopWebServiceClient())
            {
                int      orderId       = int.Parse(orderIdBox.Text);
                string   userLogin     = userComboBox.Text;
                string   productName   = productComboBox.Text;
                DateTime orderDate     = orderDatePicker.Value.Date;
                DateTime paymentDate   = paymentDatePicker.Value.Date;
                DateTime completedDate = completedDatePicker.Value.Date;

                service.addNewOrder(orderId, userLogin, productName, orderDate, paymentDate, completedDate);
            }
        }
Exemple #8
0
        private void button4_Click(object sender, EventArgs e)
        {
            using (MusicShopWebServiceClient service = new MusicShopWebServiceClient())
            {
                categories[] data = service.getAllCategories();

                listBoxCategories.Items.Clear();
                comboBoxCategories.Items.Clear();
                foreach (categories c in data)
                {
                    listBoxCategories.Items.Add(c.catName);
                    comboBoxCategories.Items.Add(c.catName);
                }
            }
        }