protected void btnSave_Click(object sender, EventArgs e) { LabTests tTests = new LabTests(); if (!string.IsNullOrEmpty(txtLabName.Text) || !string.IsNullOrEmpty(txtTestName.Text) || !string.IsNullOrEmpty(txtDistrict.Text) || !string.IsNullOrEmpty(txtLocation.Text)) { tTests.Lab_name = txtLabName.Text; tTests.Test_name = txtTestName.Text; tTests.District_or_city = txtDistrict.Text; tTests.Address_or_location = txtLocation.Text; tTests.About = txtAbout.Text; int rowCount = _ltManager.Save(tTests); if (rowCount > 0) { warningPanel.Visible = false; successPanel.Visible = true; alertText.InnerHtml = "Saved Successfully"; } } else { successPanel.Visible = false; warningPanel.Visible = true; errorName.InnerHtml = "Warning"; errorText.InnerHtml = "Field Canot Be empty"; } }
internal int Insert(LabTests tTests) { connection.Open(); command = new SqlCommand("sp_labTest", connection); command.Parameters.Clear(); command.Parameters.Add("@lab_name", SqlDbType.NVarChar).Value = tTests.Lab_name; command.Parameters.Add("@test_name", SqlDbType.NVarChar).Value = tTests.Test_name; command.Parameters.Add("@district_or_city", SqlDbType.NVarChar).Value = tTests.District_or_city; command.Parameters.Add("@address_or_location", SqlDbType.NVarChar).Value = tTests.Address_or_location; command.Parameters.Add("@about", SqlDbType.NVarChar).Value = tTests.About; command.CommandType = CommandType.StoredProcedure; row = command.ExecuteNonQuery(); connection.Close(); return(row); }
static void Main(string[] args) { DataInterfaces.ConnectionString = "Server=LAPTOP-BQ764BQT;Database=OnlineClone;Trusted_Connection=True; Connection Timeout=1000"; var exportFile = new FileInfo("data\\Biome2Data.xml"); var schemaFile = new FileInfo("data\\Biome2Schema.xml"); if (!(exportFile.Exists && schemaFile.Exists)) { throw new Exception($"Data file does not exits {exportFile.FullName} or schema {schemaFile.FullName}"); } var import = new DataSet(); import.ReadXmlSchema(schemaFile.FullName); import.ReadXml(exportFile.FullName); DataInterfaces.Import(import); LabTests.ComputeFull(); }
internal int Save(LabTests tTests) { return(_ltgateway.Insert(tTests)); }