private void SaveTestingPoint(FacilityTestingPoint fp, SqlTransaction sqltransaction) { string sql = "INSERT INTO FacilityTestingPoint(FacilityId, TestingPointTypeId,ProvinceId) " + "VALUES (@FacilityId, @TestingPointTypeId,@ProvinceId) SELECT @@identity"; using (SqlCommand cm = new SqlCommand(sql, DefaultConnection, sqltransaction)) { SetFacilityTestingPoint(cm, fp); fp.Id = int.Parse(cm.ExecuteScalar().ToString()); } }
private void FetchFacilityTestingPoint(SqlDataReader dr, Facility fac) { while (dr.Read()) { FacilityTestingPoint fp = new FacilityTestingPoint { Id = DatabaseHelper.GetInt32("Id", dr), FacilityId = DatabaseHelper.GetInt32("FacilityId", dr), Testingpointtypeid = DatabaseHelper.GetInt32("TestingPointTypeId", dr), TypeName = DatabaseHelper.GetString("TypeName", dr), ProvinceId = DatabaseHelper.GetInt32("ProvinceId", dr) }; fac.TestingPoints.Add(fp); } }
private void SetFacilityTestingPoint(SqlCommand cm, FacilityTestingPoint fp) { DatabaseHelper.InsertInt32Param("@FacilityId", cm, fp.FacilityId); DatabaseHelper.InsertInt32Param("@TestingPointTypeId", cm, fp.Testingpointtypeid); DatabaseHelper.InsertInt32Param("@ProvinceId", cm, fp.ProvinceId); }