Example #1
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            Inventory_Management_Client.ServiceReference1.Service1Client pr = new Inventory_Management_Client.ServiceReference1.Service1Client("BasicHttpBinding_IService1");

            int      ID       = (int)e.Keys["Id"];
            Product  p        = new Product();
            string   name     = (string)e.NewValues["name"];
            int      quantity = int.Parse((string)e.NewValues["quantity"]);
            string   brand    = (string)e.NewValues["brand"];
            string   cb       = (string)e.NewValues["checkBy"];
            double   price    = double.Parse((string)e.NewValues["price"]);
            DateTime dar      = DateTime.Parse((string)e.NewValues["dateOfArrival"]);

            Label1.Text     = name;
            p.ID            = ID;
            p.Name          = name;
            p.Quantity      = quantity;
            p.Price         = price;
            p.CheckBy       = cb;
            p.DateOfArrival = dar;
            p.Brand         = brand;
            pr.UpdateProduct(p);
            GridView1.EditIndex = -1;
            BindData();
        }
Example #2
0
        private void BindData()
        {
            Inventory_Management_Client.ServiceReference1.Service1Client pr = new Inventory_Management_Client.ServiceReference1.Service1Client("BasicHttpBinding_IService1");

            DataSet ds = pr.GetAllProduct();

            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
Example #3
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            Inventory_Management_Client.ServiceReference1.Service1Client pr = new Inventory_Management_Client.ServiceReference1.Service1Client("BasicHttpBinding_IService1");

            int ID = (int)e.Keys["Id"];

            pr.DeleteProduct(ID);
            // Delete here the database record for the selected patientID

            BindData();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            Inventory_Management_Client.ServiceReference1.Service1Client pr = new Inventory_Management_Client.ServiceReference1.Service1Client("BasicHttpBinding_IService1");
            Product p = new Product();

            p.Name          = TextBox1.Text;
            p.Price         = float.Parse(TextBox4.Text);
            p.Quantity      = int.Parse(TextBox2.Text);
            p.Brand         = TextBox3.Text;
            p.CheckBy       = TextBox5.Text;
            p.DateOfArrival = DateTime.Parse(TextBox6.Text);

            pr.AddProduct(p);
            Response.Redirect("HomePage.aspx");
        }