public void RemoveDelivaryBoy(Remove_Delivery_Boy booy) { delivery_boy boy = new delivery_boy(); string ordb = "Data source=orcl;User Id=hr; Password=hr;"; OracleConnection conn; conn = new OracleConnection(ordb); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "delete from Delivery_boy where Delivery_boy_ID=:id"; cmd.Parameters.Add("id", booy.cmb_Delivery_boy_delete.Text); int r = cmd.ExecuteNonQuery(); if (r != -1) { booy.cmb_Delivery_boy_delete.Items.RemoveAt(booy.cmb_Delivery_boy_delete.SelectedIndex); booy.Full_Name_del_Delivery_Boy_box.Text = ""; booy.Phone_del_Delivery_Boy_box.Text = ""; booy.No_Orders_del_delivery_boy_box.Text = ""; MessageBox.Show("Delivery Boy deleted"); } }
public void addDelivayBoy(Add_Delivery_Boy booy) { delivery_boy boy = new delivery_boy(); string ordb = "Data source=orcl;User Id=hr; Password=hr;"; OracleConnection conn; conn = new OracleConnection(ordb); conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; boy.setName(booy.Full_Name_Delivery_Boy_box.Text.ToString()); boy.setId(int.Parse(booy.ID_Delivery_Boy_box.Text.ToString())); boy.setPhone_no(booy.Phone_No_delivery_boy_box.Text.ToString()); cmd.CommandText = "insert into Delivery_boy values (:Full_Name,:ID,:Phone_No,:No_Orders)"; cmd.Parameters.Add("Full_Name", boy.getName()); cmd.Parameters.Add("ID", boy.getId()); cmd.Parameters.Add("Phone_No", boy.getPhone_no()); cmd.Parameters.Add("No_Orders", "0"); int r = cmd.ExecuteNonQuery(); if (r != -1) { MessageBox.Show("New Delivery Boy is added"); } }