Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (button2.Text.Length <= 100)
            {
                string temp = "";
                if (id == -1) //add new one
                {
                    temp = "name=" + textBox1.Text;
                    info.GET("http://localhost:32768/api/Editor/addCategories", temp);
                }
                else   //edit exists one
                {
                    temp = "id=" + label4.Text + "&name=" + textBox1.Text;
                    info.GET("http://localhost:32768/api/Editor/editCategories", temp);
                }

                this.Hide();
                form.Left = this.Left;
                form.Top  = this.Top;
                form.Invalidate();
                form.Show();
                Thread.Sleep(1000);
                form.refreshInfo();
            }
            else
            {
                MessageBox.Show("Name length>100 symbols.");
            }
        }
Exemplo n.º 2
0
        public void refreshInfo()
        {
            bool loadComplete = info.GET("http://localhost:32768/api/Editor/getProducts");

            if (!loadComplete)
            {
                MessageBox.Show(info.error);
                info.productList = new List <Product>();
            }
            else
            {
                info.productList = new List <Product>();
                info.productList = Product.parser(info.xmlString);
            }
            showNew();
        }
Exemplo n.º 3
0
        public void refreshInfo()
        {
            bool loadComplete = info.GET("http://localhost:32768/api/Editor/getCategories");

            if (!loadComplete)
            {
                MessageBox.Show(info.error);
                info.categoryList = new List <Categories>();
            }
            else
            {
                info.categoryList = new List <Categories>();
                info.categoryList = Categories.parser(info.xmlString);
            }
            showNew();
        }
Exemplo n.º 4
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (button2.Text.Length <= 100)
            {
                string temp = "";
                if (id == -1) //add new one
                {
                    temp = "name=" + textBox2.Text +
                           "&price=" + textBox3.Text +
                           "&count=" + textBox4.Text +
                           "&categoryid=" + textBox6.Text +
                           "&description=" + richTextBox1.Text;
                    info.GET("http://localhost:32768/api/Editor/addProduct", temp);
                }
                else //edit exists one
                {
                    if (!info.productList[id].name.Equals(textBox2.Text))
                    {
                        temp = "id=" + label7.Text + "&field=name&value=" + textBox2.Text;
                        info.GET("http://localhost:32768/api/Editor/editProduct", temp);
                    }
                    if (!info.productList[id].price.Equals(textBox3.Text))
                    {
                        temp = "id=" + label7.Text + "&field=price&value=" + textBox3.Text;
                        info.GET("http://localhost:32768/api/Editor/editProduct", temp);
                    }
                    if (!info.productList[id].count.Equals(textBox4.Text))
                    {
                        temp = "id=" + label7.Text + "&field=count&value=" + textBox4.Text;
                        info.GET("http://localhost:32768/api/Editor/editProduct", temp);
                    }
                    if (!info.productList[id].categoryId.Equals(textBox6.Text))
                    {
                        temp = "id=" + label7.Text + "&field=categoryid&value=" + textBox6.Text;
                        info.GET("http://localhost:32768/api/Editor/editProduct", temp);
                    }
                    if (!info.productList[id].description.Equals(richTextBox1.Text))
                    {
                        temp = "id=" + label7.Text + "&field=description&value=" + richTextBox1.Text;
                        info.GET("http://localhost:32768/api/Editor/editProduct", temp);
                    }
                }

                this.Hide();
                form.Left = this.Left;
                form.Top  = this.Top;
                form.Invalidate();
                form.Show();
                Thread.Sleep(1000);
                form.refreshInfo();
            }
            else
            {
                MessageBox.Show("Name length>100 symbols.");
            }
        }