protected void uploadButton_Click1(object sender, EventArgs e) { foreach (Hardware h in hc) { if (h.Name == hardwareElement.SelectedItem.ToString()) { p.IdHardware = h.RecordId; } } p.Text = textReport.Text.ToString(); DateTime d = DateTime.Now; p.Date = d; p.repair = false; PoruchaFactory poruchaFactory = new PoruchaFactory(); PoruchaGateway <Porucha> pg = (PoruchaGateway <Porucha>)poruchaFactory.GetPorucha(); pg.Insert(p); Response.Redirect("~/Home.aspx"); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != null && comboBox1.SelectedIndex != null) { foreach (var i in h) { if (i.Name.Equals(comboBox1.Text, StringComparison.Ordinal)) { p.IdHardware = i.RecordId; } } DateTime d = DateTime.Now; p.Date = d; p.repair = false; PoruchaFactory poruchaFactory = new PoruchaFactory(); PoruchaGateway <Porucha> pg = (PoruchaGateway <Porucha>)poruchaFactory.GetPorucha(); pg.Insert(p); Close(); } else { MessageBox.Show("Choose dates!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }