예제 #1
0
        private void PLoadList()
        {
            string         result  = PRestClient.GetAllProduct();
            List <Product> product = JsonConvert.DeserializeObject <List <Product> >(result);

            foreach (var p in product)
            {
                P_datagrid.Rows.Add(
                    p.Productname,
                    p.Productid,
                    p.Model,
                    p.Brand,
                    p.Attributes
                    );
            }
            ;
        }
예제 #2
0
        private void AP_addButton_Click(object sender, EventArgs e)
        {
            Product p = new Product(
                tb_PN.Text,
                -1,
                tb_M.Text,
                tb_B.Text,
                tb_AT.Text);

            string response = PRestClient.InsertProduct(p);

            if (response.Equals("success"))
            {
                MessageBox.Show("Product is sucessfully added.");
            }

            this.Hide();
            Inventory list = new Inventory();

            list.Show();
        }
        private void UP_updateButton_Click(object sender, EventArgs e)
        {
            Product p = new Product(
                tb_PN.Text,
                Convert.ToInt32(lbl_productid.Text),
                tb_M.Text,
                tb_B.Text,
                tb_AT.Text
                );



            if (PRestClient.UpdateProduct(p).Equals("success"))
            {
                MessageBox.Show("Product is sucessfully updated.");
            }

            this.Hide();
            Inventory list = new Inventory();

            list.Show();
        }
예제 #4
0
 private void P_deleteButton_Click(object sender, EventArgs e)
 {
     PRestClient.DeleteProduct(Convert.ToInt32(P_datagrid.CurrentRow.Cells[1].Value));
     P_datagrid.Rows.Clear();
     PLoadList();
 }