/// <summary> /// Store the Location model attributes - Facility Name and Limits ONLY /// </summary> /// <param name="model"></param> public void UpdateProjectLocationModel(LocationModel model) { using (SqlCommand command = new SqlCommand("[dbo].[UpdateProjectLocation]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@PROJECTVERSIONID", model.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 versionId, string year) { //throw new NotImplementedException(); LocationModel result = null; using (SqlCommand command = new SqlCommand("[RTP].[GetProjectLocation]") { CommandType = CommandType.StoredProcedure }) { command.Parameters.AddWithValue("@PROJECTVERSIONID", versionId); command.Parameters.AddWithValue("@YEAR", year); using (IDataReader rdr = ExecuteReader(command)) { if (rdr.Read()) { result = new LocationModel(); result.FacilityName = rdr["FacilityName"].ToString(); result.Limits = rdr["Limits"].ToString(); result.ProjectVersionId = versionId; result.RtpYear = year; result.ProjectName = rdr["ProjectName"].ToString(); result.ProjectId = rdr["ProjectId"] != DBNull.Value ? (int?)rdr["ProjectId"] : null; result.RouteId = rdr["RouteID"] != DBNull.Value ? (int)rdr["RouteID"] : 0; } } } return result; }