/// <summary> /// Store the Location model attributes - Facility Name and Limits ONLY /// </summary> /// <param name="model"></param> public void UpdateProjectLocationModel(LocationModel model, int projectVersionId) { using (SqlCommand command = new SqlCommand("[dbo].[UpdateProjectLocation]") { CommandType = CommandType.StoredProcedure }) { //model.Adoption != null ? (object)model.Adoption.Value : (object)DBNull.Value command.Parameters.AddWithValue("@PROJECTVERSIONID", projectVersionId); command.Parameters.AddWithValue("@FACILITYNAME", model.FacilityName); command.Parameters.AddWithValue("@LIMITS", model.Limits); command.Parameters.AddWithValue("@RouteId", model.RouteId); this.ExecuteNonQuery(command); } }
/// <summary> /// Get the Location Model /// </summary> /// <param name="versionId"></param> /// <param name="tipYear"></param> /// <returns></returns> public LocationModel GetProjectLocationModel(int projectVersionId, string year) { LocationModel result = null; using (SqlCommand command = new SqlCommand("[Survey].[GetProjectLocation]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@ProjectVersionID", projectVersionId); using (IDataReader rdr = ExecuteReader(command)) { if (rdr.Read()) { result = new LocationModel(); result.FacilityName = rdr["FacilityName"].ToString(); result.Limits = rdr["Limits"].ToString(); result.RouteId = rdr["RouteID"].ToString().SmartParseDefault<int>(default(int)); } } } return result; }