private void update_btn_Click(object sender, EventArgs e) { // For taking the Image byte[] imageBt = null; FileStream fstream = new FileStream("", FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fstream); imageBt = br.ReadBytes((int)fstream.Length); Plant plt = new Plant(); { plt.Plant_id = Convert.ToInt16(ID_txtbx.Text); plt.Vpp_id = Convert.ToInt16(virtual_power_plant_id_txtbx.Text); plt.Vpp_region = vpp_region_txt_bx.Text; plt.Plant_generating_type = generating_planttype_txtbx.Text; plt.Date_of_aquisition = date_of_aquisition_txtbx.Text; plt.Power_in_KW = Convert.ToInt16(power_txtbx.Text); plt.Manufacturer = manufacturer_txtbx.Text; plt.Purchase_price_in_Euros = purchase_price_txtbx.Text; plt.Location = location_txtbx.Text; plt.Operating_time = Convert.ToInt16(operating_time_txtbx.Text); plt.Plane_image = imageBt; } PlantBusiness.UpdatePlant(plt); MessageBox.Show("Data Inserted Successfully", "Data Inserted", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void delete_btn_Click(object sender, EventArgs e) { Plant plt = new Plant(); plt.Plant_id = Convert.ToInt16(ID_txtbx.Text); PlantBusiness.DeletePlant(plt.Plant_id); MessageBox.Show("Data Deleted Successfully", "Data Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void search_by_virtual_id_btn_Click(object sender, EventArgs e) { try { Plant plt = new Plant(); plt.Vpp_id = Convert.ToInt16(search_by_virtual_id_txt_bx.Text); dgv_data.DataSource = PlantBusiness.SearchPlantByVirtualId(plt.Vpp_id); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void gas_system_btn_Click(object sender, EventArgs e) { dgv_data.DataSource = PlantBusiness.GasSystemData(); }
private void photo_voltaic_btn_Click(object sender, EventArgs e) { dgv_data.DataSource = PlantBusiness.PhotoVoltaicData(); }
private void wind_turbine_btn_Click(object sender, EventArgs e) { dgv_data.DataSource = PlantBusiness.WindTurbineData(); }
private void master_data_btn_Click(object sender, EventArgs e) { dgv_data.DataSource = PlantBusiness.MasterData(); }